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,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.VStack = void 0;
var _react = require("react");
var _context = require("../context");
var _view = require("../view");
var _hook = require("./hook");
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function UnconnectedVStack(props, forwardedRef) {
const vStackProps = (0, _hook.useVStack)(props);
return (0, _react.createElement)(_view.View, {
...vStackProps,
ref: forwardedRef
});
}
/**
* `VStack` (or Vertical Stack) is a layout component that arranges child
* elements in a vertical line.
*
* `VStack` can render anything inside.
*
* ```jsx
* import {
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <VStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </VStack>
* );
* }
* ```
*/
const VStack = (0, _context.contextConnect)(UnconnectedVStack, 'VStack');
exports.VStack = VStack;
var _default = VStack;
exports.default = _default;
//# sourceMappingURL=component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_context","require","_view","_hook","UnconnectedVStack","props","forwardedRef","vStackProps","useVStack","_react","createElement","View","ref","VStack","contextConnect","exports","_default","default"],"sources":["@wordpress/components/src/v-stack/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 { useVStack } from './hook';\nimport type { VStackProps } from './types';\n\nfunction UnconnectedVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst vStackProps = useVStack( props );\n\n\treturn <View { ...vStackProps } ref={ forwardedRef } />;\n}\n\n/**\n * `VStack` (or Vertical Stack) is a layout component that arranges child\n * elements in a vertical line.\n *\n * `VStack` can render anything inside.\n *\n * ```jsx\n * import {\n * \t__experimentalText as Text,\n * \t__experimentalVStack as VStack,\n * } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<VStack>\n * \t\t\t<Text>Code</Text>\n * \t\t\t<Text>is</Text>\n * \t\t\t<Text>Poetry</Text>\n * \t\t</VStack>\n * \t);\n * }\n * ```\n */\nexport const VStack = contextConnect( UnconnectedVStack, 'VStack' );\n\nexport default VStack;\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;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"}

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useVStack = useVStack;
var _context = require("../context");
var _hStack = require("../h-stack");
/**
* Internal dependencies
*/
function useVStack(props) {
const {
expanded = false,
alignment = 'stretch',
...otherProps
} = (0, _context.useContextSystem)(props, 'VStack');
const hStackProps = (0, _hStack.useHStack)({
direction: 'column',
expanded,
alignment,
...otherProps
});
return hStackProps;
}
//# sourceMappingURL=hook.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_context","require","_hStack","useVStack","props","expanded","alignment","otherProps","useContextSystem","hStackProps","useHStack","direction"],"sources":["@wordpress/components/src/v-stack/hook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport { useHStack } from '../h-stack';\nimport type { VStackProps } from './types';\n\nexport function useVStack(\n\tprops: WordPressComponentProps< VStackProps, 'div' >\n) {\n\tconst {\n\t\texpanded = false,\n\t\talignment = 'stretch',\n\t\t...otherProps\n\t} = useContextSystem( props, 'VStack' );\n\n\tconst hStackProps = useHStack( {\n\t\tdirection: 'column',\n\t\texpanded,\n\t\talignment,\n\t\t...otherProps,\n\t} );\n\n\treturn hStackProps;\n}\n"],"mappings":";;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAMO,SAASE,SAASA,CACxBC,KAAoD,EACnD;EACD,MAAM;IACLC,QAAQ,GAAG,KAAK;IAChBC,SAAS,GAAG,SAAS;IACrB,GAAGC;EACJ,CAAC,GAAG,IAAAC,yBAAgB,EAAEJ,KAAK,EAAE,QAAS,CAAC;EAEvC,MAAMK,WAAW,GAAG,IAAAC,iBAAS,EAAE;IAC9BC,SAAS,EAAE,QAAQ;IACnBN,QAAQ;IACRC,SAAS;IACT,GAAGC;EACJ,CAAE,CAAC;EAEH,OAAOE,WAAW;AACnB"}

View File

@@ -0,0 +1,21 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "VStack", {
enumerable: true,
get: function () {
return _component.default;
}
});
Object.defineProperty(exports, "useVStack", {
enumerable: true,
get: function () {
return _hook.useVStack;
}
});
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/v-stack/index.ts"],"sourcesContent":["export { default as VStack } from './component';\nexport { useVStack } from './hook';\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/v-stack/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { HStackAlignment, Props as HStackProps } from '../h-stack/types';\n\nexport type VStackProps = Omit< HStackProps, 'alignment' | 'spacing' > & {\n\t/**\n\t * Determines how the child elements are aligned.\n\t *\n\t * - `top`: Aligns content to the top.\n\t * - `topLeft`: Aligns content to the top/left.\n\t * - `topRight`: Aligns content to the top/right.\n\t * - `left`: Aligns content to the left.\n\t * - `center`: Aligns content to the center.\n\t * - `right`: Aligns content to the right.\n\t * - `bottom`: Aligns content to the bottom.\n\t * - `bottomLeft`: Aligns content to the bottom/left.\n\t * - `bottomRight`: Aligns content to the bottom/right.\n\t * - `edge`: Justifies content to be evenly spread out up to the main axis edges of the container.\n\t * - `stretch`: Stretches content to the cross axis edges of the container.\n\t *\n\t * @default 'stretch'\n\t */\n\talignment?: HStackAlignment | CSSProperties[ 'alignItems' ];\n\t/**\n\t * The amount of space between each child element. Spacing in between each\n\t * child can be adjusted by using `spacing`. The value of `spacing` works as\n\t * a multiplier to the library's grid system (base of `4px`).\n\t */\n\tspacing?: CSSProperties[ 'width' ];\n};\n"],"mappings":""}