Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
var React = require('react');
|
|
var useIsomorphicEffect = require('reakit-utils/useIsomorphicEffect');
|
|
var canUseDOM = require('reakit-utils/canUseDOM');
|
|
var ReactDOM = require('react-dom');
|
|
|
|
function getBodyElement() {
|
|
return canUseDOM.canUseDOM ? document.body : null;
|
|
}
|
|
|
|
var PortalContext = /*#__PURE__*/React.createContext(getBodyElement());
|
|
function Portal(_ref) {
|
|
var children = _ref.children;
|
|
// if it's a nested portal, context is the parent portal
|
|
// otherwise it's document.body
|
|
// https://github.com/reakit/reakit/issues/513
|
|
var context = React.useContext(PortalContext) || getBodyElement();
|
|
|
|
var _React$useState = React.useState(function () {
|
|
if (canUseDOM.canUseDOM) {
|
|
var element = document.createElement("div");
|
|
element.className = Portal.__className;
|
|
return element;
|
|
} // ssr
|
|
|
|
|
|
return null;
|
|
}),
|
|
hostNode = _React$useState[0];
|
|
|
|
useIsomorphicEffect.useIsomorphicEffect(function () {
|
|
if (!hostNode || !context) return undefined;
|
|
context.appendChild(hostNode);
|
|
return function () {
|
|
context.removeChild(hostNode);
|
|
};
|
|
}, [hostNode, context]);
|
|
|
|
if (hostNode) {
|
|
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(PortalContext.Provider, {
|
|
value: hostNode
|
|
}, children), hostNode);
|
|
} // ssr
|
|
|
|
|
|
return null;
|
|
}
|
|
Portal.__className = "__reakit-portal";
|
|
Portal.__selector = "." + Portal.__className;
|
|
|
|
exports.Portal = Portal;
|
|
exports.PortalContext = PortalContext;
|