brew-js-react 0.5.4 → 0.5.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.
- package/dist/brew-js-react.js +173 -164
- package/dist/brew-js-react.js.map +1 -1
- package/dist/brew-js-react.min.js +2 -2
- package/dist/brew-js-react.min.js.map +1 -1
- package/entry.js +7 -4
- package/hooks.js +5 -16
- package/mixin.js +9 -9
- package/package.json +2 -2
- package/view.d.ts +41 -0
- package/view.js +59 -39
package/dist/brew-js-react.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! brew-js-react v0.5.
|
|
1
|
+
/*! brew-js-react v0.5.5 | (c) misonou | https://misonou.github.io */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
|
-
module.exports = factory(require("
|
|
4
|
+
module.exports = factory(require("zeta-dom"), require("react"), require("react-dom"), require("brew-js"), require("zeta-dom-react"), require("waterpipe"), require("jquery"));
|
|
5
5
|
else if(typeof define === 'function' && define.amd)
|
|
6
|
-
define("brew-js-react", ["
|
|
6
|
+
define("brew-js-react", ["zeta-dom", "react", "react-dom", "brew-js", "zeta-dom-react", "waterpipe", "jquery"], factory);
|
|
7
7
|
else if(typeof exports === 'object')
|
|
8
|
-
exports["brew-js-react"] = factory(require("
|
|
8
|
+
exports["brew-js-react"] = factory(require("zeta-dom"), require("react"), require("react-dom"), require("brew-js"), require("zeta-dom-react"), require("waterpipe"), require("jquery"));
|
|
9
9
|
else
|
|
10
|
-
root["brew
|
|
11
|
-
})(self, (
|
|
10
|
+
root["brew"] = root["brew"] || {}, root["brew"]["react"] = factory(root["zeta"], root["React"], root["ReactDOM"], root["brew"], root["zeta"]["react"], root["waterpipe"], root["jQuery"]);
|
|
11
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__231__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__311__, __WEBPACK_EXTERNAL_MODULE__760__, __WEBPACK_EXTERNAL_MODULE__402__, __WEBPACK_EXTERNAL_MODULE__87__, __WEBPACK_EXTERNAL_MODULE__942__) => {
|
|
12
12
|
return /******/ (() => { // webpackBootstrap
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
@@ -20,14 +20,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__87__;
|
|
|
20
20
|
|
|
21
21
|
/***/ }),
|
|
22
22
|
|
|
23
|
-
/***/ 9:
|
|
24
|
-
/***/ ((module) => {
|
|
25
|
-
|
|
26
|
-
"use strict";
|
|
27
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
|
28
|
-
|
|
29
|
-
/***/ }),
|
|
30
|
-
|
|
31
23
|
/***/ 760:
|
|
32
24
|
/***/ ((module) => {
|
|
33
25
|
|
|
@@ -36,11 +28,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__760__;
|
|
|
36
28
|
|
|
37
29
|
/***/ }),
|
|
38
30
|
|
|
39
|
-
/***/
|
|
31
|
+
/***/ 942:
|
|
40
32
|
/***/ ((module) => {
|
|
41
33
|
|
|
42
34
|
"use strict";
|
|
43
|
-
module.exports =
|
|
35
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__942__;
|
|
44
36
|
|
|
45
37
|
/***/ }),
|
|
46
38
|
|
|
@@ -52,11 +44,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
|
|
52
44
|
|
|
53
45
|
/***/ }),
|
|
54
46
|
|
|
55
|
-
/***/
|
|
47
|
+
/***/ 311:
|
|
56
48
|
/***/ ((module) => {
|
|
57
49
|
|
|
58
50
|
"use strict";
|
|
59
|
-
module.exports =
|
|
51
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__311__;
|
|
60
52
|
|
|
61
53
|
/***/ }),
|
|
62
54
|
|
|
@@ -68,10 +60,18 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__231__;
|
|
|
68
60
|
|
|
69
61
|
/***/ }),
|
|
70
62
|
|
|
63
|
+
/***/ 402:
|
|
64
|
+
/***/ ((module) => {
|
|
65
|
+
|
|
66
|
+
"use strict";
|
|
67
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__402__;
|
|
68
|
+
|
|
69
|
+
/***/ }),
|
|
70
|
+
|
|
71
71
|
/***/ 621:
|
|
72
72
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
73
73
|
|
|
74
|
-
var ReactDOM = __webpack_require__(
|
|
74
|
+
var ReactDOM = __webpack_require__(311);
|
|
75
75
|
var ReactDOMClient;
|
|
76
76
|
|
|
77
77
|
if (ReactDOM.createRoot) {
|
|
@@ -161,77 +161,59 @@ var __webpack_exports__ = {};
|
|
|
161
161
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
162
162
|
(() => {
|
|
163
163
|
"use strict";
|
|
164
|
+
// ESM COMPAT FLAG
|
|
165
|
+
__webpack_require__.r(__webpack_exports__);
|
|
164
166
|
|
|
165
167
|
// EXPORTS
|
|
166
168
|
__webpack_require__.d(__webpack_exports__, {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
useRouteParam: () => (useRouteParam),
|
|
214
|
-
useRouteState: () => (useRouteState),
|
|
215
|
-
useScrollIntoViewMixin: () => (useScrollIntoViewMixin),
|
|
216
|
-
useScrollableMixin: () => (useScrollableMixin),
|
|
217
|
-
useUnmanagedClassNameMixin: () => (useUnmanagedClassNameMixin),
|
|
218
|
-
useViewContainerState: () => (useViewContext),
|
|
219
|
-
useViewContext: () => (useViewContext)
|
|
169
|
+
AnimateMixin: () => (/* reexport */ AnimateMixin),
|
|
170
|
+
AnimateSequenceItemMixin: () => (/* reexport */ AnimateSequenceItemMixin),
|
|
171
|
+
AnimateSequenceMixin: () => (/* reexport */ AnimateSequenceMixin),
|
|
172
|
+
ClassNameMixin: () => (/* reexport */ ClassNameMixin),
|
|
173
|
+
ClassNameToggleMixin: () => (/* reexport */ ClassNameToggleMixin),
|
|
174
|
+
Dialog: () => (/* reexport */ Dialog),
|
|
175
|
+
FlyoutMixin: () => (/* reexport */ FlyoutMixin),
|
|
176
|
+
FlyoutToggleMixin: () => (/* reexport */ FlyoutToggleMixin),
|
|
177
|
+
FocusStateMixin: () => (/* reexport */ FocusStateMixin),
|
|
178
|
+
LoadingStateMixin: () => (/* reexport */ LoadingStateMixin),
|
|
179
|
+
Mixin: () => (/* reexport */ Mixin),
|
|
180
|
+
ScrollIntoViewMixin: () => (/* reexport */ ScrollIntoViewMixin),
|
|
181
|
+
ScrollableMixin: () => (/* reexport */ ScrollableMixin),
|
|
182
|
+
StatefulMixin: () => (/* reexport */ StatefulMixin),
|
|
183
|
+
UnmanagedClassNameMixin: () => (/* reexport */ UnmanagedClassNameMixin),
|
|
184
|
+
ViewStateContainer: () => (/* reexport */ ViewStateContainer),
|
|
185
|
+
createDialog: () => (/* reexport */ createDialog),
|
|
186
|
+
isViewMatched: () => (/* reexport */ isViewMatched),
|
|
187
|
+
isViewRendered: () => (/* reexport */ isViewRendered),
|
|
188
|
+
linkTo: () => (/* reexport */ linkTo),
|
|
189
|
+
makeTranslation: () => (/* reexport */ makeTranslation),
|
|
190
|
+
matchView: () => (/* reexport */ matchView),
|
|
191
|
+
navigateTo: () => (/* reexport */ navigateTo),
|
|
192
|
+
redirectTo: () => (/* reexport */ redirectTo),
|
|
193
|
+
registerErrorView: () => (/* reexport */ registerErrorView),
|
|
194
|
+
registerView: () => (/* reexport */ registerView),
|
|
195
|
+
renderView: () => (/* reexport */ renderView),
|
|
196
|
+
resolvePath: () => (/* reexport */ resolvePath),
|
|
197
|
+
useAnimateMixin: () => (/* reexport */ useAnimateMixin),
|
|
198
|
+
useAnimateSequenceMixin: () => (/* reexport */ useAnimateSequenceMixin),
|
|
199
|
+
useAppReady: () => (/* reexport */ useAppReady),
|
|
200
|
+
useAppReadyState: () => (/* reexport */ useAppReadyState),
|
|
201
|
+
useClassNameToggleMixin: () => (/* reexport */ useClassNameToggleMixin),
|
|
202
|
+
useFlyoutMixin: () => (/* reexport */ useFlyoutMixin),
|
|
203
|
+
useFocusStateMixin: () => (/* reexport */ useFocusStateMixin),
|
|
204
|
+
useLanguage: () => (/* reexport */ useLanguage),
|
|
205
|
+
useLoadingStateMixin: () => (/* reexport */ useLoadingStateMixin),
|
|
206
|
+
useMixin: () => (/* reexport */ useMixin),
|
|
207
|
+
useMixinRef: () => (/* reexport */ useMixinRef),
|
|
208
|
+
useRouteParam: () => (/* reexport */ useRouteParam),
|
|
209
|
+
useRouteState: () => (/* reexport */ useRouteState),
|
|
210
|
+
useScrollIntoViewMixin: () => (/* reexport */ useScrollIntoViewMixin),
|
|
211
|
+
useScrollableMixin: () => (/* reexport */ useScrollableMixin),
|
|
212
|
+
useUnmanagedClassNameMixin: () => (/* reexport */ useUnmanagedClassNameMixin),
|
|
213
|
+
useViewContainerState: () => (/* reexport */ useViewContext),
|
|
214
|
+
useViewContext: () => (/* reexport */ useViewContext)
|
|
220
215
|
});
|
|
221
216
|
|
|
222
|
-
// EXTERNAL MODULE: external {"commonjs":"brew-js","commonjs2":"brew-js","amd":"brew-js","root":"brew"}
|
|
223
|
-
var external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_ = __webpack_require__(760);
|
|
224
|
-
;// CONCATENATED MODULE: ./|umd|/brew-js/app.js
|
|
225
|
-
|
|
226
|
-
/* harmony default export */ const app = (external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_);
|
|
227
|
-
var install = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.install;
|
|
228
|
-
|
|
229
|
-
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":"React"}
|
|
230
|
-
var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(12);
|
|
231
|
-
// EXTERNAL MODULE: external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":"ReactDOM"}
|
|
232
|
-
var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_ = __webpack_require__(33);
|
|
233
|
-
// EXTERNAL MODULE: ./node_modules/@misonou/react-dom-client/fallback.js
|
|
234
|
-
var fallback = __webpack_require__(621);
|
|
235
217
|
// EXTERNAL MODULE: external {"commonjs":"zeta-dom","commonjs2":"zeta-dom","amd":"zeta-dom","root":"zeta"}
|
|
236
218
|
var external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_ = __webpack_require__(231);
|
|
237
219
|
;// CONCATENATED MODULE: ./|umd|/zeta-dom/util.js
|
|
@@ -243,6 +225,7 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
243
225
|
combineFn = _lib$util.combineFn,
|
|
244
226
|
createPrivateStore = _lib$util.createPrivateStore,
|
|
245
227
|
util_define = _lib$util.define,
|
|
228
|
+
defineGetterProperty = _lib$util.defineGetterProperty,
|
|
246
229
|
defineHiddenProperty = _lib$util.defineHiddenProperty,
|
|
247
230
|
defineObservableProperty = _lib$util.defineObservableProperty,
|
|
248
231
|
defineOwnProperty = _lib$util.defineOwnProperty,
|
|
@@ -257,6 +240,7 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
257
240
|
fill = _lib$util.fill,
|
|
258
241
|
freeze = _lib$util.freeze,
|
|
259
242
|
grep = _lib$util.grep,
|
|
243
|
+
isArray = _lib$util.isArray,
|
|
260
244
|
isFunction = _lib$util.isFunction,
|
|
261
245
|
isPlainObject = _lib$util.isPlainObject,
|
|
262
246
|
isThenable = _lib$util.isThenable,
|
|
@@ -279,6 +263,12 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
279
263
|
watch = _lib$util.watch,
|
|
280
264
|
watchable = _lib$util.watchable;
|
|
281
265
|
|
|
266
|
+
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":["React"]}
|
|
267
|
+
var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(12);
|
|
268
|
+
// EXTERNAL MODULE: external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":["ReactDOM"]}
|
|
269
|
+
var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_ = __webpack_require__(311);
|
|
270
|
+
// EXTERNAL MODULE: ./node_modules/@misonou/react-dom-client/fallback.js
|
|
271
|
+
var fallback = __webpack_require__(621);
|
|
282
272
|
;// CONCATENATED MODULE: ./|umd|/zeta-dom/domUtil.js
|
|
283
273
|
|
|
284
274
|
var domUtil_lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_.util,
|
|
@@ -300,6 +290,8 @@ var _lib$dom = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_z
|
|
|
300
290
|
preventLeave = _lib$dom.preventLeave,
|
|
301
291
|
subscribeAsync = _lib$dom.subscribeAsync;
|
|
302
292
|
|
|
293
|
+
// EXTERNAL MODULE: external {"commonjs":"brew-js","commonjs2":"brew-js","amd":"brew-js","root":"brew"}
|
|
294
|
+
var external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_ = __webpack_require__(760);
|
|
303
295
|
;// CONCATENATED MODULE: ./|umd|/brew-js/domAction.js
|
|
304
296
|
|
|
305
297
|
var closeFlyout = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.closeFlyout,
|
|
@@ -404,12 +396,17 @@ function Dialog(props) {
|
|
|
404
396
|
}, [dialog]);
|
|
405
397
|
return /*#__PURE__*/external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_.createPortal(props.children, dialog.root);
|
|
406
398
|
}
|
|
407
|
-
// EXTERNAL MODULE: external "zeta-dom-react"
|
|
408
|
-
var
|
|
399
|
+
// EXTERNAL MODULE: external {"commonjs":"zeta-dom-react","commonjs2":"zeta-dom-react","amd":"zeta-dom-react","root":["zeta","react"]}
|
|
400
|
+
var external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_ = __webpack_require__(402);
|
|
409
401
|
;// CONCATENATED MODULE: ./|umd|/zeta-dom/events.js
|
|
410
402
|
|
|
411
403
|
var EventContainer = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_.EventContainer;
|
|
412
404
|
|
|
405
|
+
;// CONCATENATED MODULE: ./|umd|/brew-js/app.js
|
|
406
|
+
|
|
407
|
+
/* harmony default export */ const app = ((/* unused pure expression or super */ null && (lib)));
|
|
408
|
+
var install = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.install;
|
|
409
|
+
|
|
413
410
|
;// CONCATENATED MODULE: ./|umd|/brew-js/defaults.js
|
|
414
411
|
|
|
415
412
|
var defaults = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.defaults;
|
|
@@ -457,7 +454,7 @@ var routeMap = new Map();
|
|
|
457
454
|
var usedParams = {};
|
|
458
455
|
var sortedViews = [];
|
|
459
456
|
var emitter = new EventContainer();
|
|
460
|
-
var rootContext = freeze(extend(new ViewContext(
|
|
457
|
+
var rootContext = freeze(extend(new ViewContext(), {
|
|
461
458
|
container: root
|
|
462
459
|
}));
|
|
463
460
|
var rootState = _(rootContext);
|
|
@@ -489,13 +486,13 @@ onAppInit(function () {
|
|
|
489
486
|
}));
|
|
490
487
|
});
|
|
491
488
|
});
|
|
492
|
-
function ViewContext(view, page) {
|
|
489
|
+
function ViewContext(view, page, parent) {
|
|
493
490
|
var self = this;
|
|
494
|
-
|
|
495
|
-
defineOwnProperty(self, '
|
|
491
|
+
defineOwnProperty(self, 'view', view || null, true);
|
|
492
|
+
defineOwnProperty(self, 'parent', parent || null, true);
|
|
496
493
|
_(self, {
|
|
497
494
|
children: [],
|
|
498
|
-
setPage: defineObservableProperty(self, 'page', page, true),
|
|
495
|
+
setPage: defineObservableProperty(self, 'page', page || null, true),
|
|
499
496
|
setActive: defineObservableProperty(self, 'active', !!page, true)
|
|
500
497
|
});
|
|
501
498
|
watch(self, 'page', function (page, previousPage) {
|
|
@@ -505,6 +502,11 @@ function ViewContext(view, page) {
|
|
|
505
502
|
});
|
|
506
503
|
}
|
|
507
504
|
definePrototype(ViewContext, {
|
|
505
|
+
getChildren: function getChildren() {
|
|
506
|
+
return map(_(this).children, function (v) {
|
|
507
|
+
return v.currentState;
|
|
508
|
+
});
|
|
509
|
+
},
|
|
508
510
|
on: function on(event, handler) {
|
|
509
511
|
return emitter.add(this, event, handler);
|
|
510
512
|
}
|
|
@@ -561,15 +563,25 @@ function ViewContainer() {
|
|
|
561
563
|
}
|
|
562
564
|
ViewContainer.contextType = StateContext;
|
|
563
565
|
definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react_root_React_.Component, {
|
|
566
|
+
setActive: noop,
|
|
564
567
|
componentDidMount: function componentDidMount() {
|
|
565
568
|
var self = this;
|
|
566
569
|
var parent = _(self.context).children;
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
(self.setActive || noop)(self.getViewComponent() === self.currentViewComponent);
|
|
570
|
-
}), function () {
|
|
571
|
-
arrRemove(parent, self);
|
|
570
|
+
var unwatch = watch(app_app.route, function () {
|
|
571
|
+
self.setActive(self.getViewComponent() === self.currentViewComponent);
|
|
572
572
|
});
|
|
573
|
+
self.componentWillUnmount = function () {
|
|
574
|
+
self.setActive(false);
|
|
575
|
+
arrRemove(parent, self);
|
|
576
|
+
unwatch();
|
|
577
|
+
setImmediate(function () {
|
|
578
|
+
if (self.unmountView && !self.currentState.active) {
|
|
579
|
+
self.unmountView();
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
};
|
|
583
|
+
parent.push(self);
|
|
584
|
+
self.setActive(true);
|
|
573
585
|
},
|
|
574
586
|
render: function render() {
|
|
575
587
|
/** @type {any} */
|
|
@@ -594,36 +606,35 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
594
606
|
}
|
|
595
607
|
}
|
|
596
608
|
if (V && viewChanged) {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
self.setActive(false);
|
|
600
|
-
self.prevView = self.currentView;
|
|
601
|
-
self.currentElement = undefined;
|
|
602
|
-
app_app.emit('pageleave', prevElement, {
|
|
603
|
-
pathname: self.currentPath
|
|
604
|
-
}, true);
|
|
605
|
-
animateOut(prevElement, 'show').then(function () {
|
|
606
|
-
self.prevView = undefined;
|
|
607
|
-
self.forceUpdate();
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
(self.cancelPrevious || noop)();
|
|
609
|
+
(self.unmountView || noop)(true);
|
|
610
|
+
var state = new ViewContext(V, app_app.page, self.context);
|
|
611
611
|
var onComponentLoaded;
|
|
612
612
|
var promise = new Promise(function (resolve) {
|
|
613
613
|
onComponentLoaded = resolve;
|
|
614
614
|
});
|
|
615
|
+
var unmountView = onComponentLoaded;
|
|
615
616
|
var initElement = executeOnce(function (element) {
|
|
616
|
-
self.currentElement = element;
|
|
617
617
|
state.container = element;
|
|
618
618
|
promise.then(function () {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
619
|
+
if (self.currentState === state) {
|
|
620
|
+
unmountView = function unmountView() {
|
|
621
|
+
self.prevView = self.currentView;
|
|
622
|
+
app_app.emit('pageleave', element, {
|
|
623
|
+
pathname: state.page.path
|
|
624
|
+
}, true);
|
|
625
|
+
animateOut(element, 'show').then(function () {
|
|
626
|
+
self.prevView = undefined;
|
|
627
|
+
self.forceUpdate();
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
animateIn(element, 'show', '[brew-view]', true);
|
|
631
|
+
app_app.emit('pageenter', element, {
|
|
632
|
+
pathname: state.page.path
|
|
633
|
+
}, true);
|
|
634
|
+
}
|
|
623
635
|
});
|
|
624
636
|
notifyAsync(element, promise);
|
|
625
637
|
});
|
|
626
|
-
var state = new ViewContext(V, app_app.page);
|
|
627
638
|
var viewProps = freeze({
|
|
628
639
|
navigationType: view_event.navigationType,
|
|
629
640
|
viewContext: state,
|
|
@@ -640,11 +651,16 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
640
651
|
viewProps: viewProps
|
|
641
652
|
}))));
|
|
642
653
|
extend(self, _(state), {
|
|
643
|
-
|
|
644
|
-
currentPath: app_app.path,
|
|
654
|
+
currentState: state,
|
|
645
655
|
currentView: view,
|
|
646
|
-
currentViewComponent: V
|
|
656
|
+
currentViewComponent: V,
|
|
657
|
+
unmountView: executeOnce(function () {
|
|
658
|
+
self.setActive(false);
|
|
659
|
+
routeMap.get(V).rendered--;
|
|
660
|
+
unmountView();
|
|
661
|
+
})
|
|
647
662
|
});
|
|
663
|
+
routeMap.get(V).rendered++;
|
|
648
664
|
(view_event.waitFor || noop)(promise);
|
|
649
665
|
}
|
|
650
666
|
(self.setPage || noop)(app_app.page);
|
|
@@ -711,7 +727,7 @@ function createViewComponent(factory) {
|
|
|
711
727
|
children = null;
|
|
712
728
|
catchAsync(promise);
|
|
713
729
|
}
|
|
714
|
-
var state = (0,
|
|
730
|
+
var state = (0,external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useAsync)(function () {
|
|
715
731
|
return promise.then(function (s) {
|
|
716
732
|
return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(s["default"], viewProps);
|
|
717
733
|
});
|
|
@@ -731,14 +747,16 @@ function useViewContext() {
|
|
|
731
747
|
function isViewMatched(view) {
|
|
732
748
|
return matchViewParams(view, app_app.route);
|
|
733
749
|
}
|
|
734
|
-
function
|
|
750
|
+
function isViewRendered(view) {
|
|
751
|
+
return !!(routeMap.get(view) || '').rendered;
|
|
752
|
+
}
|
|
753
|
+
function matchView() {
|
|
754
|
+
var views = makeArray(arguments);
|
|
735
755
|
var route = app_app.route;
|
|
736
|
-
if (typeof
|
|
737
|
-
route = route.parse(
|
|
738
|
-
} else {
|
|
739
|
-
views = path;
|
|
756
|
+
if (typeof views[0] === 'string') {
|
|
757
|
+
route = route.parse(views.shift());
|
|
740
758
|
}
|
|
741
|
-
views = views ? makeArray(views).sort(sortViews) : sortedViews;
|
|
759
|
+
views = views[0] ? (isArray(views[0]) ? makeArray(views[0]) : views).sort(sortViews) : sortedViews;
|
|
742
760
|
return any(views, function (v) {
|
|
743
761
|
return matchViewParams(v, route);
|
|
744
762
|
}) || undefined;
|
|
@@ -754,6 +772,7 @@ function registerView(factory, routeParams) {
|
|
|
754
772
|
});
|
|
755
773
|
routeMap.set(Component, {
|
|
756
774
|
id: randomId(),
|
|
775
|
+
rendered: 0,
|
|
757
776
|
matchCount: util_keys(routeParams).length,
|
|
758
777
|
matchers: routeParams,
|
|
759
778
|
params: pick(routeParams, function (v) {
|
|
@@ -868,7 +887,7 @@ function useAppReady() {
|
|
|
868
887
|
return useAppReadyState().ready;
|
|
869
888
|
}
|
|
870
889
|
function useAppReadyState() {
|
|
871
|
-
var readyState = (0,
|
|
890
|
+
var readyState = (0,external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useObservableProperty)(app_app, 'readyState');
|
|
872
891
|
return {
|
|
873
892
|
ready: readyState === 'ready',
|
|
874
893
|
error: readyState === 'error'
|
|
@@ -877,34 +896,23 @@ function useAppReadyState() {
|
|
|
877
896
|
function useRouteParam(name, defaultValue) {
|
|
878
897
|
var container = useViewContext();
|
|
879
898
|
var params = container.page.params;
|
|
880
|
-
var route = app_app.route;
|
|
881
899
|
var value = params[name] || '';
|
|
882
900
|
var ref = (0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useRef)(value);
|
|
883
|
-
var forceUpdate = (0,
|
|
901
|
+
var forceUpdate = (0,external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useUpdateTrigger)();
|
|
884
902
|
(0,external_commonjs_react_commonjs2_react_amd_react_root_React_.useEffect)(function () {
|
|
885
903
|
var setValue = function setValue() {
|
|
886
|
-
var current =
|
|
904
|
+
var current = container.page.params[name] || '';
|
|
887
905
|
if (current !== ref.current) {
|
|
888
|
-
|
|
889
|
-
ref.current = current;
|
|
890
|
-
forceUpdate();
|
|
891
|
-
} else {
|
|
892
|
-
watch(container, 'active', setValue);
|
|
893
|
-
}
|
|
906
|
+
forceUpdate();
|
|
894
907
|
}
|
|
895
908
|
};
|
|
896
909
|
// route parameter might be changed after state initialization and before useEffect hook is called
|
|
897
910
|
setValue();
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
setImmediateOnce(setValue);
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
console.error('Route parameter ' + name + ' does not exist');
|
|
904
|
-
}, [name, defaultValue]);
|
|
911
|
+
return container.on('pagechange', setValue);
|
|
912
|
+
}, [name]);
|
|
905
913
|
ref.current = value;
|
|
906
914
|
if (defaultValue && container.active && (!value || name === 'remainingSegments' && value === '/')) {
|
|
907
|
-
app_app.navigate(route.getPath(extend({}, params, kv(name, defaultValue))), true);
|
|
915
|
+
app_app.navigate(app_app.route.getPath(extend({}, params, kv(name, defaultValue))), true);
|
|
908
916
|
}
|
|
909
917
|
return value;
|
|
910
918
|
}
|
|
@@ -944,7 +952,7 @@ function ViewStateContainer(props) {
|
|
|
944
952
|
}
|
|
945
953
|
};
|
|
946
954
|
})[0];
|
|
947
|
-
return /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement)(
|
|
955
|
+
return /*#__PURE__*/(0,external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement)(external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.ViewStateProvider, {
|
|
948
956
|
value: provider
|
|
949
957
|
}, props.children);
|
|
950
958
|
}
|
|
@@ -982,7 +990,7 @@ function createCallback(translate) {
|
|
|
982
990
|
});
|
|
983
991
|
}
|
|
984
992
|
function useLanguage() {
|
|
985
|
-
return (0,
|
|
993
|
+
return (0,external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useObservableProperty)(app_app, 'language');
|
|
986
994
|
}
|
|
987
995
|
function makeTranslation(resources, defaultLang) {
|
|
988
996
|
var re = new RegExp('^(' + Object.keys(resources[defaultLang]).join('|') + ')\\.');
|
|
@@ -1104,7 +1112,7 @@ util_define(Mixin, {
|
|
|
1104
1112
|
});
|
|
1105
1113
|
extend(props, {
|
|
1106
1114
|
ref: combineFn(refs),
|
|
1107
|
-
className:
|
|
1115
|
+
className: external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.classNames.apply(null, args)
|
|
1108
1116
|
});
|
|
1109
1117
|
each(mixins, function (i, v) {
|
|
1110
1118
|
v.next();
|
|
@@ -1299,8 +1307,8 @@ definePrototype(AnimateSequenceItemMixin, ClassNameMixin, {
|
|
|
1299
1307
|
return [this.className].concat(AnimateSequenceItemMixinSuper.getClassNames.call(this));
|
|
1300
1308
|
}
|
|
1301
1309
|
});
|
|
1302
|
-
// EXTERNAL MODULE: external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":"jQuery"}
|
|
1303
|
-
var external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_ = __webpack_require__(
|
|
1310
|
+
// EXTERNAL MODULE: external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":["jQuery"]}
|
|
1311
|
+
var external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_ = __webpack_require__(942);
|
|
1304
1312
|
;// CONCATENATED MODULE: ./src/mixins/AnimateSequenceMixin.js
|
|
1305
1313
|
|
|
1306
1314
|
|
|
@@ -1674,17 +1682,17 @@ function createUseFunction(ctor) {
|
|
|
1674
1682
|
return mixin;
|
|
1675
1683
|
};
|
|
1676
1684
|
}
|
|
1677
|
-
var useAnimateMixin = createUseFunction(AnimateMixin);
|
|
1678
|
-
var useAnimateSequenceMixin = createUseFunction(AnimateSequenceMixin);
|
|
1679
|
-
var useClassNameToggleMixin = createUseFunction(ClassNameToggleMixin);
|
|
1680
|
-
var useFlyoutMixin = createUseFunction(FlyoutMixin);
|
|
1681
|
-
var useFocusStateMixin = createUseFunction(FocusStateMixin);
|
|
1682
|
-
var useLoadingStateMixin = createUseFunction(LoadingStateMixin);
|
|
1683
|
-
var useScrollableMixin = createUseFunction(ScrollableMixin);
|
|
1684
|
-
var useScrollIntoViewMixin = createUseFunction(ScrollIntoViewMixin);
|
|
1685
|
-
var useUnmanagedClassNameMixin = createUseFunction(UnmanagedClassNameMixin);
|
|
1685
|
+
var useAnimateMixin = /*#__PURE__*/createUseFunction(AnimateMixin);
|
|
1686
|
+
var useAnimateSequenceMixin = /*#__PURE__*/createUseFunction(AnimateSequenceMixin);
|
|
1687
|
+
var useClassNameToggleMixin = /*#__PURE__*/createUseFunction(ClassNameToggleMixin);
|
|
1688
|
+
var useFlyoutMixin = /*#__PURE__*/createUseFunction(FlyoutMixin);
|
|
1689
|
+
var useFocusStateMixin = /*#__PURE__*/createUseFunction(FocusStateMixin);
|
|
1690
|
+
var useLoadingStateMixin = /*#__PURE__*/createUseFunction(LoadingStateMixin);
|
|
1691
|
+
var useScrollableMixin = /*#__PURE__*/createUseFunction(ScrollableMixin);
|
|
1692
|
+
var useScrollIntoViewMixin = /*#__PURE__*/createUseFunction(ScrollIntoViewMixin);
|
|
1693
|
+
var useUnmanagedClassNameMixin = /*#__PURE__*/createUseFunction(UnmanagedClassNameMixin);
|
|
1686
1694
|
function useMixin(ctor) {
|
|
1687
|
-
return (0,
|
|
1695
|
+
return (0,external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useSingleton)(function () {
|
|
1688
1696
|
return new ctor();
|
|
1689
1697
|
}).reset();
|
|
1690
1698
|
}
|
|
@@ -1694,7 +1702,7 @@ function useMixinRef(mixin) {
|
|
|
1694
1702
|
|
|
1695
1703
|
;// CONCATENATED MODULE: ./src/index.js
|
|
1696
1704
|
|
|
1697
|
-
/* harmony default export */ const src = (
|
|
1705
|
+
/* harmony default export */ const src = ((/* unused pure expression or super */ null && (brew)));
|
|
1698
1706
|
|
|
1699
1707
|
|
|
1700
1708
|
|
|
@@ -1702,12 +1710,13 @@ function useMixinRef(mixin) {
|
|
|
1702
1710
|
|
|
1703
1711
|
;// CONCATENATED MODULE: ./src/entry.js
|
|
1704
1712
|
|
|
1705
|
-
|
|
1713
|
+
defineGetterProperty(window, 'brew-js-react', function () {
|
|
1714
|
+
console.warn('window["brew-js-react"] is deprecated, access brew.react instead.');
|
|
1715
|
+
return brew.react;
|
|
1716
|
+
});
|
|
1706
1717
|
|
|
1707
|
-
app.react = src_namespaceObject;
|
|
1708
1718
|
})();
|
|
1709
1719
|
|
|
1710
|
-
__webpack_exports__ = __webpack_exports__["default"];
|
|
1711
1720
|
/******/ return __webpack_exports__;
|
|
1712
1721
|
/******/ })()
|
|
1713
1722
|
;
|