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

View File

@@ -0,0 +1 @@
{"version":3,"names":["contextConnect","View","useSpacer","UnconnectedSpacer","props","forwardedRef","spacerProps","createElement","ref","Spacer"],"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":";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;AACA,OAAO,MAAMI,MAAM,GAAGT,cAAc,CAAEG,iBAAiB,EAAE,QAAS,CAAC;AAEnE,eAAeM,MAAM"}

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,3 @@
export { default as Spacer } from './component';
export { useSpacer } from './hook';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["default","Spacer","useSpacer"],"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,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/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":""}