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,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlockQuotation = void 0;
const BlockQuotation = exports.BlockQuotation = 'blockquote';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["BlockQuotation","exports"],"sources":["@wordpress/primitives/src/block-quotation/index.js"],"sourcesContent":["export const BlockQuotation = 'blockquote';\n"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,YAAY","ignoreList":[]}

View File

@@ -0,0 +1,66 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BlockQuotation = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _element = require("@wordpress/element");
var _compose = require("@wordpress/compose");
var _style = _interopRequireDefault(require("./style.scss"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const BlockQuotation = exports.BlockQuotation = (0, _element.forwardRef)(({
...props
}, ref) => {
const {
style
} = props;
const blockQuoteStyle = [(0, _compose.usePreferredColorSchemeStyle)(_style.default.wpBlockQuoteLight, _style.default.wpBlockQuoteDark), style?.baseColors?.color?.text && {
borderLeftColor: style.baseColors.color.text
}, style?.color && {
borderLeftColor: style.color
}, style, style?.backgroundColor && _style.default.paddingWithBackground];
const colorStyle = style?.color ? {
color: style.color
} : {};
const newChildren = _element.Children.map(props.children, child => {
const {
identifier,
attributeKey
} = child?.props || {};
const identifierKey = identifier !== null && identifier !== void 0 ? identifier : attributeKey;
if (identifierKey === 'citation') {
return (0, _element.cloneElement)(child, {
style: {
..._style.default.wpBlockQuoteCitation,
...colorStyle
}
});
}
if (child && child.props.identifier === 'value') {
return (0, _element.cloneElement)(child, {
tagsToEliminate: ['div'],
style: colorStyle
});
}
return child;
});
return (0, _react.createElement)(_reactNative.View, {
ref: ref,
style: blockQuoteStyle
}, newChildren);
});
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_element","_compose","_style","_interopRequireDefault","BlockQuotation","exports","forwardRef","props","ref","style","blockQuoteStyle","usePreferredColorSchemeStyle","styles","wpBlockQuoteLight","wpBlockQuoteDark","baseColors","color","text","borderLeftColor","backgroundColor","paddingWithBackground","colorStyle","newChildren","Children","map","children","child","identifier","attributeKey","identifierKey","cloneElement","wpBlockQuoteCitation","tagsToEliminate","_react","createElement","View"],"sources":["@wordpress/primitives/src/block-quotation/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, forwardRef } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport const BlockQuotation = forwardRef( ( { ...props }, ref ) => {\n\tconst { style } = props;\n\n\tconst blockQuoteStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.wpBlockQuoteLight,\n\t\t\tstyles.wpBlockQuoteDark\n\t\t),\n\t\tstyle?.baseColors?.color?.text && {\n\t\t\tborderLeftColor: style.baseColors.color.text,\n\t\t},\n\t\tstyle?.color && {\n\t\t\tborderLeftColor: style.color,\n\t\t},\n\t\tstyle,\n\t\tstyle?.backgroundColor && styles.paddingWithBackground,\n\t];\n\tconst colorStyle = style?.color ? { color: style.color } : {};\n\n\tconst newChildren = Children.map( props.children, ( child ) => {\n\t\tconst { identifier, attributeKey } = child?.props || {};\n\t\tconst identifierKey = identifier ?? attributeKey;\n\n\t\tif ( identifierKey === 'citation' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\tstyle: {\n\t\t\t\t\t...styles.wpBlockQuoteCitation,\n\t\t\t\t\t...colorStyle,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tif ( child && child.props.identifier === 'value' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\ttagsToEliminate: [ 'div' ],\n\t\t\t\tstyle: colorStyle,\n\t\t\t} );\n\t\t}\n\t\treturn child;\n\t} );\n\treturn (\n\t\t<View ref={ ref } style={ blockQuoteStyle }>\n\t\t\t{ newChildren }\n\t\t</View>\n\t);\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMK,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,mBAAU,EAAE,CAAE;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAM;EAClE,MAAM;IAAEC;EAAM,CAAC,GAAGF,KAAK;EAEvB,MAAMG,eAAe,GAAG,CACvB,IAAAC,qCAA4B,EAC3BC,cAAM,CAACC,iBAAiB,EACxBD,cAAM,CAACE,gBACR,CAAC,EACDL,KAAK,EAAEM,UAAU,EAAEC,KAAK,EAAEC,IAAI,IAAI;IACjCC,eAAe,EAAET,KAAK,CAACM,UAAU,CAACC,KAAK,CAACC;EACzC,CAAC,EACDR,KAAK,EAAEO,KAAK,IAAI;IACfE,eAAe,EAAET,KAAK,CAACO;EACxB,CAAC,EACDP,KAAK,EACLA,KAAK,EAAEU,eAAe,IAAIP,cAAM,CAACQ,qBAAqB,CACtD;EACD,MAAMC,UAAU,GAAGZ,KAAK,EAAEO,KAAK,GAAG;IAAEA,KAAK,EAAEP,KAAK,CAACO;EAAM,CAAC,GAAG,CAAC,CAAC;EAE7D,MAAMM,WAAW,GAAGC,iBAAQ,CAACC,GAAG,CAAEjB,KAAK,CAACkB,QAAQ,EAAIC,KAAK,IAAM;IAC9D,MAAM;MAAEC,UAAU;MAAEC;IAAa,CAAC,GAAGF,KAAK,EAAEnB,KAAK,IAAI,CAAC,CAAC;IACvD,MAAMsB,aAAa,GAAGF,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAIC,YAAY;IAEhD,IAAKC,aAAa,KAAK,UAAU,EAAG;MACnC,OAAO,IAAAC,qBAAY,EAAEJ,KAAK,EAAE;QAC3BjB,KAAK,EAAE;UACN,GAAGG,cAAM,CAACmB,oBAAoB;UAC9B,GAAGV;QACJ;MACD,CAAE,CAAC;IACJ;IACA,IAAKK,KAAK,IAAIA,KAAK,CAACnB,KAAK,CAACoB,UAAU,KAAK,OAAO,EAAG;MAClD,OAAO,IAAAG,qBAAY,EAAEJ,KAAK,EAAE;QAC3BM,eAAe,EAAE,CAAE,KAAK,CAAE;QAC1BvB,KAAK,EAAEY;MACR,CAAE,CAAC;IACJ;IACA,OAAOK,KAAK;EACb,CAAE,CAAC;EACH,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACpC,YAAA,CAAAqC,IAAI;IAAC3B,GAAG,EAAGA,GAAK;IAACC,KAAK,EAAGC;EAAiB,GACxCY,WACG,CAAC;AAET,CAAE,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HorizontalRule = void 0;
const HorizontalRule = exports.HorizontalRule = 'hr';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["HorizontalRule","exports"],"sources":["@wordpress/primitives/src/horizontal-rule/index.js"],"sourcesContent":["export const HorizontalRule = 'hr';\n"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAI","ignoreList":[]}

View File

@@ -0,0 +1,59 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.HorizontalRule = void 0;
var _react = require("react");
var _reactNative = require("react-native");
var _compose = require("@wordpress/compose");
var _styles = _interopRequireDefault(require("./styles.scss"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const HR = ({
getStylesFromColorScheme,
lineStyle,
marginLeft,
marginRight,
style,
textStyle,
text,
...props
}) => {
const renderLine = key => (0, _react.createElement)(_reactNative.View, {
key: key,
style: [getStylesFromColorScheme(_styles.default.line, _styles.default.lineDark), lineStyle]
});
const renderText = key => (0, _react.createElement)(_reactNative.View, {
key: key,
style: _styles.default.textContainer
}, (0, _react.createElement)(_reactNative.Text, {
style: [_styles.default.text, textStyle]
}, text));
const renderInner = () => {
if (!text) {
return renderLine();
}
return [renderLine(1), renderText(2), renderLine(3)];
};
return (0, _react.createElement)(_reactNative.View, {
style: [_styles.default.container, {
marginLeft,
marginRight
}, style],
...props
}, renderInner());
};
const HorizontalRule = exports.HorizontalRule = (0, _compose.withPreferredColorScheme)(HR);
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require","_compose","_styles","_interopRequireDefault","HR","getStylesFromColorScheme","lineStyle","marginLeft","marginRight","style","textStyle","text","props","renderLine","key","_react","createElement","View","styles","line","lineDark","renderText","textContainer","Text","renderInner","container","HorizontalRule","exports","withPreferredColorScheme"],"sources":["@wordpress/primitives/src/horizontal-rule/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Text, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst HR = ( {\n\tgetStylesFromColorScheme,\n\tlineStyle,\n\tmarginLeft,\n\tmarginRight,\n\tstyle,\n\ttextStyle,\n\ttext,\n\t...props\n} ) => {\n\tconst renderLine = ( key ) => (\n\t\t<View\n\t\t\tkey={ key }\n\t\t\tstyle={ [\n\t\t\t\tgetStylesFromColorScheme( styles.line, styles.lineDark ),\n\t\t\t\tlineStyle,\n\t\t\t] }\n\t\t/>\n\t);\n\n\tconst renderText = ( key ) => (\n\t\t<View key={ key } style={ styles.textContainer }>\n\t\t\t<Text style={ [ styles.text, textStyle ] }>{ text }</Text>\n\t\t</View>\n\t);\n\n\tconst renderInner = () => {\n\t\tif ( ! text ) {\n\t\t\treturn renderLine();\n\t\t}\n\t\treturn [ renderLine( 1 ), renderText( 2 ), renderLine( 3 ) ];\n\t};\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ [ styles.container, { marginLeft, marginRight }, style ] }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ renderInner() }\n\t\t</View>\n\t);\n};\n\nexport const HorizontalRule = withPreferredColorScheme( HR );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMI,EAAE,GAAGA,CAAE;EACZC,wBAAwB;EACxBC,SAAS;EACTC,UAAU;EACVC,WAAW;EACXC,KAAK;EACLC,SAAS;EACTC,IAAI;EACJ,GAAGC;AACJ,CAAC,KAAM;EACN,MAAMC,UAAU,GAAKC,GAAG,IACvB,IAAAC,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAkB,IAAI;IACJH,GAAG,EAAGA,GAAK;IACXL,KAAK,EAAG,CACPJ,wBAAwB,CAAEa,eAAM,CAACC,IAAI,EAAED,eAAM,CAACE,QAAS,CAAC,EACxDd,SAAS;EACP,CACH,CACD;EAED,MAAMe,UAAU,GAAKP,GAAG,IACvB,IAAAC,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAkB,IAAI;IAACH,GAAG,EAAGA,GAAK;IAACL,KAAK,EAAGS,eAAM,CAACI;EAAe,GAC/C,IAAAP,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAwB,IAAI;IAACd,KAAK,EAAG,CAAES,eAAM,CAACP,IAAI,EAAED,SAAS;EAAI,GAAGC,IAAY,CACpD,CACN;EAED,MAAMa,WAAW,GAAGA,CAAA,KAAM;IACzB,IAAK,CAAEb,IAAI,EAAG;MACb,OAAOE,UAAU,CAAC,CAAC;IACpB;IACA,OAAO,CAAEA,UAAU,CAAE,CAAE,CAAC,EAAEQ,UAAU,CAAE,CAAE,CAAC,EAAER,UAAU,CAAE,CAAE,CAAC,CAAE;EAC7D,CAAC;EAED,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACjB,YAAA,CAAAkB,IAAI;IACJR,KAAK,EAAG,CAAES,eAAM,CAACO,SAAS,EAAE;MAAElB,UAAU;MAAEC;IAAY,CAAC,EAAEC,KAAK,CAAI;IAAA,GAC7DG;EAAK,GAERY,WAAW,CAAC,CACT,CAAC;AAET,CAAC;AAEM,MAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAAE,iCAAwB,EAAExB,EAAG,CAAC","ignoreList":[]}

50
node_modules/@wordpress/primitives/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _svg = require("./svg");
Object.keys(_svg).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _svg[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _svg[key];
}
});
});
var _horizontalRule = require("./horizontal-rule");
Object.keys(_horizontalRule).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _horizontalRule[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _horizontalRule[key];
}
});
});
var _blockQuotation = require("./block-quotation");
Object.keys(_blockQuotation).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _blockQuotation[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _blockQuotation[key];
}
});
});
var _view = require("./view");
Object.keys(_view).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _view[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _view[key];
}
});
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_svg","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_horizontalRule","_blockQuotation","_view"],"sources":["@wordpress/primitives/src/index.js"],"sourcesContent":["export * from './svg';\nexport * from './horizontal-rule';\nexport * from './block-quotation';\nexport * from './view';\n"],"mappings":";;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,eAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,eAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,eAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,eAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,eAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,eAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,eAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,eAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,KAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,KAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,KAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,KAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}

129
node_modules/@wordpress/primitives/build/svg/index.js generated vendored Normal file
View File

@@ -0,0 +1,129 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Stop = exports.SVG = exports.Rect = exports.RadialGradient = exports.Polygon = exports.Path = exports.LinearGradient = exports.Line = exports.G = exports.Defs = exports.Circle = void 0;
var _clsx = _interopRequireDefault(require("clsx"));
var _element = require("@wordpress/element");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */
/**
* @param {import('react').ComponentPropsWithoutRef<'circle'>} props
*
* @return {JSX.Element} Circle component
*/
const Circle = props => (0, _element.createElement)('circle', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'g'>} props
*
* @return {JSX.Element} G component
*/
exports.Circle = Circle;
const G = props => (0, _element.createElement)('g', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'line'>} props
*
* @return {JSX.Element} Path component
*/
exports.G = G;
const Line = props => (0, _element.createElement)('line', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'path'>} props
*
* @return {JSX.Element} Path component
*/
exports.Line = Line;
const Path = props => (0, _element.createElement)('path', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'polygon'>} props
*
* @return {JSX.Element} Polygon component
*/
exports.Path = Path;
const Polygon = props => (0, _element.createElement)('polygon', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'rect'>} props
*
* @return {JSX.Element} Rect component
*/
exports.Polygon = Polygon;
const Rect = props => (0, _element.createElement)('rect', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'defs'>} props
*
* @return {JSX.Element} Defs component
*/
exports.Rect = Rect;
const Defs = props => (0, _element.createElement)('defs', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props
*
* @return {JSX.Element} RadialGradient component
*/
exports.Defs = Defs;
const RadialGradient = props => (0, _element.createElement)('radialGradient', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props
*
* @return {JSX.Element} LinearGradient component
*/
exports.RadialGradient = RadialGradient;
const LinearGradient = props => (0, _element.createElement)('linearGradient', props);
/**
* @param {import('react').ComponentPropsWithoutRef<'stop'>} props
*
* @return {JSX.Element} Stop component
*/
exports.LinearGradient = LinearGradient;
const Stop = props => (0, _element.createElement)('stop', props);
exports.Stop = Stop;
const SVG = exports.SVG = (0, _element.forwardRef)(
/**
* @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
* Other props will be passed through to svg component.
* @param {import('react').ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
*
* @return {JSX.Element} Stop component
*/
({
className,
isPressed,
...props
}, ref) => {
const appliedProps = {
...props,
className: (0, _clsx.default)(className, {
'is-pressed': isPressed
}) || undefined,
'aria-hidden': true,
focusable: false
};
// Disable reason: We need to have a way to render HTML tag for web.
// eslint-disable-next-line react/forbid-elements
return (0, _element.createElement)("svg", {
...appliedProps,
ref: ref
});
});
SVG.displayName = 'SVG';
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,127 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Circle", {
enumerable: true,
get: function () {
return _reactNativeSvg.Circle;
}
});
Object.defineProperty(exports, "Defs", {
enumerable: true,
get: function () {
return _reactNativeSvg.Defs;
}
});
Object.defineProperty(exports, "G", {
enumerable: true,
get: function () {
return _reactNativeSvg.G;
}
});
Object.defineProperty(exports, "Line", {
enumerable: true,
get: function () {
return _reactNativeSvg.Line;
}
});
Object.defineProperty(exports, "LinearGradient", {
enumerable: true,
get: function () {
return _reactNativeSvg.LinearGradient;
}
});
Object.defineProperty(exports, "Path", {
enumerable: true,
get: function () {
return _reactNativeSvg.Path;
}
});
Object.defineProperty(exports, "Polygon", {
enumerable: true,
get: function () {
return _reactNativeSvg.Polygon;
}
});
Object.defineProperty(exports, "RadialGradient", {
enumerable: true,
get: function () {
return _reactNativeSvg.RadialGradient;
}
});
Object.defineProperty(exports, "Rect", {
enumerable: true,
get: function () {
return _reactNativeSvg.Rect;
}
});
exports.SVG = void 0;
Object.defineProperty(exports, "Stop", {
enumerable: true,
get: function () {
return _reactNativeSvg.Stop;
}
});
Object.defineProperty(exports, "SvgXml", {
enumerable: true,
get: function () {
return _reactNativeSvg.SvgXml;
}
});
var _react = require("react");
var _reactNativeSvg = require("react-native-svg");
var _reactNative = require("react-native");
var _element = require("@wordpress/element");
var _compose = require("@wordpress/compose");
var _style = _interopRequireDefault(require("./style.scss"));
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const AnimatedSvg = _reactNative.Animated.createAnimatedComponent((0, _element.forwardRef)((props, ref) => (0, _react.createElement)(_reactNativeSvg.Svg, {
ref: ref,
...props
})));
const SVG = ({
className = '',
isPressed,
animated = false,
...props
}) => {
const colorScheme = (0, _compose.usePreferredColorScheme)();
const stylesFromClasses = className.split(' ').map(element => _style.default[element]).filter(Boolean);
const defaultStyle = isPressed ? _style.default[`is-pressed--${colorScheme}`] : _style.default['components-toolbar__control-' + colorScheme];
const propStyle = Array.isArray(props.style) ? props.style.reduce((acc, el) => {
return {
...acc,
...el
};
}, {}) : props.style;
const styleValues = Object.assign({}, defaultStyle, propStyle, ...stylesFromClasses);
const appliedProps = {
...props,
style: styleValues
};
const SvgWrapper = animated ? AnimatedSvg : _reactNativeSvg.Svg;
return (0, _react.createElement)(SvgWrapper
// We want to re-render when style color is changed.
, {
key: appliedProps.style.color,
height: "100%",
width: "100%",
...appliedProps
});
};
exports.SVG = SVG;
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNativeSvg","require","_reactNative","_element","_compose","_style","_interopRequireDefault","AnimatedSvg","Animated","createAnimatedComponent","forwardRef","props","ref","_react","createElement","Svg","SVG","className","isPressed","animated","colorScheme","usePreferredColorScheme","stylesFromClasses","split","map","element","styles","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","key","color","height","width","exports"],"sources":["@wordpress/primitives/src/svg/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Svg } from 'react-native-svg';\nimport { Animated } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport {\n\tCircle,\n\tG,\n\tPath,\n\tPolygon,\n\tRect,\n\tDefs,\n\tRadialGradient,\n\tLinearGradient,\n\tStop,\n\tLine,\n\tSvgXml,\n} from 'react-native-svg';\n\nconst AnimatedSvg = Animated.createAnimatedComponent(\n\tforwardRef( ( props, ref ) => <Svg ref={ ref } { ...props } /> )\n);\n\nexport const SVG = ( {\n\tclassName = '',\n\tisPressed,\n\tanimated = false,\n\t...props\n} ) => {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst stylesFromClasses = className\n\t\t.split( ' ' )\n\t\t.map( ( element ) => styles[ element ] )\n\t\t.filter( Boolean );\n\tconst defaultStyle = isPressed\n\t\t? styles[ `is-pressed--${ colorScheme }` ]\n\t\t: styles[ 'components-toolbar__control-' + colorScheme ];\n\tconst propStyle = Array.isArray( props.style )\n\t\t? props.style.reduce( ( acc, el ) => {\n\t\t\t\treturn { ...acc, ...el };\n\t\t }, {} )\n\t\t: props.style;\n\tconst styleValues = Object.assign(\n\t\t{},\n\t\tdefaultStyle,\n\t\tpropStyle,\n\t\t...stylesFromClasses\n\t);\n\n\tconst appliedProps = { ...props, style: styleValues };\n\n\tconst SvgWrapper = animated ? AnimatedSvg : Svg;\n\n\treturn (\n\t\t<SvgWrapper\n\t\t\t// We want to re-render when style color is changed.\n\t\t\tkey={ appliedProps.style.color }\n\t\t\theight=\"100%\"\n\t\t\twidth=\"100%\"\n\t\t\t{ ...appliedProps }\n\t\t/>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAiBA,MAAMM,WAAW,GAAGC,qBAAQ,CAACC,uBAAuB,CACnD,IAAAC,mBAAU,EAAE,CAAEC,KAAK,EAAEC,GAAG,KAAM,IAAAC,MAAA,CAAAC,aAAA,EAACd,eAAA,CAAAe,GAAG;EAACH,GAAG,EAAGA,GAAK;EAAA,GAAMD;AAAK,CAAI,CAAE,CAChE,CAAC;AAEM,MAAMK,GAAG,GAAGA,CAAE;EACpBC,SAAS,GAAG,EAAE;EACdC,SAAS;EACTC,QAAQ,GAAG,KAAK;EAChB,GAAGR;AACJ,CAAC,KAAM;EACN,MAAMS,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAC7C,MAAMC,iBAAiB,GAAGL,SAAS,CACjCM,KAAK,CAAE,GAAI,CAAC,CACZC,GAAG,CAAIC,OAAO,IAAMC,cAAM,CAAED,OAAO,CAAG,CAAC,CACvCE,MAAM,CAAEC,OAAQ,CAAC;EACnB,MAAMC,YAAY,GAAGX,SAAS,GAC3BQ,cAAM,CAAG,eAAeN,WAAa,EAAC,CAAE,GACxCM,cAAM,CAAE,8BAA8B,GAAGN,WAAW,CAAE;EACzD,MAAMU,SAAS,GAAGC,KAAK,CAACC,OAAO,CAAErB,KAAK,CAACsB,KAAM,CAAC,GAC3CtB,KAAK,CAACsB,KAAK,CAACC,MAAM,CAAE,CAAEC,GAAG,EAAEC,EAAE,KAAM;IACnC,OAAO;MAAE,GAAGD,GAAG;MAAE,GAAGC;IAAG,CAAC;EACxB,CAAC,EAAE,CAAC,CAAE,CAAC,GACPzB,KAAK,CAACsB,KAAK;EACd,MAAMI,WAAW,GAAGC,MAAM,CAACC,MAAM,CAChC,CAAC,CAAC,EACFV,YAAY,EACZC,SAAS,EACT,GAAGR,iBACJ,CAAC;EAED,MAAMkB,YAAY,GAAG;IAAE,GAAG7B,KAAK;IAAEsB,KAAK,EAAEI;EAAY,CAAC;EAErD,MAAMI,UAAU,GAAGtB,QAAQ,GAAGZ,WAAW,GAAGQ,mBAAG;EAE/C,OACC,IAAAF,MAAA,CAAAC,aAAA,EAAC2B;EACA;EAAA;IACAC,GAAG,EAAGF,YAAY,CAACP,KAAK,CAACU,KAAO;IAChCC,MAAM,EAAC,MAAM;IACbC,KAAK,EAAC,MAAM;IAAA,GACPL;EAAY,CACjB,CAAC;AAEJ,CAAC;AAACM,OAAA,CAAA9B,GAAA,GAAAA,GAAA","ignoreList":[]}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.View = void 0;
const View = exports.View = 'div';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["View","exports"],"sources":["@wordpress/primitives/src/view/index.js"],"sourcesContent":["export const View = 'div';\n"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG,KAAK","ignoreList":[]}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "View", {
enumerable: true,
get: function () {
return _reactNative.View;
}
});
var _reactNative = require("react-native");
//# sourceMappingURL=index.native.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_reactNative","require"],"sources":["@wordpress/primitives/src/view/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nexport { View } from 'react-native';\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA","ignoreList":[]}