fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

129
node_modules/@wordpress/primitives/build/svg/index.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Stop = exports.SVG = exports.Rect = exports.RadialGradient = exports.Polygon = exports.Path = exports.LinearGradient = exports.Line = exports.G = exports.Defs = exports.Circle = void 0;
var _clsx = _interopRequireDefault(require("clsx"));
var _element = require("@wordpress/element");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */
/**
* @param {import('react').ComponentPropsWithoutRef<'circle'>} props
*
* @return {JSX.Element} Circle component
*/
const Circle = props => (0, _element.createElement)('circle', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'g'>} props
*
* @return {JSX.Element} G component
*/
exports.Circle = Circle;
const G = props => (0, _element.createElement)('g', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'line'>} props
*
* @return {JSX.Element} Path component
*/
exports.G = G;
const Line = props => (0, _element.createElement)('line', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'path'>} props
*
* @return {JSX.Element} Path component
*/
exports.Line = Line;
const Path = props => (0, _element.createElement)('path', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'polygon'>} props
*
* @return {JSX.Element} Polygon component
*/
exports.Path = Path;
const Polygon = props => (0, _element.createElement)('polygon', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'rect'>} props
*
* @return {JSX.Element} Rect component
*/
exports.Polygon = Polygon;
const Rect = props => (0, _element.createElement)('rect', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'defs'>} props
*
* @return {JSX.Element} Defs component
*/
exports.Rect = Rect;
const Defs = props => (0, _element.createElement)('defs', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props
*
* @return {JSX.Element} RadialGradient component
*/
exports.Defs = Defs;
const RadialGradient = props => (0, _element.createElement)('radialGradient', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props
*
* @return {JSX.Element} LinearGradient component
*/
exports.RadialGradient = RadialGradient;
const LinearGradient = props => (0, _element.createElement)('linearGradient', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'stop'>} props
*
* @return {JSX.Element} Stop component
*/
exports.LinearGradient = LinearGradient;
const Stop = props => (0, _element.createElement)('stop', props);
exports.Stop = Stop;
const SVG = exports.SVG = (0, _element.forwardRef)(
/**
* @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
* Other props will be passed through to svg component.
* @param {import('react').ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Stop component
*/
({
className,
isPressed,
...props
}, ref) => {
const appliedProps = {
...props,
className: (0, _clsx.default)(className, {
'is-pressed': isPressed
}) || undefined,
'aria-hidden': true,
focusable: false
};
// Disable reason: We need to have a way to render HTML tag for web.
// eslint-disable-next-line react/forbid-elements
return (0, _element.createElement)("svg", {
...appliedProps,
ref: ref
});
});
SVG.displayName = 'SVG';
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,127 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Circle", {
enumerable: true,
get: function () {
return _reactNativeSvg.Circle;
}
});
Object.defineProperty(exports, "Defs", {
enumerable: true,
get: function () {
return _reactNativeSvg.Defs;
}
});
Object.defineProperty(exports, "G", {
enumerable: true,
get: function () {
return _reactNativeSvg.G;
}
});
Object.defineProperty(exports, "Line", {
enumerable: true,
get: function () {
return _reactNativeSvg.Line;
}
});
Object.defineProperty(exports, "LinearGradient", {
enumerable: true,
get: function () {
return _reactNativeSvg.LinearGradient;
}
});
Object.defineProperty(exports, "Path", {
enumerable: true,
get: function () {
return _reactNativeSvg.Path;
}
});
Object.defineProperty(exports, "Polygon", {
enumerable: true,
get: function () {
return _reactNativeSvg.Polygon;
}
});
Object.defineProperty(exports, "RadialGradient", {
enumerable: true,
get: function () {
return _reactNativeSvg.RadialGradient;
}
});
Object.defineProperty(exports, "Rect", {
enumerable: true,
get: function () {
return _reactNativeSvg.Rect;
}
});
exports.SVG = void 0;
Object.defineProperty(exports, "Stop", {
enumerable: true,
get: function () {
return _reactNativeSvg.Stop;
}
});
Object.defineProperty(exports, "SvgXml", {
enumerable: true,
get: function () {
return _reactNativeSvg.SvgXml;
}
});
var _react = require("react");
var _reactNativeSvg = require("react-native-svg");
var _reactNative = require("react-native");
var _element = require("@wordpress/element");
var _compose = require("@wordpress/compose");
var _style = _interopRequireDefault(require("./style.scss"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AnimatedSvg = _reactNative.Animated.createAnimatedComponent((0, _element.forwardRef)((props, ref) => (0, _react.createElement)(_reactNativeSvg.Svg, {
ref: ref,
...props
})));
const SVG = ({
className = '',
isPressed,
animated = false,
...props
}) => {
const colorScheme = (0, _compose.usePreferredColorScheme)();
const stylesFromClasses = className.split(' ').map(element => _style.default[element]).filter(Boolean);
const defaultStyle = isPressed ? _style.default[`is-pressed--${colorScheme}`] : _style.default['components-toolbar__control-' + colorScheme];
const propStyle = Array.isArray(props.style) ? props.style.reduce((acc, el) => {
return {
...acc,
...el
};
}, {}) : props.style;
const styleValues = Object.assign({}, defaultStyle, propStyle, ...stylesFromClasses);
const appliedProps = {
...props,
style: styleValues
};
const SvgWrapper = animated ? AnimatedSvg : _reactNativeSvg.Svg;
return (0, _react.createElement)(SvgWrapper
// We want to re-render when style color is changed.
, {
key: appliedProps.style.color,
height: "100%",
width: "100%",
...appliedProps
});
};
exports.SVG = SVG;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNativeSvg","require","_reactNative","_element","_compose","_style","_interopRequireDefault","AnimatedSvg","Animated","createAnimatedComponent","forwardRef","props","ref","_react","createElement","Svg","SVG","className","isPressed","animated","colorScheme","usePreferredColorScheme","stylesFromClasses","split","map","element","styles","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","key","color","height","width","exports"],"sources":["@wordpress/primitives/src/svg/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Svg } from 'react-native-svg';\nimport { Animated } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport {\n\tCircle,\n\tG,\n\tPath,\n\tPolygon,\n\tRect,\n\tDefs,\n\tRadialGradient,\n\tLinearGradient,\n\tStop,\n\tLine,\n\tSvgXml,\n} from 'react-native-svg';\n\nconst AnimatedSvg = Animated.createAnimatedComponent(\n\tforwardRef( ( props, ref ) => <Svg ref={ ref } { ...props } /> )\n);\n\nexport const SVG = ( {\n\tclassName = '',\n\tisPressed,\n\tanimated = false,\n\t...props\n} ) => {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst stylesFromClasses = className\n\t\t.split( ' ' )\n\t\t.map( ( element ) => styles[ element ] )\n\t\t.filter( Boolean );\n\tconst defaultStyle = isPressed\n\t\t? styles[ `is-pressed--${ colorScheme }` ]\n\t\t: styles[ 'components-toolbar__control-' + colorScheme ];\n\tconst propStyle = Array.isArray( props.style )\n\t\t? props.style.reduce( ( acc, el ) => {\n\t\t\t\treturn { ...acc, ...el };\n\t\t }, {} )\n\t\t: props.style;\n\tconst styleValues = Object.assign(\n\t\t{},\n\t\tdefaultStyle,\n\t\tpropStyle,\n\t\t...stylesFromClasses\n\t);\n\n\tconst appliedProps = { ...props, style: styleValues };\n\n\tconst SvgWrapper = animated ? AnimatedSvg : Svg;\n\n\treturn (\n\t\t<SvgWrapper\n\t\t\t// We want to re-render when style color is changed.\n\t\t\tkey={ appliedProps.style.color }\n\t\t\theight=\"100%\"\n\t\t\twidth=\"100%\"\n\t\t\t{ ...appliedProps }\n\t\t/>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAiBA,MAAMM,WAAW,GAAGC,qBAAQ,CAACC,uBAAuB,CACnD,IAAAC,mBAAU,EAAE,CAAEC,KAAK,EAAEC,GAAG,KAAM,IAAAC,MAAA,CAAAC,aAAA,EAACd,eAAA,CAAAe,GAAG;EAACH,GAAG,EAAGA,GAAK;EAAA,GAAMD;AAAK,CAAI,CAAE,CAChE,CAAC;AAEM,MAAMK,GAAG,GAAGA,CAAE;EACpBC,SAAS,GAAG,EAAE;EACdC,SAAS;EACTC,QAAQ,GAAG,KAAK;EAChB,GAAGR;AACJ,CAAC,KAAM;EACN,MAAMS,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAC7C,MAAMC,iBAAiB,GAAGL,SAAS,CACjCM,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAIC,OAAO,IAAMC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