brew-js-react 0.5.6 → 0.5.7
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 +105 -57
- 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/mixins/FlyoutMixin.d.ts +6 -0
- package/mixins/FlyoutMixin.js +4 -1
- package/mixins/FlyoutToggleMixin.d.ts +17 -0
- package/mixins/FlyoutToggleMixin.js +23 -3
- package/mixins/StatefulMixin.js +1 -0
- package/package.json +2 -2
- package/view.d.ts +18 -0
- package/view.js +26 -21
package/dist/brew-js-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! brew-js-react v0.5.
|
|
1
|
+
/*! brew-js-react v0.5.7 | (c) misonou | https://misonou.github.io */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("zeta-dom"), require("react"), require("react-dom"), require("brew-js"), require("zeta-dom-react"), require("waterpipe"), require("jquery"));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
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
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__,
|
|
11
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__231__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__33__, __WEBPACK_EXTERNAL_MODULE__760__, __WEBPACK_EXTERNAL_MODULE__402__, __WEBPACK_EXTERNAL_MODULE__87__, __WEBPACK_EXTERNAL_MODULE__914__) => {
|
|
12
12
|
return /******/ (() => { // webpackBootstrap
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
@@ -28,11 +28,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__760__;
|
|
|
28
28
|
|
|
29
29
|
/***/ }),
|
|
30
30
|
|
|
31
|
-
/***/
|
|
31
|
+
/***/ 914:
|
|
32
32
|
/***/ ((module) => {
|
|
33
33
|
|
|
34
34
|
"use strict";
|
|
35
|
-
module.exports =
|
|
35
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__914__;
|
|
36
36
|
|
|
37
37
|
/***/ }),
|
|
38
38
|
|
|
@@ -44,11 +44,11 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
|
|
44
44
|
|
|
45
45
|
/***/ }),
|
|
46
46
|
|
|
47
|
-
/***/
|
|
47
|
+
/***/ 33:
|
|
48
48
|
/***/ ((module) => {
|
|
49
49
|
|
|
50
50
|
"use strict";
|
|
51
|
-
module.exports =
|
|
51
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__33__;
|
|
52
52
|
|
|
53
53
|
/***/ }),
|
|
54
54
|
|
|
@@ -71,7 +71,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__402__;
|
|
|
71
71
|
/***/ 621:
|
|
72
72
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
73
73
|
|
|
74
|
-
var ReactDOM = __webpack_require__(
|
|
74
|
+
var ReactDOM = __webpack_require__(33);
|
|
75
75
|
var ReactDOMClient;
|
|
76
76
|
|
|
77
77
|
if (ReactDOM.createRoot) {
|
|
@@ -265,10 +265,22 @@ var _lib$util = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_
|
|
|
265
265
|
watch = _lib$util.watch,
|
|
266
266
|
watchable = _lib$util.watchable;
|
|
267
267
|
|
|
268
|
-
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":
|
|
268
|
+
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":"React"}
|
|
269
269
|
var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(12);
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
;// CONCATENATED MODULE: ./|umd|/react.js
|
|
271
|
+
|
|
272
|
+
var Component = external_commonjs_react_commonjs2_react_amd_react_root_React_.Component,
|
|
273
|
+
Fragment = external_commonjs_react_commonjs2_react_amd_react_root_React_.Fragment,
|
|
274
|
+
createContext = external_commonjs_react_commonjs2_react_amd_react_root_React_.createContext,
|
|
275
|
+
createElement = external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement,
|
|
276
|
+
useContext = external_commonjs_react_commonjs2_react_amd_react_root_React_.useContext,
|
|
277
|
+
useEffect = external_commonjs_react_commonjs2_react_amd_react_root_React_.useEffect,
|
|
278
|
+
useMemo = external_commonjs_react_commonjs2_react_amd_react_root_React_.useMemo,
|
|
279
|
+
useRef = external_commonjs_react_commonjs2_react_amd_react_root_React_.useRef,
|
|
280
|
+
useState = external_commonjs_react_commonjs2_react_amd_react_root_React_.useState;
|
|
281
|
+
|
|
282
|
+
// EXTERNAL MODULE: external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":"ReactDOM"}
|
|
283
|
+
var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_ = __webpack_require__(33);
|
|
272
284
|
// EXTERNAL MODULE: ./node_modules/@misonou/react-dom-client/fallback.js
|
|
273
285
|
var fallback = __webpack_require__(621);
|
|
274
286
|
;// CONCATENATED MODULE: ./|umd|/zeta-dom/domUtil.js
|
|
@@ -354,9 +366,9 @@ function createDialog(props) {
|
|
|
354
366
|
return promise.then(_closeDialog);
|
|
355
367
|
}
|
|
356
368
|
});
|
|
357
|
-
var content = /*#__PURE__*/
|
|
369
|
+
var content = /*#__PURE__*/createElement(props.onRender, dialogProps);
|
|
358
370
|
if (props.wrapper) {
|
|
359
|
-
content = /*#__PURE__*/
|
|
371
|
+
content = /*#__PURE__*/createElement(props.wrapper, dialogProps, content);
|
|
360
372
|
}
|
|
361
373
|
reactRoot.render(content);
|
|
362
374
|
}
|
|
@@ -377,12 +389,12 @@ function createDialog(props) {
|
|
|
377
389
|
* @param {import("./dialog").DialogProps} props
|
|
378
390
|
*/
|
|
379
391
|
function Dialog(props) {
|
|
380
|
-
var _props =
|
|
381
|
-
var dialog =
|
|
392
|
+
var _props = useState({})[0];
|
|
393
|
+
var dialog = useState(function () {
|
|
382
394
|
return createDialog(_props);
|
|
383
395
|
})[0];
|
|
384
396
|
extend(_props, props);
|
|
385
|
-
|
|
397
|
+
useEffect(function () {
|
|
386
398
|
var opened = containsOrEquals(zeta_dom_dom.root, dialog.root);
|
|
387
399
|
if (either(opened, _props.isOpen)) {
|
|
388
400
|
if (!opened) {
|
|
@@ -392,13 +404,23 @@ function Dialog(props) {
|
|
|
392
404
|
}
|
|
393
405
|
}
|
|
394
406
|
}, [_props.isOpen]);
|
|
395
|
-
|
|
407
|
+
useEffect(function () {
|
|
396
408
|
return dialog.close;
|
|
397
409
|
}, [dialog]);
|
|
398
410
|
return /*#__PURE__*/external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_.createPortal(props.children, dialog.root);
|
|
399
411
|
}
|
|
400
412
|
// EXTERNAL MODULE: external {"commonjs":"zeta-dom-react","commonjs2":"zeta-dom-react","amd":"zeta-dom-react","root":["zeta","react"]}
|
|
401
413
|
var external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_ = __webpack_require__(402);
|
|
414
|
+
;// CONCATENATED MODULE: ./|umd|/zeta-dom-react.js
|
|
415
|
+
|
|
416
|
+
var ViewStateProvider = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.ViewStateProvider,
|
|
417
|
+
classNames = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.classNames,
|
|
418
|
+
useAsync = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useAsync,
|
|
419
|
+
useMemoizedFunction = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useMemoizedFunction,
|
|
420
|
+
useObservableProperty = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useObservableProperty,
|
|
421
|
+
useSingleton = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useSingleton,
|
|
422
|
+
useUpdateTrigger = external_commonjs_zeta_dom_react_commonjs2_zeta_dom_react_amd_zeta_dom_react_root_zeta_react_.useUpdateTrigger;
|
|
423
|
+
|
|
402
424
|
;// CONCATENATED MODULE: ./|umd|/zeta-dom/events.js
|
|
403
425
|
|
|
404
426
|
var EventContainer = external_commonjs_zeta_dom_commonjs2_zeta_dom_amd_zeta_dom_root_zeta_.EventContainer;
|
|
@@ -465,7 +487,7 @@ var rootContext = freeze(extend(new ViewContext(), {
|
|
|
465
487
|
container: root
|
|
466
488
|
}));
|
|
467
489
|
var rootState = _(rootContext);
|
|
468
|
-
var StateContext = /*#__PURE__*/
|
|
490
|
+
var StateContext = /*#__PURE__*/createContext(rootContext);
|
|
469
491
|
var errorView;
|
|
470
492
|
/** @type {Partial<Zeta.ZetaEventType<"beforepageload", Brew.RouterEventMap, Element>>} */
|
|
471
493
|
var view_event = {};
|
|
@@ -504,7 +526,10 @@ function ViewContext(view, page, parent) {
|
|
|
504
526
|
});
|
|
505
527
|
watch(self, 'page', function (page, previousPage) {
|
|
506
528
|
emitter.emit('pagechange', self, {
|
|
507
|
-
|
|
529
|
+
page: page,
|
|
530
|
+
previousPage: previousPage,
|
|
531
|
+
navigationType: view_event.navigationType,
|
|
532
|
+
waitFor: view_event.waitFor
|
|
508
533
|
});
|
|
509
534
|
});
|
|
510
535
|
}
|
|
@@ -519,11 +544,11 @@ definePrototype(ViewContext, {
|
|
|
519
544
|
}
|
|
520
545
|
});
|
|
521
546
|
function ErrorBoundary() {
|
|
522
|
-
|
|
547
|
+
Component.apply(this, arguments);
|
|
523
548
|
this.state = {};
|
|
524
549
|
}
|
|
525
550
|
ErrorBoundary.contextType = StateContext;
|
|
526
|
-
definePrototype(ErrorBoundary,
|
|
551
|
+
definePrototype(ErrorBoundary, Component, {
|
|
527
552
|
componentDidCatch: function componentDidCatch(error) {
|
|
528
553
|
var self = this;
|
|
529
554
|
if (errorView && !self.state.error) {
|
|
@@ -551,12 +576,12 @@ definePrototype(ErrorBoundary, external_commonjs_react_commonjs2_react_amd_react
|
|
|
551
576
|
};
|
|
552
577
|
var onComponentLoaded = self.props.onComponentLoaded;
|
|
553
578
|
if (props.error) {
|
|
554
|
-
return /*#__PURE__*/
|
|
579
|
+
return /*#__PURE__*/createElement(errorView, {
|
|
555
580
|
onComponentLoaded: onComponentLoaded,
|
|
556
581
|
viewProps: props
|
|
557
582
|
});
|
|
558
583
|
}
|
|
559
|
-
return /*#__PURE__*/
|
|
584
|
+
return /*#__PURE__*/createElement(props.view, {
|
|
560
585
|
onComponentLoaded: onComponentLoaded,
|
|
561
586
|
viewProps: self.props.viewProps
|
|
562
587
|
});
|
|
@@ -568,10 +593,10 @@ definePrototype(ErrorBoundary, external_commonjs_react_commonjs2_react_amd_react
|
|
|
568
593
|
}
|
|
569
594
|
});
|
|
570
595
|
function ViewContainer() {
|
|
571
|
-
|
|
596
|
+
Component.apply(this, arguments);
|
|
572
597
|
}
|
|
573
598
|
ViewContainer.contextType = StateContext;
|
|
574
|
-
definePrototype(ViewContainer,
|
|
599
|
+
definePrototype(ViewContainer, Component, {
|
|
575
600
|
setActive: noop,
|
|
576
601
|
componentDidMount: function componentDidMount() {
|
|
577
602
|
var self = this;
|
|
@@ -599,7 +624,7 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
599
624
|
self.updateView();
|
|
600
625
|
}
|
|
601
626
|
(self.onRender || noop)();
|
|
602
|
-
return /*#__PURE__*/
|
|
627
|
+
return /*#__PURE__*/createElement(Fragment, null, self.prevView, self.currentView);
|
|
603
628
|
},
|
|
604
629
|
updateView: function updateView() {
|
|
605
630
|
var self = this;
|
|
@@ -651,13 +676,13 @@ definePrototype(ViewContainer, external_commonjs_react_commonjs2_react_amd_react
|
|
|
651
676
|
viewContext: state,
|
|
652
677
|
viewData: view_event.data || {}
|
|
653
678
|
});
|
|
654
|
-
var view = /*#__PURE__*/
|
|
679
|
+
var view = /*#__PURE__*/createElement(StateContext.Provider, {
|
|
655
680
|
key: routeMap.get(V).id,
|
|
656
681
|
value: state
|
|
657
|
-
}, /*#__PURE__*/
|
|
682
|
+
}, /*#__PURE__*/createElement(ViewStateContainer, null, /*#__PURE__*/createElement('div', extend({}, self.props.rootProps, {
|
|
658
683
|
ref: initElement,
|
|
659
684
|
'brew-view': ''
|
|
660
|
-
}), /*#__PURE__*/
|
|
685
|
+
}), /*#__PURE__*/createElement(ErrorBoundary, {
|
|
661
686
|
onComponentLoaded: onComponentLoaded,
|
|
662
687
|
viewProps: viewProps
|
|
663
688
|
}))));
|
|
@@ -727,8 +752,8 @@ function matchViewParams(view, route) {
|
|
|
727
752
|
function createViewComponent(factory) {
|
|
728
753
|
var promise;
|
|
729
754
|
throwNotFunction(factory);
|
|
730
|
-
if (factory.prototype instanceof
|
|
731
|
-
factory =
|
|
755
|
+
if (factory.prototype instanceof Component) {
|
|
756
|
+
factory = createElement.bind(null, factory);
|
|
732
757
|
}
|
|
733
758
|
return function fn(props) {
|
|
734
759
|
var viewProps = props.viewProps;
|
|
@@ -738,13 +763,13 @@ function createViewComponent(factory) {
|
|
|
738
763
|
children = null;
|
|
739
764
|
catchAsync(promise);
|
|
740
765
|
}
|
|
741
|
-
var state =
|
|
766
|
+
var state = useAsync(function () {
|
|
742
767
|
return promise.then(function (s) {
|
|
743
|
-
return /*#__PURE__*/
|
|
768
|
+
return /*#__PURE__*/createElement(s["default"], viewProps);
|
|
744
769
|
});
|
|
745
770
|
}, !!promise)[1];
|
|
746
771
|
var loaded = !promise || !state.loading;
|
|
747
|
-
|
|
772
|
+
useEffect(function () {
|
|
748
773
|
if (loaded) {
|
|
749
774
|
setImmediate(props.onComponentLoaded);
|
|
750
775
|
}
|
|
@@ -752,11 +777,11 @@ function createViewComponent(factory) {
|
|
|
752
777
|
if (state.error) {
|
|
753
778
|
throw state.error;
|
|
754
779
|
}
|
|
755
|
-
return children || state.value || /*#__PURE__*/
|
|
780
|
+
return children || state.value || /*#__PURE__*/createElement(Fragment);
|
|
756
781
|
};
|
|
757
782
|
}
|
|
758
783
|
function useViewContext() {
|
|
759
|
-
return
|
|
784
|
+
return useContext(StateContext);
|
|
760
785
|
}
|
|
761
786
|
function isViewMatched(view) {
|
|
762
787
|
return matchViewParams(view, app_app.route);
|
|
@@ -810,7 +835,7 @@ function renderView() {
|
|
|
810
835
|
}
|
|
811
836
|
});
|
|
812
837
|
views.sort(sortViews);
|
|
813
|
-
return /*#__PURE__*/
|
|
838
|
+
return /*#__PURE__*/createElement(ViewContainer, {
|
|
814
839
|
rootProps: rootProps,
|
|
815
840
|
views: views,
|
|
816
841
|
defaultView: defaultView
|
|
@@ -888,7 +913,7 @@ function updateViewState(state, key, store) {
|
|
|
888
913
|
}
|
|
889
914
|
function useViewContextWithEffect(callback, deps) {
|
|
890
915
|
var container = useViewContext();
|
|
891
|
-
|
|
916
|
+
useEffect(function () {
|
|
892
917
|
return app_app.on('beforepageload popstate', function () {
|
|
893
918
|
if (container.active) {
|
|
894
919
|
callback(getCurrentStates());
|
|
@@ -901,7 +926,7 @@ function useAppReady() {
|
|
|
901
926
|
return useAppReadyState().ready;
|
|
902
927
|
}
|
|
903
928
|
function useAppReadyState() {
|
|
904
|
-
var readyState =
|
|
929
|
+
var readyState = useObservableProperty(app_app, 'readyState');
|
|
905
930
|
return {
|
|
906
931
|
ready: readyState === 'ready',
|
|
907
932
|
error: readyState === 'error'
|
|
@@ -911,9 +936,9 @@ function useRouteParam(name, defaultValue) {
|
|
|
911
936
|
var container = useViewContext();
|
|
912
937
|
var params = container.page.params;
|
|
913
938
|
var value = params[name] || '';
|
|
914
|
-
var ref =
|
|
915
|
-
var forceUpdate =
|
|
916
|
-
|
|
939
|
+
var ref = useRef(value);
|
|
940
|
+
var forceUpdate = useUpdateTrigger();
|
|
941
|
+
useEffect(function () {
|
|
917
942
|
var setValue = function setValue() {
|
|
918
943
|
var current = container.page.params[name] || '';
|
|
919
944
|
if (current !== ref.current) {
|
|
@@ -932,7 +957,7 @@ function useRouteParam(name, defaultValue) {
|
|
|
932
957
|
}
|
|
933
958
|
function useRouteState(key, defaultValue, snapshotOnUpdate) {
|
|
934
959
|
var cur = getCurrentStates();
|
|
935
|
-
var state =
|
|
960
|
+
var state = useState(cur && cur.has(key) ? cur.get(key) : defaultValue);
|
|
936
961
|
var container = useViewContextWithEffect(function (cur) {
|
|
937
962
|
state[1](function (oldValue) {
|
|
938
963
|
return cur.has(key) ? cur.get(key) : (cur.set(key, oldValue), oldValue);
|
|
@@ -958,8 +983,8 @@ function useQueryParam(key, value, snapshotOnUpdate) {
|
|
|
958
983
|
return getQueryParam(i, app_app.path) || v || '';
|
|
959
984
|
});
|
|
960
985
|
};
|
|
961
|
-
var state =
|
|
962
|
-
|
|
986
|
+
var state = useState([]);
|
|
987
|
+
useMemo(function () {
|
|
963
988
|
state[0].splice(0, 2, getParams());
|
|
964
989
|
}, [key]);
|
|
965
990
|
var current = state[0][0];
|
|
@@ -969,7 +994,7 @@ function useQueryParam(key, value, snapshotOnUpdate) {
|
|
|
969
994
|
state[1]([current]);
|
|
970
995
|
}
|
|
971
996
|
};
|
|
972
|
-
var setParams =
|
|
997
|
+
var setParams = useMemoizedFunction(function (values) {
|
|
973
998
|
if (key !== false) {
|
|
974
999
|
values = kv(key, isFunction(values) ? values(current[key]) : values);
|
|
975
1000
|
} else if (isFunction(values)) {
|
|
@@ -989,7 +1014,7 @@ function useQueryParam(key, value, snapshotOnUpdate) {
|
|
|
989
1014
|
}
|
|
990
1015
|
}
|
|
991
1016
|
});
|
|
992
|
-
|
|
1017
|
+
useEffect(function () {
|
|
993
1018
|
return app_app.watch('path', function () {
|
|
994
1019
|
if (container.active) {
|
|
995
1020
|
trackChanges(getParams());
|
|
@@ -999,13 +1024,13 @@ function useQueryParam(key, value, snapshotOnUpdate) {
|
|
|
999
1024
|
return [key !== false ? current[key] : state[0][1] || (state[0][1] = freeze(extend({}, current))), setParams];
|
|
1000
1025
|
}
|
|
1001
1026
|
function ViewStateContainer(props) {
|
|
1002
|
-
var cache =
|
|
1027
|
+
var cache = useState({})[0];
|
|
1003
1028
|
var container = useViewContextWithEffect(function (cur) {
|
|
1004
1029
|
each(cache, function (i, v) {
|
|
1005
1030
|
updateViewState(v, v.key, cur);
|
|
1006
1031
|
});
|
|
1007
1032
|
}, []);
|
|
1008
|
-
var provider =
|
|
1033
|
+
var provider = useState(function () {
|
|
1009
1034
|
return {
|
|
1010
1035
|
getState: function getState(uniqueId, key) {
|
|
1011
1036
|
var state = cache[uniqueId];
|
|
@@ -1018,7 +1043,7 @@ function ViewStateContainer(props) {
|
|
|
1018
1043
|
}
|
|
1019
1044
|
};
|
|
1020
1045
|
})[0];
|
|
1021
|
-
return /*#__PURE__*/
|
|
1046
|
+
return /*#__PURE__*/createElement(ViewStateProvider, {
|
|
1022
1047
|
value: provider
|
|
1023
1048
|
}, props.children);
|
|
1024
1049
|
}
|
|
@@ -1056,7 +1081,7 @@ function createCallback(translate) {
|
|
|
1056
1081
|
});
|
|
1057
1082
|
}
|
|
1058
1083
|
function useLanguage() {
|
|
1059
|
-
return
|
|
1084
|
+
return useObservableProperty(app_app, 'language');
|
|
1060
1085
|
}
|
|
1061
1086
|
function makeTranslation(resources, defaultLang) {
|
|
1062
1087
|
var re = new RegExp('^(' + Object.keys(resources[defaultLang]).join('|') + ')\\.');
|
|
@@ -1178,7 +1203,7 @@ util_define(Mixin, {
|
|
|
1178
1203
|
});
|
|
1179
1204
|
extend(props, {
|
|
1180
1205
|
ref: combineFn(refs),
|
|
1181
|
-
className:
|
|
1206
|
+
className: classNames.apply(null, args)
|
|
1182
1207
|
});
|
|
1183
1208
|
each(mixins, function (i, v) {
|
|
1184
1209
|
v.next();
|
|
@@ -1207,6 +1232,7 @@ definePrototype(MixinRefImpl, {
|
|
|
1207
1232
|
function StatefulMixin() {
|
|
1208
1233
|
Mixin.call(this);
|
|
1209
1234
|
StatefulMixin_(this, {
|
|
1235
|
+
pending: {},
|
|
1210
1236
|
elements: new Set(),
|
|
1211
1237
|
states: new WeakMap(),
|
|
1212
1238
|
flush: watch(this, false),
|
|
@@ -1373,8 +1399,8 @@ definePrototype(AnimateSequenceItemMixin, ClassNameMixin, {
|
|
|
1373
1399
|
return [this.className].concat(AnimateSequenceItemMixinSuper.getClassNames.call(this));
|
|
1374
1400
|
}
|
|
1375
1401
|
});
|
|
1376
|
-
// EXTERNAL MODULE: external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":
|
|
1377
|
-
var external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_ = __webpack_require__(
|
|
1402
|
+
// EXTERNAL MODULE: external {"commonjs":"jquery","commonjs2":"jquery","amd":"jquery","root":"jQuery"}
|
|
1403
|
+
var external_commonjs_jquery_commonjs2_jquery_amd_jquery_root_jQuery_ = __webpack_require__(914);
|
|
1378
1404
|
;// CONCATENATED MODULE: ./src/mixins/AnimateSequenceMixin.js
|
|
1379
1405
|
|
|
1380
1406
|
|
|
@@ -1438,24 +1464,43 @@ definePrototype(ClassNameToggleMixin, StatefulMixin, {
|
|
|
1438
1464
|
|
|
1439
1465
|
|
|
1440
1466
|
|
|
1441
|
-
|
|
1442
1467
|
var FlyoutToggleMixinSuper = ClassNameMixin.prototype;
|
|
1443
1468
|
function FlyoutToggleMixin(mixin) {
|
|
1444
1469
|
ClassNameMixin.call(this, ['target-opened']);
|
|
1445
1470
|
this.flyoutMixin = mixin;
|
|
1446
1471
|
}
|
|
1472
|
+
function triggerFlyoutAction(self, state, trigger, action, args) {
|
|
1473
|
+
if ((state.trigger || 'click') === trigger) {
|
|
1474
|
+
action.apply(self, args);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1447
1477
|
definePrototype(FlyoutToggleMixin, ClassNameMixin, {
|
|
1478
|
+
on: function on(trigger) {
|
|
1479
|
+
this.state.trigger = trigger;
|
|
1480
|
+
return this;
|
|
1481
|
+
},
|
|
1448
1482
|
open: function open(value, source) {
|
|
1449
1483
|
return this.flyoutMixin.open(value, source);
|
|
1450
1484
|
},
|
|
1451
1485
|
close: function close(value) {
|
|
1452
1486
|
return this.flyoutMixin.close(value);
|
|
1453
1487
|
},
|
|
1488
|
+
toggle: function toggle(source) {
|
|
1489
|
+
return this.flyoutMixin.toggleSelf(source);
|
|
1490
|
+
},
|
|
1454
1491
|
initElement: function initElement(element, state) {
|
|
1455
1492
|
var self = this;
|
|
1456
1493
|
FlyoutToggleMixinSuper.initElement.call(self, element, state);
|
|
1457
|
-
self.onDispose(zeta_dom_dom.on(element,
|
|
1458
|
-
|
|
1494
|
+
self.onDispose(zeta_dom_dom.on(element, {
|
|
1495
|
+
focusin: function focusin() {
|
|
1496
|
+
triggerFlyoutAction(self, state, 'focus', self.open, [null, zeta_dom_dom.activeElement]);
|
|
1497
|
+
},
|
|
1498
|
+
focusout: function focusout() {
|
|
1499
|
+
triggerFlyoutAction(self, state, 'focus', self.close, []);
|
|
1500
|
+
},
|
|
1501
|
+
click: function click() {
|
|
1502
|
+
triggerFlyoutAction(self, state, 'click', self.toggle, [element]);
|
|
1503
|
+
}
|
|
1459
1504
|
}));
|
|
1460
1505
|
}
|
|
1461
1506
|
});
|
|
@@ -1521,6 +1566,9 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
|
|
|
1521
1566
|
close: function close(value) {
|
|
1522
1567
|
return closeFlyout(this.elements()[0], value);
|
|
1523
1568
|
},
|
|
1569
|
+
toggleSelf: function toggleSelf(source) {
|
|
1570
|
+
return toggleFlyout(this.elements()[0], source, this.getOptions());
|
|
1571
|
+
},
|
|
1524
1572
|
onOpen: function onOpen(callback) {
|
|
1525
1573
|
var element = this.elements()[0];
|
|
1526
1574
|
return this.onToggleState(function (opened) {
|
|
@@ -1756,7 +1804,7 @@ var useScrollableMixin = /*#__PURE__*/createUseFunction(ScrollableMixin);
|
|
|
1756
1804
|
var useScrollIntoViewMixin = /*#__PURE__*/createUseFunction(ScrollIntoViewMixin);
|
|
1757
1805
|
var useUnmanagedClassNameMixin = /*#__PURE__*/createUseFunction(UnmanagedClassNameMixin);
|
|
1758
1806
|
function useMixin(ctor) {
|
|
1759
|
-
return
|
|
1807
|
+
return useSingleton(function () {
|
|
1760
1808
|
return new ctor();
|
|
1761
1809
|
}).reset();
|
|
1762
1810
|
}
|