Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
var customGradientBarReducerInitialState = {
[34500] Fix | Delete
id: 'IDLE'
[34501] Fix | Delete
};
[34502] Fix | Delete
function CustomGradientBar(_ref) {
[34503] Fix | Delete
var background = _ref.background,
[34504] Fix | Delete
hasGradient = _ref.hasGradient,
[34505] Fix | Delete
controlPoints = _ref.value,
[34506] Fix | Delete
onChange = _ref.onChange;
[34507] Fix | Delete
var gradientPickerDomRef = Object(external_wp_element_["useRef"])();
[34508] Fix | Delete
[34509] Fix | Delete
var _useReducer = Object(external_wp_element_["useReducer"])(customGradientBarReducer, customGradientBarReducerInitialState),
[34510] Fix | Delete
_useReducer2 = Object(slicedToArray["a" /* default */])(_useReducer, 2),
[34511] Fix | Delete
gradientBarState = _useReducer2[0],
[34512] Fix | Delete
gradientBarStateDispatch = _useReducer2[1];
[34513] Fix | Delete
[34514] Fix | Delete
var onMouseEnterAndMove = function onMouseEnterAndMove(event) {
[34515] Fix | Delete
var insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current, INSERT_POINT_WIDTH); // If the insert point is close to an existing control point don't show it.
[34516] Fix | Delete
[34517] Fix | Delete
if (Object(external_lodash_["some"])(controlPoints, function (_ref2) {
[34518] Fix | Delete
var position = _ref2.position;
[34519] Fix | Delete
return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
[34520] Fix | Delete
})) {
[34521] Fix | Delete
if (gradientBarState.id === 'MOVING_INSERTER') {
[34522] Fix | Delete
gradientBarStateDispatch({
[34523] Fix | Delete
type: 'STOP_INSERTER_MOVE'
[34524] Fix | Delete
});
[34525] Fix | Delete
}
[34526] Fix | Delete
[34527] Fix | Delete
return;
[34528] Fix | Delete
}
[34529] Fix | Delete
[34530] Fix | Delete
gradientBarStateDispatch({
[34531] Fix | Delete
type: 'MOVE_INSERTER',
[34532] Fix | Delete
insertPosition: insertPosition
[34533] Fix | Delete
});
[34534] Fix | Delete
};
[34535] Fix | Delete
[34536] Fix | Delete
var onMouseLeave = function onMouseLeave() {
[34537] Fix | Delete
gradientBarStateDispatch({
[34538] Fix | Delete
type: 'STOP_INSERTER_MOVE'
[34539] Fix | Delete
});
[34540] Fix | Delete
};
[34541] Fix | Delete
[34542] Fix | Delete
var isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
[34543] Fix | Delete
var isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
[34544] Fix | Delete
return Object(external_wp_element_["createElement"])("div", {
[34545] Fix | Delete
ref: gradientPickerDomRef,
[34546] Fix | Delete
className: classnames_default()('components-custom-gradient-picker__gradient-bar', {
[34547] Fix | Delete
'has-gradient': hasGradient
[34548] Fix | Delete
}),
[34549] Fix | Delete
onMouseEnter: onMouseEnterAndMove,
[34550] Fix | Delete
onMouseMove: onMouseEnterAndMove,
[34551] Fix | Delete
style: {
[34552] Fix | Delete
background: background
[34553] Fix | Delete
},
[34554] Fix | Delete
onMouseLeave: onMouseLeave
[34555] Fix | Delete
}, Object(external_wp_element_["createElement"])("div", {
[34556] Fix | Delete
className: "components-custom-gradient-picker__markers-container"
[34557] Fix | Delete
}, (isMovingInserter || isInsertingControlPoint) && Object(external_wp_element_["createElement"])(control_points.InsertPoint, {
[34558] Fix | Delete
insertPosition: gradientBarState.insertPosition,
[34559] Fix | Delete
value: controlPoints,
[34560] Fix | Delete
onChange: onChange,
[34561] Fix | Delete
onOpenInserter: function onOpenInserter() {
[34562] Fix | Delete
gradientBarStateDispatch({
[34563] Fix | Delete
type: 'OPEN_INSERTER'
[34564] Fix | Delete
});
[34565] Fix | Delete
},
[34566] Fix | Delete
onCloseInserter: function onCloseInserter() {
[34567] Fix | Delete
gradientBarStateDispatch({
[34568] Fix | Delete
type: 'CLOSE_INSERTER'
[34569] Fix | Delete
});
[34570] Fix | Delete
}
[34571] Fix | Delete
}), Object(external_wp_element_["createElement"])(control_points, {
[34572] Fix | Delete
gradientPickerDomRef: gradientPickerDomRef,
[34573] Fix | Delete
ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
[34574] Fix | Delete
value: controlPoints,
[34575] Fix | Delete
onChange: onChange,
[34576] Fix | Delete
onStartControlPointChange: function onStartControlPointChange() {
[34577] Fix | Delete
gradientBarStateDispatch({
[34578] Fix | Delete
type: 'START_CONTROL_CHANGE'
[34579] Fix | Delete
});
[34580] Fix | Delete
},
[34581] Fix | Delete
onStopControlPointChange: function onStopControlPointChange() {
[34582] Fix | Delete
gradientBarStateDispatch({
[34583] Fix | Delete
type: 'STOP_CONTROL_CHANGE'
[34584] Fix | Delete
});
[34585] Fix | Delete
}
[34586] Fix | Delete
})));
[34587] Fix | Delete
}
[34588] Fix | Delete
[34589] Fix | Delete
// EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js
[34590] Fix | Delete
var build_node = __webpack_require__("Jx1U");
[34591] Fix | Delete
var node_default = /*#__PURE__*/__webpack_require__.n(build_node);
[34592] Fix | Delete
[34593] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js
[34594] Fix | Delete
/**
[34595] Fix | Delete
* WordPress dependencies
[34596] Fix | Delete
*/
[34597] Fix | Delete
[34598] Fix | Delete
var DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';
[34599] Fix | Delete
var DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
[34600] Fix | Delete
var HORIZONTAL_GRADIENT_ORIENTATION = {
[34601] Fix | Delete
type: 'angular',
[34602] Fix | Delete
value: 90
[34603] Fix | Delete
};
[34604] Fix | Delete
var GRADIENT_OPTIONS = [{
[34605] Fix | Delete
value: 'linear-gradient',
[34606] Fix | Delete
label: Object(external_wp_i18n_["__"])('Linear')
[34607] Fix | Delete
}, {
[34608] Fix | Delete
value: 'radial-gradient',
[34609] Fix | Delete
label: Object(external_wp_i18n_["__"])('Radial')
[34610] Fix | Delete
}];
[34611] Fix | Delete
var DIRECTIONAL_ORIENTATION_ANGLE_MAP = {
[34612] Fix | Delete
top: 0,
[34613] Fix | Delete
'top right': 45,
[34614] Fix | Delete
'right top': 45,
[34615] Fix | Delete
right: 90,
[34616] Fix | Delete
'right bottom': 135,
[34617] Fix | Delete
'bottom right': 135,
[34618] Fix | Delete
bottom: 180,
[34619] Fix | Delete
'bottom left': 225,
[34620] Fix | Delete
'left bottom': 225,
[34621] Fix | Delete
left: 270,
[34622] Fix | Delete
'top left': 315,
[34623] Fix | Delete
'left top': 315
[34624] Fix | Delete
};
[34625] Fix | Delete
[34626] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js
[34627] Fix | Delete
[34628] Fix | Delete
[34629] Fix | Delete
/**
[34630] Fix | Delete
* External dependencies
[34631] Fix | Delete
*/
[34632] Fix | Delete
[34633] Fix | Delete
function serializeGradientColor(_ref) {
[34634] Fix | Delete
var type = _ref.type,
[34635] Fix | Delete
value = _ref.value;
[34636] Fix | Delete
[34637] Fix | Delete
if (type === 'literal') {
[34638] Fix | Delete
return value;
[34639] Fix | Delete
}
[34640] Fix | Delete
[34641] Fix | Delete
if (type === 'hex') {
[34642] Fix | Delete
return "#".concat(value);
[34643] Fix | Delete
}
[34644] Fix | Delete
[34645] Fix | Delete
return "".concat(type, "(").concat(value.join(','), ")");
[34646] Fix | Delete
}
[34647] Fix | Delete
function serializeGradientPosition(position) {
[34648] Fix | Delete
if (!position) {
[34649] Fix | Delete
return '';
[34650] Fix | Delete
}
[34651] Fix | Delete
[34652] Fix | Delete
var value = position.value,
[34653] Fix | Delete
type = position.type;
[34654] Fix | Delete
return "".concat(value).concat(type);
[34655] Fix | Delete
}
[34656] Fix | Delete
function serializeGradientColorStop(_ref2) {
[34657] Fix | Delete
var type = _ref2.type,
[34658] Fix | Delete
value = _ref2.value,
[34659] Fix | Delete
length = _ref2.length;
[34660] Fix | Delete
return "".concat(serializeGradientColor({
[34661] Fix | Delete
type: type,
[34662] Fix | Delete
value: value
[34663] Fix | Delete
}), " ").concat(serializeGradientPosition(length));
[34664] Fix | Delete
}
[34665] Fix | Delete
function serializeGradientOrientation(orientation) {
[34666] Fix | Delete
if (!orientation || orientation.type !== 'angular') {
[34667] Fix | Delete
return;
[34668] Fix | Delete
}
[34669] Fix | Delete
[34670] Fix | Delete
return "".concat(orientation.value, "deg");
[34671] Fix | Delete
}
[34672] Fix | Delete
function serializeGradient(_ref3) {
[34673] Fix | Delete
var type = _ref3.type,
[34674] Fix | Delete
orientation = _ref3.orientation,
[34675] Fix | Delete
colorStops = _ref3.colorStops;
[34676] Fix | Delete
var serializedOrientation = serializeGradientOrientation(orientation);
[34677] Fix | Delete
var serializedColorStops = colorStops.sort(function (colorStop1, colorStop2) {
[34678] Fix | Delete
return Object(external_lodash_["get"])(colorStop1, ['length', 'value'], 0) - Object(external_lodash_["get"])(colorStop2, ['length', 'value'], 0);
[34679] Fix | Delete
}).map(serializeGradientColorStop);
[34680] Fix | Delete
return "".concat(type, "(").concat(Object(external_lodash_["compact"])([serializedOrientation].concat(Object(toConsumableArray["a" /* default */])(serializedColorStops))).join(','), ")");
[34681] Fix | Delete
}
[34682] Fix | Delete
[34683] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js
[34684] Fix | Delete
[34685] Fix | Delete
[34686] Fix | Delete
function custom_gradient_picker_utils_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
[34687] Fix | Delete
[34688] Fix | Delete
function custom_gradient_picker_utils_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { custom_gradient_picker_utils_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { custom_gradient_picker_utils_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
[34689] Fix | Delete
[34690] Fix | Delete
/**
[34691] Fix | Delete
* External dependencies
[34692] Fix | Delete
*/
[34693] Fix | Delete
[34694] Fix | Delete
[34695] Fix | Delete
/**
[34696] Fix | Delete
* Internal dependencies
[34697] Fix | Delete
*/
[34698] Fix | Delete
[34699] Fix | Delete
[34700] Fix | Delete
[34701] Fix | Delete
function getLinearGradientRepresentationOfARadial(gradientAST) {
[34702] Fix | Delete
return serializeGradient({
[34703] Fix | Delete
type: 'linear-gradient',
[34704] Fix | Delete
orientation: HORIZONTAL_GRADIENT_ORIENTATION,
[34705] Fix | Delete
colorStops: gradientAST.colorStops
[34706] Fix | Delete
});
[34707] Fix | Delete
}
[34708] Fix | Delete
[34709] Fix | Delete
function hasUnsupportedLength(item) {
[34710] Fix | Delete
return item.length === undefined || item.length.type !== '%';
[34711] Fix | Delete
}
[34712] Fix | Delete
[34713] Fix | Delete
function getGradientAstWithDefault(value) {
[34714] Fix | Delete
var _gradientAST$orientat;
[34715] Fix | Delete
[34716] Fix | Delete
// gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
[34717] Fix | Delete
// More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
[34718] Fix | Delete
var gradientAST;
[34719] Fix | Delete
[34720] Fix | Delete
try {
[34721] Fix | Delete
gradientAST = node_default.a.parse(value)[0];
[34722] Fix | Delete
gradientAST.value = value;
[34723] Fix | Delete
} catch (error) {
[34724] Fix | Delete
gradientAST = node_default.a.parse(DEFAULT_GRADIENT)[0];
[34725] Fix | Delete
gradientAST.value = DEFAULT_GRADIENT;
[34726] Fix | Delete
}
[34727] Fix | Delete
[34728] Fix | Delete
if (((_gradientAST$orientat = gradientAST.orientation) === null || _gradientAST$orientat === void 0 ? void 0 : _gradientAST$orientat.type) === 'directional') {
[34729] Fix | Delete
gradientAST.orientation.type = 'angular';
[34730] Fix | Delete
gradientAST.orientation.value = DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString();
[34731] Fix | Delete
}
[34732] Fix | Delete
[34733] Fix | Delete
if (gradientAST.colorStops.some(hasUnsupportedLength)) {
[34734] Fix | Delete
var _gradientAST = gradientAST,
[34735] Fix | Delete
colorStops = _gradientAST.colorStops;
[34736] Fix | Delete
var step = 100 / (colorStops.length - 1);
[34737] Fix | Delete
colorStops.forEach(function (stop, index) {
[34738] Fix | Delete
stop.length = {
[34739] Fix | Delete
value: step * index,
[34740] Fix | Delete
type: '%'
[34741] Fix | Delete
};
[34742] Fix | Delete
});
[34743] Fix | Delete
gradientAST.value = serializeGradient(gradientAST);
[34744] Fix | Delete
}
[34745] Fix | Delete
[34746] Fix | Delete
return gradientAST;
[34747] Fix | Delete
}
[34748] Fix | Delete
function getGradientAstWithControlPoints(gradientAST, newControlPoints) {
[34749] Fix | Delete
return custom_gradient_picker_utils_objectSpread(custom_gradient_picker_utils_objectSpread({}, gradientAST), {}, {
[34750] Fix | Delete
colorStops: newControlPoints.map(function (_ref) {
[34751] Fix | Delete
var position = _ref.position,
[34752] Fix | Delete
color = _ref.color;
[34753] Fix | Delete
[34754] Fix | Delete
var _tinycolor$toRgb = tinycolor_default()(color).toRgb(),
[34755] Fix | Delete
r = _tinycolor$toRgb.r,
[34756] Fix | Delete
g = _tinycolor$toRgb.g,
[34757] Fix | Delete
b = _tinycolor$toRgb.b,
[34758] Fix | Delete
a = _tinycolor$toRgb.a;
[34759] Fix | Delete
[34760] Fix | Delete
return {
[34761] Fix | Delete
length: {
[34762] Fix | Delete
type: '%',
[34763] Fix | Delete
value: position.toString()
[34764] Fix | Delete
},
[34765] Fix | Delete
type: a < 1 ? 'rgba' : 'rgb',
[34766] Fix | Delete
value: a < 1 ? [r, g, b, a] : [r, g, b]
[34767] Fix | Delete
};
[34768] Fix | Delete
})
[34769] Fix | Delete
});
[34770] Fix | Delete
}
[34771] Fix | Delete
function getStopCssColor(colorStop) {
[34772] Fix | Delete
switch (colorStop.type) {
[34773] Fix | Delete
case 'hex':
[34774] Fix | Delete
return "#".concat(colorStop.value);
[34775] Fix | Delete
[34776] Fix | Delete
case 'literal':
[34777] Fix | Delete
return colorStop.value;
[34778] Fix | Delete
[34779] Fix | Delete
case 'rgb':
[34780] Fix | Delete
case 'rgba':
[34781] Fix | Delete
return "".concat(colorStop.type, "(").concat(colorStop.value.join(','), ")");
[34782] Fix | Delete
[34783] Fix | Delete
default:
[34784] Fix | Delete
// Should be unreachable if passing an AST from gradient-parser.
[34785] Fix | Delete
// See https://github.com/rafaelcaricio/gradient-parser#ast.
[34786] Fix | Delete
return 'transparent';
[34787] Fix | Delete
}
[34788] Fix | Delete
}
[34789] Fix | Delete
[34790] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js
[34791] Fix | Delete
[34792] Fix | Delete
[34793] Fix | Delete
function custom_gradient_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
[34794] Fix | Delete
[34795] Fix | Delete
/**
[34796] Fix | Delete
* Internal dependencies
[34797] Fix | Delete
*/
[34798] Fix | Delete
[34799] Fix | Delete
var SelectWrapper = /*#__PURE__*/styled_base_browser_esm(block, {
[34800] Fix | Delete
target: "e99xvul0",
[34801] Fix | Delete
label: "SelectWrapper"
[34802] Fix | Delete
})( true ? {
[34803] Fix | Delete
name: "otv6bo",
[34804] Fix | Delete
styles: "flex-grow:5;"
[34805] Fix | Delete
} : undefined);
[34806] Fix | Delete
var AccessoryWrapper = /*#__PURE__*/styled_base_browser_esm(block, {
[34807] Fix | Delete
target: "e99xvul1",
[34808] Fix | Delete
label: "AccessoryWrapper"
[34809] Fix | Delete
})( true ? {
[34810] Fix | Delete
name: "gmtefn",
[34811] Fix | Delete
styles: "flex-grow:4;"
[34812] Fix | Delete
} : undefined);
[34813] Fix | Delete
[34814] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js
[34815] Fix | Delete
[34816] Fix | Delete
[34817] Fix | Delete
[34818] Fix | Delete
function custom_gradient_picker_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
[34819] Fix | Delete
[34820] Fix | Delete
function custom_gradient_picker_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { custom_gradient_picker_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { custom_gradient_picker_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
[34821] Fix | Delete
[34822] Fix | Delete
/**
[34823] Fix | Delete
* External dependencies
[34824] Fix | Delete
*/
[34825] Fix | Delete
[34826] Fix | Delete
/**
[34827] Fix | Delete
* WordPress dependencies
[34828] Fix | Delete
*/
[34829] Fix | Delete
[34830] Fix | Delete
[34831] Fix | Delete
/**
[34832] Fix | Delete
* Internal dependencies
[34833] Fix | Delete
*/
[34834] Fix | Delete
[34835] Fix | Delete
[34836] Fix | Delete
[34837] Fix | Delete
[34838] Fix | Delete
[34839] Fix | Delete
[34840] Fix | Delete
[34841] Fix | Delete
[34842] Fix | Delete
[34843] Fix | Delete
[34844] Fix | Delete
var custom_gradient_picker_GradientAnglePicker = function GradientAnglePicker(_ref) {
[34845] Fix | Delete
var gradientAST = _ref.gradientAST,
[34846] Fix | Delete
hasGradient = _ref.hasGradient,
[34847] Fix | Delete
onChange = _ref.onChange;
[34848] Fix | Delete
var angle = Object(external_lodash_["get"])(gradientAST, ['orientation', 'value'], DEFAULT_LINEAR_GRADIENT_ANGLE);
[34849] Fix | Delete
[34850] Fix | Delete
var onAngleChange = function onAngleChange(newAngle) {
[34851] Fix | Delete
onChange(serializeGradient(custom_gradient_picker_objectSpread(custom_gradient_picker_objectSpread({}, gradientAST), {}, {
[34852] Fix | Delete
orientation: {
[34853] Fix | Delete
type: 'angular',
[34854] Fix | Delete
value: newAngle
[34855] Fix | Delete
}
[34856] Fix | Delete
})));
[34857] Fix | Delete
};
[34858] Fix | Delete
[34859] Fix | Delete
return Object(external_wp_element_["createElement"])(AnglePickerControl, {
[34860] Fix | Delete
hideLabelFromVision: true,
[34861] Fix | Delete
onChange: onAngleChange,
[34862] Fix | Delete
value: hasGradient ? angle : ''
[34863] Fix | Delete
});
[34864] Fix | Delete
};
[34865] Fix | Delete
[34866] Fix | Delete
var custom_gradient_picker_GradientTypePicker = function GradientTypePicker(_ref2) {
[34867] Fix | Delete
var gradientAST = _ref2.gradientAST,
[34868] Fix | Delete
hasGradient = _ref2.hasGradient,
[34869] Fix | Delete
onChange = _ref2.onChange;
[34870] Fix | Delete
var type = gradientAST.type;
[34871] Fix | Delete
[34872] Fix | Delete
var onSetLinearGradient = function onSetLinearGradient() {
[34873] Fix | Delete
onChange(serializeGradient(custom_gradient_picker_objectSpread(custom_gradient_picker_objectSpread(custom_gradient_picker_objectSpread({}, gradientAST), gradientAST.orientation ? {} : {
[34874] Fix | Delete
orientation: HORIZONTAL_GRADIENT_ORIENTATION
[34875] Fix | Delete
}), {}, {
[34876] Fix | Delete
type: 'linear-gradient'
[34877] Fix | Delete
})));
[34878] Fix | Delete
};
[34879] Fix | Delete
[34880] Fix | Delete
var onSetRadialGradient = function onSetRadialGradient() {
[34881] Fix | Delete
onChange(serializeGradient(custom_gradient_picker_objectSpread(custom_gradient_picker_objectSpread({}, Object(external_lodash_["omit"])(gradientAST, ['orientation'])), {}, {
[34882] Fix | Delete
type: 'radial-gradient'
[34883] Fix | Delete
})));
[34884] Fix | Delete
};
[34885] Fix | Delete
[34886] Fix | Delete
var handleOnChange = function handleOnChange(next) {
[34887] Fix | Delete
if (next === 'linear-gradient') {
[34888] Fix | Delete
onSetLinearGradient();
[34889] Fix | Delete
}
[34890] Fix | Delete
[34891] Fix | Delete
if (next === 'radial-gradient') {
[34892] Fix | Delete
onSetRadialGradient();
[34893] Fix | Delete
}
[34894] Fix | Delete
};
[34895] Fix | Delete
[34896] Fix | Delete
return Object(external_wp_element_["createElement"])(select_control, {
[34897] Fix | Delete
className: "components-custom-gradient-picker__type-picker",
[34898] Fix | Delete
label: Object(external_wp_i18n_["__"])('Type'),
[34899] Fix | Delete
labelPosition: 'side',
[34900] Fix | Delete
onChange: handleOnChange,
[34901] Fix | Delete
options: GRADIENT_OPTIONS,
[34902] Fix | Delete
value: hasGradient && type
[34903] Fix | Delete
});
[34904] Fix | Delete
};
[34905] Fix | Delete
[34906] Fix | Delete
function CustomGradientPicker(_ref3) {
[34907] Fix | Delete
var value = _ref3.value,
[34908] Fix | Delete
_onChange = _ref3.onChange;
[34909] Fix | Delete
var gradientAST = getGradientAstWithDefault(value); // On radial gradients the bar should display a linear gradient.
[34910] Fix | Delete
// On radial gradients the bar represents a slice of the gradient from the center until the outside.
[34911] Fix | Delete
[34912] Fix | Delete
var background = gradientAST.type === 'radial-gradient' ? getLinearGradientRepresentationOfARadial(gradientAST) : gradientAST.value;
[34913] Fix | Delete
var hasGradient = gradientAST.value !== DEFAULT_GRADIENT; // Control points color option may be hex from presets, custom colors will be rgb.
[34914] Fix | Delete
// The position should always be a percentage.
[34915] Fix | Delete
[34916] Fix | Delete
var controlPoints = gradientAST.colorStops.map(function (colorStop) {
[34917] Fix | Delete
return {
[34918] Fix | Delete
color: getStopCssColor(colorStop),
[34919] Fix | Delete
position: parseInt(colorStop.length.value)
[34920] Fix | Delete
};
[34921] Fix | Delete
});
[34922] Fix | Delete
return Object(external_wp_element_["createElement"])("div", {
[34923] Fix | Delete
className: "components-custom-gradient-picker"
[34924] Fix | Delete
}, Object(external_wp_element_["createElement"])(CustomGradientBar, {
[34925] Fix | Delete
background: background,
[34926] Fix | Delete
hasGradient: hasGradient,
[34927] Fix | Delete
value: controlPoints,
[34928] Fix | Delete
onChange: function onChange(newControlPoints) {
[34929] Fix | Delete
_onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));
[34930] Fix | Delete
}
[34931] Fix | Delete
}), Object(external_wp_element_["createElement"])(flex_Flex, {
[34932] Fix | Delete
gap: 3,
[34933] Fix | Delete
className: "components-custom-gradient-picker__ui-line"
[34934] Fix | Delete
}, Object(external_wp_element_["createElement"])(SelectWrapper, null, Object(external_wp_element_["createElement"])(custom_gradient_picker_GradientTypePicker, {
[34935] Fix | Delete
gradientAST: gradientAST,
[34936] Fix | Delete
hasGradient: hasGradient,
[34937] Fix | Delete
onChange: _onChange
[34938] Fix | Delete
})), Object(external_wp_element_["createElement"])(AccessoryWrapper, null, gradientAST.type === 'linear-gradient' && Object(external_wp_element_["createElement"])(custom_gradient_picker_GradientAnglePicker, {
[34939] Fix | Delete
gradientAST: gradientAST,
[34940] Fix | Delete
hasGradient: hasGradient,
[34941] Fix | Delete
onChange: _onChange
[34942] Fix | Delete
}))));
[34943] Fix | Delete
}
[34944] Fix | Delete
[34945] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/gradient-picker/index.js
[34946] Fix | Delete
[34947] Fix | Delete
[34948] Fix | Delete
/**
[34949] Fix | Delete
* External dependencies
[34950] Fix | Delete
*/
[34951] Fix | Delete
[34952] Fix | Delete
/**
[34953] Fix | Delete
* WordPress dependencies
[34954] Fix | Delete
*/
[34955] Fix | Delete
[34956] Fix | Delete
[34957] Fix | Delete
[34958] Fix | Delete
/**
[34959] Fix | Delete
* Internal dependencies
[34960] Fix | Delete
*/
[34961] Fix | Delete
[34962] Fix | Delete
[34963] Fix | Delete
[34964] Fix | Delete
function GradientPicker(_ref) {
[34965] Fix | Delete
var className = _ref.className,
[34966] Fix | Delete
gradients = _ref.gradients,
[34967] Fix | Delete
onChange = _ref.onChange,
[34968] Fix | Delete
value = _ref.value,
[34969] Fix | Delete
_ref$clearable = _ref.clearable,
[34970] Fix | Delete
clearable = _ref$clearable === void 0 ? true : _ref$clearable,
[34971] Fix | Delete
_ref$disableCustomGra = _ref.disableCustomGradients,
[34972] Fix | Delete
disableCustomGradients = _ref$disableCustomGra === void 0 ? false : _ref$disableCustomGra;
[34973] Fix | Delete
var clearGradient = Object(external_wp_element_["useCallback"])(function () {
[34974] Fix | Delete
return onChange(undefined);
[34975] Fix | Delete
}, [onChange]);
[34976] Fix | Delete
var gradientOptions = Object(external_wp_element_["useMemo"])(function () {
[34977] Fix | Delete
return Object(external_lodash_["map"])(gradients, function (_ref2) {
[34978] Fix | Delete
var gradient = _ref2.gradient,
[34979] Fix | Delete
name = _ref2.name;
[34980] Fix | Delete
return Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
[34981] Fix | Delete
key: gradient,
[34982] Fix | Delete
value: gradient,
[34983] Fix | Delete
isSelected: value === gradient,
[34984] Fix | Delete
tooltipText: name || // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
[34985] Fix | Delete
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient code: %s'), gradient),
[34986] Fix | Delete
style: {
[34987] Fix | Delete
color: 'rgba( 0,0,0,0 )',
[34988] Fix | Delete
background: gradient
[34989] Fix | Delete
},
[34990] Fix | Delete
onClick: value === gradient ? clearGradient : function () {
[34991] Fix | Delete
return onChange(gradient);
[34992] Fix | Delete
},
[34993] Fix | Delete
"aria-label": name ? // translators: %s: The name of the gradient e.g: "Angular red to blue".
[34994] Fix | Delete
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient: %s'), name) : // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
[34995] Fix | Delete
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient code: %s'), gradient)
[34996] Fix | Delete
});
[34997] Fix | Delete
});
[34998] Fix | Delete
}, [gradients, value, onChange, clearGradient]);
[34999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function