brew-js-react 0.6.0 → 0.6.1
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/dialog.js +3 -3
- package/dist/brew-js-react.js +31 -25
- 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/mixin.d.ts +1 -1
- package/mixins/FlyoutMixin.d.ts +15 -6
- package/mixins/FlyoutMixin.js +17 -5
- package/mixins/FlyoutToggleMixin.d.ts +12 -5
- package/mixins/FlyoutToggleMixin.js +2 -2
- package/package.json +1 -1
- package/view.js +10 -17
package/dialog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement, useEffect, useState } from "react";
|
|
1
|
+
import { createElement, StrictMode, useEffect, useState } from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
3
|
import ReactDOMClient from "@misonou/react-dom-client";
|
|
4
4
|
import { either, extend, noop, pick, resolve } from "zeta-dom/util";
|
|
@@ -41,7 +41,6 @@ export function createDialog(props) {
|
|
|
41
41
|
}
|
|
42
42
|
root.className = props.className || '';
|
|
43
43
|
document.body.appendChild(root);
|
|
44
|
-
dom.retainFocus(dom.activeElement, root);
|
|
45
44
|
if (props.modal) {
|
|
46
45
|
root.setAttribute('is-modal', '');
|
|
47
46
|
}
|
|
@@ -55,9 +54,10 @@ export function createDialog(props) {
|
|
|
55
54
|
if (props.wrapper) {
|
|
56
55
|
content = createElement(props.wrapper, dialogProps, content);
|
|
57
56
|
}
|
|
58
|
-
reactRoot.render(content);
|
|
57
|
+
reactRoot.render(createElement(StrictMode, null, content));
|
|
59
58
|
}
|
|
60
59
|
promise = resolve().then(function () {
|
|
60
|
+
dom.retainFocus(dom.activeElement, root);
|
|
61
61
|
return openFlyout(root, null, pick(props, ['focus']));
|
|
62
62
|
});
|
|
63
63
|
if (props.preventLeave) {
|
package/dist/brew-js-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! brew-js-react v0.6.
|
|
1
|
+
/*! brew-js-react v0.6.1 | (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"));
|
|
@@ -270,6 +270,7 @@ var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_re
|
|
|
270
270
|
|
|
271
271
|
var Component = external_commonjs_react_commonjs2_react_amd_react_root_React_.Component,
|
|
272
272
|
Fragment = external_commonjs_react_commonjs2_react_amd_react_root_React_.Fragment,
|
|
273
|
+
StrictMode = external_commonjs_react_commonjs2_react_amd_react_root_React_.StrictMode,
|
|
273
274
|
createContext = external_commonjs_react_commonjs2_react_amd_react_root_React_.createContext,
|
|
274
275
|
createElement = external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement,
|
|
275
276
|
useContext = external_commonjs_react_commonjs2_react_amd_react_root_React_.useContext,
|
|
@@ -311,6 +312,7 @@ var external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_ = __webpa
|
|
|
311
312
|
;// CONCATENATED MODULE: ./|umd|/brew-js/domAction.js
|
|
312
313
|
|
|
313
314
|
var closeFlyout = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.closeFlyout,
|
|
315
|
+
isFlyoutOpen = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.isFlyoutOpen,
|
|
314
316
|
openFlyout = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.openFlyout,
|
|
315
317
|
toggleFlyout = external_commonjs_brew_js_commonjs2_brew_js_amd_brew_js_root_brew_.toggleFlyout;
|
|
316
318
|
|
|
@@ -356,7 +358,6 @@ function createDialog(props) {
|
|
|
356
358
|
}
|
|
357
359
|
root.className = props.className || '';
|
|
358
360
|
document.body.appendChild(root);
|
|
359
|
-
zeta_dom_dom.retainFocus(zeta_dom_dom.activeElement, root);
|
|
360
361
|
if (props.modal) {
|
|
361
362
|
root.setAttribute('is-modal', '');
|
|
362
363
|
}
|
|
@@ -370,9 +371,10 @@ function createDialog(props) {
|
|
|
370
371
|
if (props.wrapper) {
|
|
371
372
|
content = /*#__PURE__*/createElement(props.wrapper, dialogProps, content);
|
|
372
373
|
}
|
|
373
|
-
reactRoot.render(content);
|
|
374
|
+
reactRoot.render( /*#__PURE__*/createElement(StrictMode, null, content));
|
|
374
375
|
}
|
|
375
376
|
promise = resolve().then(function () {
|
|
377
|
+
zeta_dom_dom.retainFocus(zeta_dom_dom.activeElement, root);
|
|
376
378
|
return openFlyout(root, null, pick(props, ['focus']));
|
|
377
379
|
});
|
|
378
380
|
if (props.preventLeave) {
|
|
@@ -496,23 +498,16 @@ onAppInit(function () {
|
|
|
496
498
|
rootState.setPage(app_app.page);
|
|
497
499
|
rootState.setActive(true);
|
|
498
500
|
view_event = e;
|
|
499
|
-
|
|
500
|
-
(function
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
})).then(function () {
|
|
510
|
-
updateViewRecursive(map(next, function (v) {
|
|
511
|
-
return v.children;
|
|
512
|
-
}));
|
|
513
|
-
});
|
|
514
|
-
})(rootState.children);
|
|
515
|
-
}));
|
|
501
|
+
(function updateViewRecursive(next) {
|
|
502
|
+
each(next.children, function (i, v) {
|
|
503
|
+
e.waitFor(new Promise(function (resolve) {
|
|
504
|
+
v.onRender = resolve;
|
|
505
|
+
v.forceUpdate();
|
|
506
|
+
}).then(function () {
|
|
507
|
+
updateViewRecursive(v);
|
|
508
|
+
}));
|
|
509
|
+
});
|
|
510
|
+
})(rootState);
|
|
516
511
|
});
|
|
517
512
|
});
|
|
518
513
|
function ViewContext(view, page, parent) {
|
|
@@ -1499,8 +1494,8 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
|
|
|
1499
1494
|
close: function close(value) {
|
|
1500
1495
|
return this.flyoutMixin.close(value);
|
|
1501
1496
|
},
|
|
1502
|
-
toggle: function toggle(source) {
|
|
1503
|
-
return this.flyoutMixin.toggleSelf(source);
|
|
1497
|
+
toggle: function toggle(flag, source) {
|
|
1498
|
+
return this.flyoutMixin.toggleSelf(flag, source);
|
|
1504
1499
|
},
|
|
1505
1500
|
initElement: function initElement(element, state) {
|
|
1506
1501
|
var self = this;
|
|
@@ -1526,6 +1521,13 @@ definePrototype(FlyoutToggleMixin, ClassNameMixin, {
|
|
|
1526
1521
|
|
|
1527
1522
|
var FlyoutMixinSuper = ClassNameMixin.prototype;
|
|
1528
1523
|
var valueMap = new WeakMap();
|
|
1524
|
+
function _toggleSelf(self, flag, value, source) {
|
|
1525
|
+
if (!flag && !isFlyoutOpen(self.element)) {
|
|
1526
|
+
return resolve();
|
|
1527
|
+
}
|
|
1528
|
+
var options = self.getOptions();
|
|
1529
|
+
return flag ? openFlyout(self.element, value, source, options) : toggleFlyout(self.element, source, options);
|
|
1530
|
+
}
|
|
1529
1531
|
function FlyoutMixin() {
|
|
1530
1532
|
var self = this;
|
|
1531
1533
|
ClassNameMixin.call(self, ['open', 'closing', 'visible', 'tweening-in', 'tweening-out']);
|
|
@@ -1578,13 +1580,17 @@ definePrototype(FlyoutMixin, ClassNameMixin, {
|
|
|
1578
1580
|
});
|
|
1579
1581
|
},
|
|
1580
1582
|
open: function open(value, source) {
|
|
1581
|
-
return
|
|
1583
|
+
return _toggleSelf(this, true, value, source);
|
|
1582
1584
|
},
|
|
1583
1585
|
close: function close(value) {
|
|
1584
1586
|
return closeFlyout(this.element, value);
|
|
1585
1587
|
},
|
|
1586
|
-
toggleSelf: function toggleSelf(source) {
|
|
1587
|
-
|
|
1588
|
+
toggleSelf: function toggleSelf(flag, source) {
|
|
1589
|
+
if (typeof flag !== 'boolean') {
|
|
1590
|
+
source = flag;
|
|
1591
|
+
flag = !isFlyoutOpen(this.element);
|
|
1592
|
+
}
|
|
1593
|
+
return _toggleSelf(this, flag, undefined, source);
|
|
1588
1594
|
},
|
|
1589
1595
|
onOpen: function onOpen(callback) {
|
|
1590
1596
|
return this.onToggleState(function (opened) {
|