Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: components.js
// Must equal $color-palette-circle-size from:
[39500] Fix | Delete
// @wordpress/components/src/circular-option-picker/style.scss
[39501] Fix | Delete
const swatchSize = 28;
[39502] Fix | Delete
const swatchGap = 12;
[39503] Fix | Delete
const borderControlPopoverControls = /*#__PURE__*/emotion_react_browser_esm_css("width:", swatchSize * 6 + swatchGap * 5, "px;>div:first-of-type>", StyledLabel, "{margin-bottom:0;", styles_labelStyles, ";}&& ", StyledLabel, "+button:not( .has-text ){min-width:24px;padding:0;}" + ( true ? "" : 0), true ? "" : 0);
[39504] Fix | Delete
const borderControlPopoverContent = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
[39505] Fix | Delete
const borderColorIndicator = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
[39506] Fix | Delete
const resetButton = /*#__PURE__*/emotion_react_browser_esm_css("justify-content:center;width:100%;&&{border-top:", config_values.borderWidth, " solid ", COLORS.gray[400], ";border-top-left-radius:0;border-top-right-radius:0;height:40px;}" + ( true ? "" : 0), true ? "" : 0);
[39507] Fix | Delete
const borderSlider = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1 1 60%;", rtl({
[39508] Fix | Delete
marginRight: space(3)
[39509] Fix | Delete
})(), ";" + ( true ? "" : 0), true ? "" : 0);
[39510] Fix | Delete
[39511] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
[39512] Fix | Delete
/**
[39513] Fix | Delete
* WordPress dependencies
[39514] Fix | Delete
*/
[39515] Fix | Delete
[39516] Fix | Delete
[39517] Fix | Delete
[39518] Fix | Delete
/**
[39519] Fix | Delete
* Internal dependencies
[39520] Fix | Delete
*/
[39521] Fix | Delete
[39522] Fix | Delete
const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
[39523] Fix | Delete
const allUnits = {
[39524] Fix | Delete
px: {
[39525] Fix | Delete
value: 'px',
[39526] Fix | Delete
label: isWeb ? 'px' : (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
[39527] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
[39528] Fix | Delete
step: 1
[39529] Fix | Delete
},
[39530] Fix | Delete
'%': {
[39531] Fix | Delete
value: '%',
[39532] Fix | Delete
label: isWeb ? '%' : (0,external_wp_i18n_namespaceObject.__)('Percentage (%)'),
[39533] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Percent (%)'),
[39534] Fix | Delete
step: 0.1
[39535] Fix | Delete
},
[39536] Fix | Delete
em: {
[39537] Fix | Delete
value: 'em',
[39538] Fix | Delete
label: isWeb ? 'em' : (0,external_wp_i18n_namespaceObject.__)('Relative to parent font size (em)'),
[39539] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject._x)('ems', 'Relative to parent font size (em)'),
[39540] Fix | Delete
step: 0.01
[39541] Fix | Delete
},
[39542] Fix | Delete
rem: {
[39543] Fix | Delete
value: 'rem',
[39544] Fix | Delete
label: isWeb ? 'rem' : (0,external_wp_i18n_namespaceObject.__)('Relative to root font size (rem)'),
[39545] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject._x)('rems', 'Relative to root font size (rem)'),
[39546] Fix | Delete
step: 0.01
[39547] Fix | Delete
},
[39548] Fix | Delete
vw: {
[39549] Fix | Delete
value: 'vw',
[39550] Fix | Delete
label: isWeb ? 'vw' : (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
[39551] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
[39552] Fix | Delete
step: 0.1
[39553] Fix | Delete
},
[39554] Fix | Delete
vh: {
[39555] Fix | Delete
value: 'vh',
[39556] Fix | Delete
label: isWeb ? 'vh' : (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
[39557] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
[39558] Fix | Delete
step: 0.1
[39559] Fix | Delete
},
[39560] Fix | Delete
vmin: {
[39561] Fix | Delete
value: 'vmin',
[39562] Fix | Delete
label: isWeb ? 'vmin' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
[39563] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
[39564] Fix | Delete
step: 0.1
[39565] Fix | Delete
},
[39566] Fix | Delete
vmax: {
[39567] Fix | Delete
value: 'vmax',
[39568] Fix | Delete
label: isWeb ? 'vmax' : (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
[39569] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
[39570] Fix | Delete
step: 0.1
[39571] Fix | Delete
},
[39572] Fix | Delete
ch: {
[39573] Fix | Delete
value: 'ch',
[39574] Fix | Delete
label: isWeb ? 'ch' : (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
[39575] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
[39576] Fix | Delete
step: 0.01
[39577] Fix | Delete
},
[39578] Fix | Delete
ex: {
[39579] Fix | Delete
value: 'ex',
[39580] Fix | Delete
label: isWeb ? 'ex' : (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
[39581] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
[39582] Fix | Delete
step: 0.01
[39583] Fix | Delete
},
[39584] Fix | Delete
cm: {
[39585] Fix | Delete
value: 'cm',
[39586] Fix | Delete
label: isWeb ? 'cm' : (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
[39587] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
[39588] Fix | Delete
step: 0.001
[39589] Fix | Delete
},
[39590] Fix | Delete
mm: {
[39591] Fix | Delete
value: 'mm',
[39592] Fix | Delete
label: isWeb ? 'mm' : (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
[39593] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
[39594] Fix | Delete
step: 0.1
[39595] Fix | Delete
},
[39596] Fix | Delete
in: {
[39597] Fix | Delete
value: 'in',
[39598] Fix | Delete
label: isWeb ? 'in' : (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
[39599] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
[39600] Fix | Delete
step: 0.001
[39601] Fix | Delete
},
[39602] Fix | Delete
pc: {
[39603] Fix | Delete
value: 'pc',
[39604] Fix | Delete
label: isWeb ? 'pc' : (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
[39605] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
[39606] Fix | Delete
step: 1
[39607] Fix | Delete
},
[39608] Fix | Delete
pt: {
[39609] Fix | Delete
value: 'pt',
[39610] Fix | Delete
label: isWeb ? 'pt' : (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
[39611] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
[39612] Fix | Delete
step: 1
[39613] Fix | Delete
},
[39614] Fix | Delete
svw: {
[39615] Fix | Delete
value: 'svw',
[39616] Fix | Delete
label: isWeb ? 'svw' : (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'),
[39617] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width (svw)'),
[39618] Fix | Delete
step: 0.1
[39619] Fix | Delete
},
[39620] Fix | Delete
svh: {
[39621] Fix | Delete
value: 'svh',
[39622] Fix | Delete
label: isWeb ? 'svh' : (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'),
[39623] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport height (svh)'),
[39624] Fix | Delete
step: 0.1
[39625] Fix | Delete
},
[39626] Fix | Delete
svi: {
[39627] Fix | Delete
value: 'svi',
[39628] Fix | Delete
label: isWeb ? 'svi' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the inline direction (svi)'),
[39629] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svi)'),
[39630] Fix | Delete
step: 0.1
[39631] Fix | Delete
},
[39632] Fix | Delete
svb: {
[39633] Fix | Delete
value: 'svb',
[39634] Fix | Delete
label: isWeb ? 'svb' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest size in the block direction (svb)'),
[39635] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport width or height (svb)'),
[39636] Fix | Delete
step: 0.1
[39637] Fix | Delete
},
[39638] Fix | Delete
svmin: {
[39639] Fix | Delete
value: 'svmin',
[39640] Fix | Delete
label: isWeb ? 'svmin' : (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'),
[39641] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport smallest dimension (svmin)'),
[39642] Fix | Delete
step: 0.1
[39643] Fix | Delete
},
[39644] Fix | Delete
lvw: {
[39645] Fix | Delete
value: 'lvw',
[39646] Fix | Delete
label: isWeb ? 'lvw' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'),
[39647] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width (lvw)'),
[39648] Fix | Delete
step: 0.1
[39649] Fix | Delete
},
[39650] Fix | Delete
lvh: {
[39651] Fix | Delete
value: 'lvh',
[39652] Fix | Delete
label: isWeb ? 'lvh' : (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'),
[39653] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport height (lvh)'),
[39654] Fix | Delete
step: 0.1
[39655] Fix | Delete
},
[39656] Fix | Delete
lvi: {
[39657] Fix | Delete
value: 'lvi',
[39658] Fix | Delete
label: isWeb ? 'lvi' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'),
[39659] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvi)'),
[39660] Fix | Delete
step: 0.1
[39661] Fix | Delete
},
[39662] Fix | Delete
lvb: {
[39663] Fix | Delete
value: 'lvb',
[39664] Fix | Delete
label: isWeb ? 'lvb' : (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'),
[39665] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport width or height (lvb)'),
[39666] Fix | Delete
step: 0.1
[39667] Fix | Delete
},
[39668] Fix | Delete
lvmin: {
[39669] Fix | Delete
value: 'lvmin',
[39670] Fix | Delete
label: isWeb ? 'lvmin' : (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'),
[39671] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport smallest dimension (lvmin)'),
[39672] Fix | Delete
step: 0.1
[39673] Fix | Delete
},
[39674] Fix | Delete
dvw: {
[39675] Fix | Delete
value: 'dvw',
[39676] Fix | Delete
label: isWeb ? 'dvw' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'),
[39677] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width (dvw)'),
[39678] Fix | Delete
step: 0.1
[39679] Fix | Delete
},
[39680] Fix | Delete
dvh: {
[39681] Fix | Delete
value: 'dvh',
[39682] Fix | Delete
label: isWeb ? 'dvh' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'),
[39683] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport height (dvh)'),
[39684] Fix | Delete
step: 0.1
[39685] Fix | Delete
},
[39686] Fix | Delete
dvi: {
[39687] Fix | Delete
value: 'dvi',
[39688] Fix | Delete
label: isWeb ? 'dvi' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'),
[39689] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvi)'),
[39690] Fix | Delete
step: 0.1
[39691] Fix | Delete
},
[39692] Fix | Delete
dvb: {
[39693] Fix | Delete
value: 'dvb',
[39694] Fix | Delete
label: isWeb ? 'dvb' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'),
[39695] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport width or height (dvb)'),
[39696] Fix | Delete
step: 0.1
[39697] Fix | Delete
},
[39698] Fix | Delete
dvmin: {
[39699] Fix | Delete
value: 'dvmin',
[39700] Fix | Delete
label: isWeb ? 'dvmin' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'),
[39701] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport smallest dimension (dvmin)'),
[39702] Fix | Delete
step: 0.1
[39703] Fix | Delete
},
[39704] Fix | Delete
dvmax: {
[39705] Fix | Delete
value: 'dvmax',
[39706] Fix | Delete
label: isWeb ? 'dvmax' : (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'),
[39707] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Dynamic viewport largest dimension (dvmax)'),
[39708] Fix | Delete
step: 0.1
[39709] Fix | Delete
},
[39710] Fix | Delete
svmax: {
[39711] Fix | Delete
value: 'svmax',
[39712] Fix | Delete
label: isWeb ? 'svmax' : (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'),
[39713] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Small viewport largest dimension (svmax)'),
[39714] Fix | Delete
step: 0.1
[39715] Fix | Delete
},
[39716] Fix | Delete
lvmax: {
[39717] Fix | Delete
value: 'lvmax',
[39718] Fix | Delete
label: isWeb ? 'lvmax' : (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'),
[39719] Fix | Delete
a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Large viewport largest dimension (lvmax)'),
[39720] Fix | Delete
step: 0.1
[39721] Fix | Delete
}
[39722] Fix | Delete
};
[39723] Fix | Delete
[39724] Fix | Delete
/**
[39725] Fix | Delete
* An array of all available CSS length units.
[39726] Fix | Delete
*/
[39727] Fix | Delete
const ALL_CSS_UNITS = Object.values(allUnits);
[39728] Fix | Delete
[39729] Fix | Delete
/**
[39730] Fix | Delete
* Units of measurements. `a11yLabel` is used by screenreaders.
[39731] Fix | Delete
*/
[39732] Fix | Delete
const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];
[39733] Fix | Delete
const DEFAULT_UNIT = allUnits.px;
[39734] Fix | Delete
[39735] Fix | Delete
/**
[39736] Fix | Delete
* Handles legacy value + unit handling.
[39737] Fix | Delete
* This component use to manage both incoming value and units separately.
[39738] Fix | Delete
*
[39739] Fix | Delete
* Moving forward, ideally the value should be a string that contains both
[39740] Fix | Delete
* the value and unit, example: '10px'
[39741] Fix | Delete
*
[39742] Fix | Delete
* @param rawValue The raw value as a string (may or may not contain the unit)
[39743] Fix | Delete
* @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
[39744] Fix | Delete
* @param allowedUnits Units to derive from.
[39745] Fix | Delete
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
[39746] Fix | Delete
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
[39747] Fix | Delete
* from the raw value could not be matched against the list of allowed units.
[39748] Fix | Delete
*/
[39749] Fix | Delete
function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
[39750] Fix | Delete
const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
[39751] Fix | Delete
return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
[39752] Fix | Delete
}
[39753] Fix | Delete
[39754] Fix | Delete
/**
[39755] Fix | Delete
* Checks if units are defined.
[39756] Fix | Delete
*
[39757] Fix | Delete
* @param units List of units.
[39758] Fix | Delete
* @return Whether the list actually contains any units.
[39759] Fix | Delete
*/
[39760] Fix | Delete
function hasUnits(units) {
[39761] Fix | Delete
// Although the `isArray` check shouldn't be necessary (given the signature of
[39762] Fix | Delete
// this typed function), it's better to stay on the side of caution, since
[39763] Fix | Delete
// this function may be called from un-typed environments.
[39764] Fix | Delete
return Array.isArray(units) && !!units.length;
[39765] Fix | Delete
}
[39766] Fix | Delete
[39767] Fix | Delete
/**
[39768] Fix | Delete
* Parses a quantity and unit from a raw string value, given a list of allowed
[39769] Fix | Delete
* units and otherwise falling back to the default unit.
[39770] Fix | Delete
*
[39771] Fix | Delete
* @param rawValue The raw value as a string (may or may not contain the unit)
[39772] Fix | Delete
* @param allowedUnits Units to derive from.
[39773] Fix | Delete
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
[39774] Fix | Delete
* could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
[39775] Fix | Delete
* from the raw value could not be matched against the list of allowed units.
[39776] Fix | Delete
*/
[39777] Fix | Delete
function parseQuantityAndUnitFromRawValue(rawValue, allowedUnits = ALL_CSS_UNITS) {
[39778] Fix | Delete
let trimmedValue;
[39779] Fix | Delete
let quantityToReturn;
[39780] Fix | Delete
if (typeof rawValue !== 'undefined' || rawValue === null) {
[39781] Fix | Delete
trimmedValue = `${rawValue}`.trim();
[39782] Fix | Delete
const parsedQuantity = parseFloat(trimmedValue);
[39783] Fix | Delete
quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
[39784] Fix | Delete
}
[39785] Fix | Delete
const unitMatch = trimmedValue?.match(/[\d.\-\+]*\s*(.*)/);
[39786] Fix | Delete
const matchedUnit = unitMatch?.[1]?.toLowerCase();
[39787] Fix | Delete
let unitToReturn;
[39788] Fix | Delete
if (hasUnits(allowedUnits)) {
[39789] Fix | Delete
const match = allowedUnits.find(item => item.value === matchedUnit);
[39790] Fix | Delete
unitToReturn = match?.value;
[39791] Fix | Delete
} else {
[39792] Fix | Delete
unitToReturn = DEFAULT_UNIT.value;
[39793] Fix | Delete
}
[39794] Fix | Delete
return [quantityToReturn, unitToReturn];
[39795] Fix | Delete
}
[39796] Fix | Delete
[39797] Fix | Delete
/**
[39798] Fix | Delete
* Parses quantity and unit from a raw value. Validates parsed value, using fallback
[39799] Fix | Delete
* value if invalid.
[39800] Fix | Delete
*
[39801] Fix | Delete
* @param rawValue The next value.
[39802] Fix | Delete
* @param allowedUnits Units to derive from.
[39803] Fix | Delete
* @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
[39804] Fix | Delete
* @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
[39805] Fix | Delete
* @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
[39806] Fix | Delete
* could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
[39807] Fix | Delete
* unit can be `undefined` only if the unit parsed from the raw value could not be matched against
[39808] Fix | Delete
* the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
[39809] Fix | Delete
* `allowedUnits` is passed empty.
[39810] Fix | Delete
*/
[39811] Fix | Delete
function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
[39812] Fix | Delete
const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits);
[39813] Fix | Delete
[39814] Fix | Delete
// The parsed value from `parseQuantityAndUnitFromRawValue` should now be
[39815] Fix | Delete
// either a real number or undefined. If undefined, use the fallback value.
[39816] Fix | Delete
const quantityToReturn = parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : fallbackQuantity;
[39817] Fix | Delete
[39818] Fix | Delete
// If no unit is parsed from the raw value, or if the fallback unit is not
[39819] Fix | Delete
// defined, use the first value from the list of allowed units as fallback.
[39820] Fix | Delete
let unitToReturn = parsedUnit || fallbackUnit;
[39821] Fix | Delete
if (!unitToReturn && hasUnits(allowedUnits)) {
[39822] Fix | Delete
unitToReturn = allowedUnits[0].value;
[39823] Fix | Delete
}
[39824] Fix | Delete
return [quantityToReturn, unitToReturn];
[39825] Fix | Delete
}
[39826] Fix | Delete
[39827] Fix | Delete
/**
[39828] Fix | Delete
* Takes a unit value and finds the matching accessibility label for the
[39829] Fix | Delete
* unit abbreviation.
[39830] Fix | Delete
*
[39831] Fix | Delete
* @param unit Unit value (example: `px`)
[39832] Fix | Delete
* @return a11y label for the unit abbreviation
[39833] Fix | Delete
*/
[39834] Fix | Delete
function getAccessibleLabelForUnit(unit) {
[39835] Fix | Delete
const match = ALL_CSS_UNITS.find(item => item.value === unit);
[39836] Fix | Delete
return match?.a11yLabel ? match?.a11yLabel : match?.value;
[39837] Fix | Delete
}
[39838] Fix | Delete
[39839] Fix | Delete
/**
[39840] Fix | Delete
* Filters available units based on values defined a list of allowed unit values.
[39841] Fix | Delete
*
[39842] Fix | Delete
* @param allowedUnitValues Collection of allowed unit value strings.
[39843] Fix | Delete
* @param availableUnits Collection of available unit objects.
[39844] Fix | Delete
* @return Filtered units.
[39845] Fix | Delete
*/
[39846] Fix | Delete
function filterUnitsWithSettings(allowedUnitValues = [], availableUnits) {
[39847] Fix | Delete
// Although the `isArray` check shouldn't be necessary (given the signature of
[39848] Fix | Delete
// this typed function), it's better to stay on the side of caution, since
[39849] Fix | Delete
// this function may be called from un-typed environments.
[39850] Fix | Delete
return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
[39851] Fix | Delete
}
[39852] Fix | Delete
[39853] Fix | Delete
/**
[39854] Fix | Delete
* Custom hook to retrieve and consolidate units setting from add_theme_support().
[39855] Fix | Delete
* TODO: ideally this hook shouldn't be needed
[39856] Fix | Delete
* https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
[39857] Fix | Delete
*
[39858] Fix | Delete
* @param args An object containing units, settingPath & defaultUnits.
[39859] Fix | Delete
* @param args.units Collection of all potentially available units.
[39860] Fix | Delete
* @param args.availableUnits Collection of unit value strings for filtering available units.
[39861] Fix | Delete
* @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
[39862] Fix | Delete
*
[39863] Fix | Delete
* @return Filtered list of units, with their default values updated following the `defaultValues`
[39864] Fix | Delete
* argument's property.
[39865] Fix | Delete
*/
[39866] Fix | Delete
const useCustomUnits = ({
[39867] Fix | Delete
units = ALL_CSS_UNITS,
[39868] Fix | Delete
availableUnits = [],
[39869] Fix | Delete
defaultValues
[39870] Fix | Delete
}) => {
[39871] Fix | Delete
const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
[39872] Fix | Delete
if (defaultValues) {
[39873] Fix | Delete
customUnitsToReturn.forEach((unit, i) => {
[39874] Fix | Delete
if (defaultValues[unit.value]) {
[39875] Fix | Delete
const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
[39876] Fix | Delete
customUnitsToReturn[i].default = parsedDefaultValue;
[39877] Fix | Delete
}
[39878] Fix | Delete
});
[39879] Fix | Delete
}
[39880] Fix | Delete
return customUnitsToReturn;
[39881] Fix | Delete
};
[39882] Fix | Delete
[39883] Fix | Delete
/**
[39884] Fix | Delete
* Get available units with the unit for the currently selected value
[39885] Fix | Delete
* prepended if it is not available in the list of units.
[39886] Fix | Delete
*
[39887] Fix | Delete
* This is useful to ensure that the current value's unit is always
[39888] Fix | Delete
* accurately displayed in the UI, even if the intention is to hide
[39889] Fix | Delete
* the availability of that unit.
[39890] Fix | Delete
*
[39891] Fix | Delete
* @param rawValue Selected value to parse.
[39892] Fix | Delete
* @param legacyUnit Legacy unit value, if rawValue needs it appended.
[39893] Fix | Delete
* @param units List of available units.
[39894] Fix | Delete
*
[39895] Fix | Delete
* @return A collection of units containing the unit for the current value.
[39896] Fix | Delete
*/
[39897] Fix | Delete
function getUnitsWithCurrentUnit(rawValue, legacyUnit, units = ALL_CSS_UNITS) {
[39898] Fix | Delete
const unitsToReturn = Array.isArray(units) ? [...units] : [];
[39899] Fix | Delete
const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
[39900] Fix | Delete
if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
[39901] Fix | Delete
if (allUnits[currentUnit]) {
[39902] Fix | Delete
unitsToReturn.unshift(allUnits[currentUnit]);
[39903] Fix | Delete
}
[39904] Fix | Delete
}
[39905] Fix | Delete
return unitsToReturn;
[39906] Fix | Delete
}
[39907] Fix | Delete
[39908] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/hook.js
[39909] Fix | Delete
/**
[39910] Fix | Delete
* WordPress dependencies
[39911] Fix | Delete
*/
[39912] Fix | Delete
[39913] Fix | Delete
[39914] Fix | Delete
/**
[39915] Fix | Delete
* Internal dependencies
[39916] Fix | Delete
*/
[39917] Fix | Delete
[39918] Fix | Delete
[39919] Fix | Delete
[39920] Fix | Delete
[39921] Fix | Delete
function useBorderControlDropdown(props) {
[39922] Fix | Delete
const {
[39923] Fix | Delete
border,
[39924] Fix | Delete
className,
[39925] Fix | Delete
colors = [],
[39926] Fix | Delete
enableAlpha = false,
[39927] Fix | Delete
enableStyle = true,
[39928] Fix | Delete
onChange,
[39929] Fix | Delete
previousStyleSelection,
[39930] Fix | Delete
size = 'default',
[39931] Fix | Delete
__experimentalIsRenderedInSidebar = false,
[39932] Fix | Delete
...otherProps
[39933] Fix | Delete
} = useContextSystem(props, 'BorderControlDropdown');
[39934] Fix | Delete
const [widthValue] = parseQuantityAndUnitFromRawValue(border?.width);
[39935] Fix | Delete
const hasZeroWidth = widthValue === 0;
[39936] Fix | Delete
const onColorChange = color => {
[39937] Fix | Delete
const style = border?.style === 'none' ? previousStyleSelection : border?.style;
[39938] Fix | Delete
const width = hasZeroWidth && !!color ? '1px' : border?.width;
[39939] Fix | Delete
onChange({
[39940] Fix | Delete
color,
[39941] Fix | Delete
style,
[39942] Fix | Delete
width
[39943] Fix | Delete
});
[39944] Fix | Delete
};
[39945] Fix | Delete
const onStyleChange = style => {
[39946] Fix | Delete
const width = hasZeroWidth && !!style ? '1px' : border?.width;
[39947] Fix | Delete
onChange({
[39948] Fix | Delete
...border,
[39949] Fix | Delete
style,
[39950] Fix | Delete
width
[39951] Fix | Delete
});
[39952] Fix | Delete
};
[39953] Fix | Delete
const onReset = () => {
[39954] Fix | Delete
onChange({
[39955] Fix | Delete
...border,
[39956] Fix | Delete
color: undefined,
[39957] Fix | Delete
style: undefined
[39958] Fix | Delete
});
[39959] Fix | Delete
};
[39960] Fix | Delete
[39961] Fix | Delete
// Generate class names.
[39962] Fix | Delete
const cx = useCx();
[39963] Fix | Delete
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39964] Fix | Delete
return cx(borderControlDropdown, className);
[39965] Fix | Delete
}, [className, cx]);
[39966] Fix | Delete
const indicatorClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39967] Fix | Delete
return cx(borderColorIndicator);
[39968] Fix | Delete
}, [cx]);
[39969] Fix | Delete
const indicatorWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39970] Fix | Delete
return cx(colorIndicatorWrapper(border, size));
[39971] Fix | Delete
}, [border, cx, size]);
[39972] Fix | Delete
const popoverControlsClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39973] Fix | Delete
return cx(borderControlPopoverControls);
[39974] Fix | Delete
}, [cx]);
[39975] Fix | Delete
const popoverContentClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39976] Fix | Delete
return cx(borderControlPopoverContent);
[39977] Fix | Delete
}, [cx]);
[39978] Fix | Delete
const resetButtonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
[39979] Fix | Delete
return cx(resetButton);
[39980] Fix | Delete
}, [cx]);
[39981] Fix | Delete
return {
[39982] Fix | Delete
...otherProps,
[39983] Fix | Delete
border,
[39984] Fix | Delete
className: classes,
[39985] Fix | Delete
colors,
[39986] Fix | Delete
enableAlpha,
[39987] Fix | Delete
enableStyle,
[39988] Fix | Delete
indicatorClassName,
[39989] Fix | Delete
indicatorWrapperClassName,
[39990] Fix | Delete
onColorChange,
[39991] Fix | Delete
onStyleChange,
[39992] Fix | Delete
onReset,
[39993] Fix | Delete
popoverContentClassName,
[39994] Fix | Delete
popoverControlsClassName,
[39995] Fix | Delete
resetButtonClassName,
[39996] Fix | Delete
size,
[39997] Fix | Delete
__experimentalIsRenderedInSidebar
[39998] Fix | Delete
};
[39999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function