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

27
node_modules/@wordpress/icons/src/icon/index.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* WordPress dependencies
*/
import { cloneElement, forwardRef } from '@wordpress/element';
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
/**
* Return an SVG icon.
*
* @param {IconProps} props icon is the SVG component to render
* size is a number specifiying the icon size in pixels
* Other props will be passed to wrapped SVG component
* @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Icon component
*/
function Icon( { icon, size = 24, ...props }, ref ) {
return cloneElement( icon, {
width: size,
height: size,
...props,
ref,
} );
}
export default forwardRef( Icon );

View File

@@ -0,0 +1,94 @@
/**
* WordPress dependencies
*/
import { useState, Fragment } from '@wordpress/element';
/**
* Internal dependencies
*/
import Icon from '../';
import check from '../../library/check';
import * as icons from '../../';
const { Icon: _Icon, ...availableIcons } = icons;
const meta = {
component: Icon,
title: 'Icons/Icon',
parameters: {
controls: { hideNoControlsWarning: true },
},
};
export default meta;
export const Default = () => {
return (
<>
<div>
<h2>Dashicons (corrected viewport)</h2>
<Icon icon={ check } />
<Icon icon={ check } size={ 36 } />
<Icon icon={ check } size={ 48 } />
</div>
<div>
<h2>Material and Other</h2>
<Icon icon={ icons.paragraph } />
<Icon icon={ icons.paragraph } size={ 36 } />
<Icon icon={ icons.paragraph } size={ 48 } />
</div>
</>
);
};
const LibraryExample = () => {
const [ filter, setFilter ] = useState( '' );
const filteredIcons = filter.length
? Object.fromEntries(
Object.entries( availableIcons ).filter( ( [ name ] ) =>
name.includes( filter )
)
)
: availableIcons;
return (
<div style={ { padding: 20 } }>
<label htmlFor="filter-icon" style={ { paddingRight: 10 } }>
Filter Icons
</label>
<input
// eslint-disable-next-line no-restricted-syntax
id="filter-icons"
type="search"
value={ filter }
placeholder="Icon name"
onChange={ ( event ) => setFilter( event.target.value ) }
/>
<div style={ { marginTop: 20 } }>
<div
style={ {
display: 'inline-grid',
alignItems: 'center',
gap: 4,
gridTemplateColumns: 'auto 24px 36px 48px',
} }
>
{ Object.entries( filteredIcons ).map(
( [ name, icon ] ) => {
return (
<Fragment key={ name }>
<strong>{ name }</strong>
<Icon icon={ icon } />
<Icon icon={ icon } size={ 36 } />
<Icon icon={ icon } size={ 48 } />
</Fragment>
);
}
) }
</div>
</div>
</div>
);
};
export const Library = () => <LibraryExample />;