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,46 @@
import { createElement } from "react";
/**
* External dependencies
*/
/**
* Internal dependencies
*/
import { contextConnect } from '../context';
import { View } from '../view';
import { useVStack } from './hook';
function UnconnectedVStack(props, forwardedRef) {
const vStackProps = useVStack(props);
return createElement(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>
* );
* }
* ```
*/
export const VStack = contextConnect(UnconnectedVStack, 'VStack');
export default VStack;
//# sourceMappingURL=component.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["contextConnect","View","useVStack","UnconnectedVStack","props","forwardedRef","vStackProps","createElement","ref","VStack"],"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":";AAAA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,SAAS,QAAQ,QAAQ;AAGlC,SAASC,iBAAiBA,CACzBC,KAAoD,EACpDC,YAAiC,EAChC;EACD,MAAMC,WAAW,GAAGJ,SAAS,CAAEE,KAAM,CAAC;EAEtC,OAAOG,aAAA,CAACN,IAAI;IAAA,GAAMK,WAAW;IAAGE,GAAG,EAAGH;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,OAAO,MAAMI,MAAM,GAAGT,cAAc,CAAEG,iBAAiB,EAAE,QAAS,CAAC;AAEnE,eAAeM,MAAM"}

View File

@@ -0,0 +1,21 @@
/**
* Internal dependencies
*/
import { useContextSystem } from '../context';
import { useHStack } from '../h-stack';
export function useVStack(props) {
const {
expanded = false,
alignment = 'stretch',
...otherProps
} = useContextSystem(props, 'VStack');
const hStackProps = useHStack({
direction: 'column',
expanded,
alignment,
...otherProps
});
return hStackProps;
}
//# sourceMappingURL=hook.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["useContextSystem","useHStack","useVStack","props","expanded","alignment","otherProps","hStackProps","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":"AAAA;AACA;AACA;;AAEA,SAASA,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,SAAS,QAAQ,YAAY;AAGtC,OAAO,SAASC,SAASA,CACxBC,KAAoD,EACnD;EACD,MAAM;IACLC,QAAQ,GAAG,KAAK;IAChBC,SAAS,GAAG,SAAS;IACrB,GAAGC;EACJ,CAAC,GAAGN,gBAAgB,CAAEG,KAAK,EAAE,QAAS,CAAC;EAEvC,MAAMI,WAAW,GAAGN,SAAS,CAAE;IAC9BO,SAAS,EAAE,QAAQ;IACnBJ,QAAQ;IACRC,SAAS;IACT,GAAGC;EACJ,CAAE,CAAC;EAEH,OAAOC,WAAW;AACnB"}

View File

@@ -0,0 +1,3 @@
export { default as VStack } from './component';
export { useVStack } from './hook';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["default","VStack","useVStack"],"sources":["@wordpress/components/src/v-stack/index.ts"],"sourcesContent":["export { default as VStack } from './component';\nexport { useVStack } from './hook';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAAM,QAAQ,aAAa;AAC/C,SAASC,SAAS,QAAQ,QAAQ"}

View File

@@ -0,0 +1,2 @@
export {};
//# 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":""}