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,38 @@
import { createElement } from "react";
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { forwardRef } from '@wordpress/element';
/**
* Internal dependencies
*/
import * as ProgressBarStyled from './styles';
function UnforwardedProgressBar(props, ref) {
const {
className,
value,
...progressProps
} = props;
const isIndeterminate = !Number.isFinite(value);
return createElement(ProgressBarStyled.Track, {
className: className
}, createElement(ProgressBarStyled.Indicator, {
isIndeterminate: isIndeterminate,
value: value
}), createElement(ProgressBarStyled.ProgressElement, {
max: 100,
value: value,
"aria-label": __('Loading …'),
ref: ref,
...progressProps
}));
}
export const ProgressBar = forwardRef(UnforwardedProgressBar);
export default ProgressBar;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["__","forwardRef","ProgressBarStyled","UnforwardedProgressBar","props","ref","className","value","progressProps","isIndeterminate","Number","isFinite","createElement","Track","Indicator","ProgressElement","max","ProgressBar"],"sources":["@wordpress/components/src/progress-bar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as ProgressBarStyled from './styles';\nimport type { ProgressBarProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nfunction UnforwardedProgressBar(\n\tprops: WordPressComponentProps< ProgressBarProps, 'progress', false >,\n\tref: ForwardedRef< HTMLProgressElement >\n) {\n\tconst { className, value, ...progressProps } = props;\n\tconst isIndeterminate = ! Number.isFinite( value );\n\n\treturn (\n\t\t<ProgressBarStyled.Track className={ className }>\n\t\t\t<ProgressBarStyled.Indicator\n\t\t\t\tisIndeterminate={ isIndeterminate }\n\t\t\t\tvalue={ value }\n\t\t\t/>\n\t\t\t<ProgressBarStyled.ProgressElement\n\t\t\t\tmax={ 100 }\n\t\t\t\tvalue={ value }\n\t\t\t\taria-label={ __( 'Loading …' ) }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...progressProps }\n\t\t\t/>\n\t\t</ProgressBarStyled.Track>\n\t);\n}\n\nexport const ProgressBar = forwardRef( UnforwardedProgressBar );\n\nexport default ProgressBar;\n"],"mappings":";AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAO,KAAKC,iBAAiB,MAAM,UAAU;AAI7C,SAASC,sBAAsBA,CAC9BC,KAAqE,EACrEC,GAAwC,EACvC;EACD,MAAM;IAAEC,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAc,CAAC,GAAGJ,KAAK;EACpD,MAAMK,eAAe,GAAG,CAAEC,MAAM,CAACC,QAAQ,CAAEJ,KAAM,CAAC;EAElD,OACCK,aAAA,CAACV,iBAAiB,CAACW,KAAK;IAACP,SAAS,EAAGA;EAAW,GAC/CM,aAAA,CAACV,iBAAiB,CAACY,SAAS;IAC3BL,eAAe,EAAGA,eAAiB;IACnCF,KAAK,EAAGA;EAAO,CACf,CAAC,EACFK,aAAA,CAACV,iBAAiB,CAACa,eAAe;IACjCC,GAAG,EAAG,GAAK;IACXT,KAAK,EAAGA,KAAO;IACf,cAAaP,EAAE,CAAE,WAAY,CAAG;IAChCK,GAAG,EAAGA,GAAK;IAAA,GACNG;EAAa,CAClB,CACuB,CAAC;AAE5B;AAEA,OAAO,MAAMS,WAAW,GAAGhB,UAAU,CAAEE,sBAAuB,CAAC;AAE/D,eAAec,WAAW"}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":3,"names":["css","keyframes","COLORS","CONFIG","animateProgressBar","left","INDETERMINATE_TRACK_WIDTH","Track","_styled","process","env","NODE_ENV","target","label","borderWidthFocus","gray","radiusBlockUi","Indicator","isIndeterminate","value","animationDuration","animationTimingFunction","animationIterationCount","animationName","width","transition","ProgressElement","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__"],"sources":["@wordpress/components/src/progress-bar/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css, keyframes } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { COLORS, CONFIG } from '../utils';\n\nconst animateProgressBar = keyframes( {\n\t'0%': {\n\t\tleft: '-50%',\n\t},\n\t'100%': {\n\t\tleft: '100%',\n\t},\n} );\n\n// Width of the indicator for the indeterminate progress bar\nexport const INDETERMINATE_TRACK_WIDTH = 50;\n\nexport const Track = styled.div`\n\tposition: relative;\n\toverflow: hidden;\n\twidth: 100%;\n\tmax-width: 160px;\n\theight: ${ CONFIG.borderWidthFocus };\n\t/* Text color at 10% opacity */\n\tbackground-color: color-mix(\n\t\tin srgb,\n\t\tvar( --wp-components-color-foreground, ${ COLORS.gray[ 900 ] } ),\n\t\ttransparent 90%\n\t);\n\tborder-radius: ${ CONFIG.radiusBlockUi };\n\n\t// Windows high contrast mode.\n\toutline: 2px solid transparent;\n\toutline-offset: 2px;\n`;\n\nexport const Indicator = styled.div< {\n\tisIndeterminate: boolean;\n\tvalue?: number;\n} >`\n\tdisplay: inline-block;\n\tposition: absolute;\n\ttop: 0;\n\theight: 100%;\n\tborder-radius: ${ CONFIG.radiusBlockUi };\n\t/* Text color at 90% opacity */\n\tbackground-color: color-mix(\n\t\tin srgb,\n\t\tvar( --wp-components-color-foreground, ${ COLORS.gray[ 900 ] } ),\n\t\ttransparent 10%\n\t);\n\n\t// Windows high contrast mode.\n\toutline: 2px solid transparent;\n\toutline-offset: -2px;\n\n\t${ ( { isIndeterminate, value } ) =>\n\t\tisIndeterminate\n\t\t\t? css( {\n\t\t\t\t\tanimationDuration: '1.5s',\n\t\t\t\t\tanimationTimingFunction: 'ease-in-out',\n\t\t\t\t\tanimationIterationCount: 'infinite',\n\t\t\t\t\tanimationName: animateProgressBar,\n\t\t\t\t\twidth: `${ INDETERMINATE_TRACK_WIDTH }%`,\n\t\t\t } )\n\t\t\t: css( {\n\t\t\t\t\twidth: `${ value }%`,\n\t\t\t\t\ttransition: 'width 0.4s ease-in-out',\n\t\t\t } ) };\n`;\n\nexport const ProgressElement = styled.progress`\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\topacity: 0;\n\twidth: 100%;\n\theight: 100%;\n`;\n"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,GAAG,EAAEC,SAAS,QAAQ,gBAAgB;;AAE/C;AACA;AACA;AACA,SAASC,MAAM,EAAEC,MAAM,QAAQ,UAAU;AAEzC,MAAMC,kBAAkB,GAAGH,SAAS,CAAE;EACrC,IAAI,EAAE;IACLI,IAAI,EAAE;EACP,CAAC;EACD,MAAM,EAAE;IACPA,IAAI,EAAE;EACP;AACD,CAAE,CAAC;;AAEH;AACA,OAAO,MAAMC,yBAAyB,GAAG,EAAE;AAE3C,OAAO,MAAMC,KAAK,GAAAC,OAAA,QAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,2EAKNV,MAAM,CAACW,gBAAgB,6FAISZ,MAAM,CAACa,IAAI,CAAE,GAAG,CAAE,kDAG3CZ,MAAM,CAACa,aAAa,0DAAAP,OAAA,CAAAC,GAAA,CAAAC,QAAA,g9FAKtC;AAED,OAAO,MAAMM,SAAS,GAAAT,OAAA,QAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,8EAQHV,MAAM,CAACa,aAAa,6FAIKd,MAAM,CAACa,IAAI,CAAE,GAAG,CAAE,sFAQ1D,CAAE;EAAEG,eAAe;EAAEC;AAAM,CAAC,KAC9BD,eAAe,gBACZlB,GAAG,CAAE;EACLoB,iBAAiB,EAAE,MAAM;EACzBC,uBAAuB,EAAE,aAAa;EACtCC,uBAAuB,EAAE,UAAU;EACnCC,aAAa,EAAEnB,kBAAkB;EACjCoB,KAAK,EAAG,GAAGlB,yBAA2B;AACtC,CAAC,EAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA,8CAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,88FAAC,CAAC,gBACHX,GAAG,CAAE;EACLwB,KAAK,EAAG,GAAGL,KAAO,GAAE;EACpBM,UAAU,EAAE;AACZ,CAAC,EAAAhB,OAAA,CAAAC,GAAA,CAAAC,QAAA,8CAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,88FAAC,CAAC,SAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,g9FACP;AAED,OAAO,MAAMe,eAAe,GAAAlB,OAAA,aAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAgB,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,EAO3B"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/progress-bar/types.ts"],"sourcesContent":["export type ProgressBarProps = {\n\t/**\n\t * Value of the progress bar.\n\t */\n\tvalue?: number;\n\n\t/**\n\t * A CSS class to apply to the progress bar wrapper (track) element.\n\t */\n\tclassName?: string;\n};\n"],"mappings":""}