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

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.Spacer = void 0;
var _react = require("react");
var _context = require("../context");
var _view = require("../view");
var _hook = require("./hook");
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedSpacer(props, forwardedRef) {
const spacerProps = (0, _hook.useSpacer)(props);
return (0, _react.createElement)(_view.View, {
...spacerProps,
ref: forwardedRef
});
}
/**
* `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.
*
* `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props
* can either be a number (which will act as a multiplier to the library's grid system base of 4px),
* or a literal CSS value string.
*
* ```jsx
* import { Spacer } from `@wordpress/components`
*
* function Example() {
* return (
* <View>
* <Spacer>
* <Heading>WordPress.org</Heading>
* </Spacer>
* <Text>
* Code is Poetry
* </Text>
* </View>
* );
* }
* ```
*/
const Spacer = (0, _context.contextConnect)(UnconnectedSpacer, 'Spacer');
exports.Spacer = Spacer;
var _default = Spacer;
exports.default = _default;
//# sourceMappingURL=component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_context","require","_view","_hook","UnconnectedSpacer","props","forwardedRef","spacerProps","useSpacer","_react","createElement","View","ref","Spacer","contextConnect","exports","_default","default"],"sources":["@wordpress/components/src/spacer/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { contextConnect } from '../context';\nimport { View } from '../view';\nimport { useSpacer } from './hook';\nimport type { SpacerProps } from './types';\n\nfunction UnconnectedSpacer(\n\tprops: WordPressComponentProps< SpacerProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst spacerProps = useSpacer( props );\n\n\treturn <View { ...spacerProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.\n *\n * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props\n * can either be a number (which will act as a multiplier to the library's grid system base of 4px),\n * or a literal CSS value string.\n *\n * ```jsx\n * import { Spacer } from `@wordpress/components`\n *\n * function Example() {\n * return (\n * <View>\n * <Spacer>\n * <Heading>WordPress.org</Heading>\n * </Spacer>\n * <Text>\n * Code is Poetry\n * </Text>\n * </View>\n * );\n * }\n * ```\n */\nexport const Spacer = contextConnect( UnconnectedSpacer, 'Spacer' );\n\nexport default Spacer;\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASG,iBAAiBA,CACzBC,KAAoD,EACpDC,YAAiC,EAChC;EACD,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAEH,KAAM,CAAC;EAEtC,OAAO,IAAAI,MAAA,CAAAC,aAAA,EAACR,KAAA,CAAAS,IAAI;IAAA,GAAMJ,WAAW;IAAGK,GAAG,EAAGN;EAAc,CAAE,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,MAAM,GAAG,IAAAC,uBAAc,EAAEV,iBAAiB,EAAE,QAAS,CAAC;AAACW,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAA,IAAAG,QAAA,GAErDH,MAAM;AAAAE,OAAA,CAAAE,OAAA,GAAAD,QAAA"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,21 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Spacer", {
enumerable: true,
get: function () {
return _component.default;
}
});
Object.defineProperty(exports, "useSpacer", {
enumerable: true,
get: function () {
return _hook.useSpacer;
}
});
var _component = _interopRequireDefault(require("./component"));
var _hook = require("./hook");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_component","_interopRequireDefault","require","_hook"],"sources":["@wordpress/components/src/spacer/index.ts"],"sourcesContent":["export { default as Spacer } from './component';\nexport { useSpacer } from './hook';\nexport type { SpacerProps } from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/spacer/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { SpaceInput } from '../utils/space';\n\nexport type SpacerProps = {\n\t/**\n\t * The children elements.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Adjusts all margins.\n\t */\n\tmargin?: SpaceInput;\n\t/**\n\t * Adjusts bottom margin, potentially overriding the value from the more\n\t * generic `margin` and `marginY` props.\n\t *\n\t * @default 2\n\t */\n\tmarginBottom?: SpaceInput;\n\t/**\n\t * Adjusts left margin, potentially overriding the value from the more\n\t * generic `margin` and `marginX` props.\n\t */\n\tmarginLeft?: SpaceInput;\n\t/**\n\t * Adjusts right margin, potentially overriding the value from the more\n\t * generic `margin` and `marginX` props.\n\t */\n\tmarginRight?: SpaceInput;\n\t/**\n\t * Adjusts top margin, potentially overriding the value from the more\n\t * generic `margin` and `marginY` props.\n\t */\n\tmarginTop?: SpaceInput;\n\t/**\n\t * Adjusts left and right margins, potentially overriding the value from the\n\t * more generic `margin` prop.\n\t */\n\tmarginX?: SpaceInput;\n\t/**\n\t * Adjusts top and bottom margins, potentially overriding the value from the\n\t * more generic `margin` prop.\n\t */\n\tmarginY?: SpaceInput;\n\t/**\n\t * Adjusts all padding.\n\t */\n\tpadding?: SpaceInput;\n\t/**\n\t * Adjusts bottom padding, potentially overriding the value from the more\n\t * generic `padding` and `paddingY` props.\n\t */\n\tpaddingBottom?: SpaceInput;\n\t/**\n\t * Adjusts left padding, potentially overriding the value from the more\n\t * generic `padding` and `paddingX` props.\n\t */\n\tpaddingLeft?: SpaceInput;\n\t/**\n\t * Adjusts right padding, potentially overriding the value from the more\n\t * generic `padding` and `paddingX` props.\n\t */\n\tpaddingRight?: SpaceInput;\n\t/**\n\t * Adjusts top padding, potentially overriding the value from the more\n\t * generic `padding` and `paddingY` props.\n\t */\n\tpaddingTop?: SpaceInput;\n\t/**\n\t * Adjusts left and right padding, potentially overriding the value from the\n\t * more generic `padding` prop.\n\t */\n\tpaddingX?: SpaceInput;\n\t/**\n\t * Adjusts top and bottom padding, potentially overriding the value from the\n\t * more generic `padding` prop.\n\t */\n\tpaddingY?: SpaceInput;\n};\n"],"mappings":""}