@wordpress/components
Version:
UI components for WordPress.
1 lines • 18.2 kB
Source Map (JSON)
{"version":3,"file":"utils.mjs","names":[],"sources":["../../src/unit-control/utils.ts"],"sourcesContent":["import { __, _x } from '@wordpress/i18n';\nimport type { WPUnitControlUnit } from './types';\n\nconst allUnits: Record< string, WPUnitControlUnit > = {\n\tpx: {\n\t\tvalue: 'px',\n\t\tlabel: 'px',\n\t\ta11yLabel: __( 'Pixels (px)' ),\n\t\tstep: 1,\n\t},\n\t'%': {\n\t\tvalue: '%',\n\t\tlabel: '%',\n\t\ta11yLabel: __( 'Percent (%)' ),\n\t\tstep: 0.1,\n\t},\n\tem: {\n\t\tvalue: 'em',\n\t\tlabel: 'em',\n\t\ta11yLabel: _x( 'ems', 'Relative to parent font size (em)' ),\n\t\tstep: 0.01,\n\t},\n\trem: {\n\t\tvalue: 'rem',\n\t\tlabel: 'rem',\n\t\ta11yLabel: _x( 'rems', 'Relative to root font size (rem)' ),\n\t\tstep: 0.01,\n\t},\n\tvw: {\n\t\tvalue: 'vw',\n\t\tlabel: 'vw',\n\t\ta11yLabel: __( 'Viewport width (vw)' ),\n\t\tstep: 0.1,\n\t},\n\tvh: {\n\t\tvalue: 'vh',\n\t\tlabel: 'vh',\n\t\ta11yLabel: __( 'Viewport height (vh)' ),\n\t\tstep: 0.1,\n\t},\n\tvmin: {\n\t\tvalue: 'vmin',\n\t\tlabel: 'vmin',\n\t\ta11yLabel: __( 'Viewport smallest dimension (vmin)' ),\n\t\tstep: 0.1,\n\t},\n\tvmax: {\n\t\tvalue: 'vmax',\n\t\tlabel: 'vmax',\n\t\ta11yLabel: __( 'Viewport largest dimension (vmax)' ),\n\t\tstep: 0.1,\n\t},\n\tch: {\n\t\tvalue: 'ch',\n\t\tlabel: 'ch',\n\t\ta11yLabel: __( 'Width of the zero (0) character (ch)' ),\n\t\tstep: 0.01,\n\t},\n\tex: {\n\t\tvalue: 'ex',\n\t\tlabel: 'ex',\n\t\ta11yLabel: __( 'x-height of the font (ex)' ),\n\t\tstep: 0.01,\n\t},\n\tcm: {\n\t\tvalue: 'cm',\n\t\tlabel: 'cm',\n\t\ta11yLabel: __( 'Centimeters (cm)' ),\n\t\tstep: 0.001,\n\t},\n\tmm: {\n\t\tvalue: 'mm',\n\t\tlabel: 'mm',\n\t\ta11yLabel: __( 'Millimeters (mm)' ),\n\t\tstep: 0.1,\n\t},\n\tin: {\n\t\tvalue: 'in',\n\t\tlabel: 'in',\n\t\ta11yLabel: __( 'Inches (in)' ),\n\t\tstep: 0.001,\n\t},\n\tpc: {\n\t\tvalue: 'pc',\n\t\tlabel: 'pc',\n\t\ta11yLabel: __( 'Picas (pc)' ),\n\t\tstep: 1,\n\t},\n\tpt: {\n\t\tvalue: 'pt',\n\t\tlabel: 'pt',\n\t\ta11yLabel: __( 'Points (pt)' ),\n\t\tstep: 1,\n\t},\n\tsvw: {\n\t\tvalue: 'svw',\n\t\tlabel: 'svw',\n\t\ta11yLabel: __( 'Small viewport width (svw)' ),\n\t\tstep: 0.1,\n\t},\n\tsvh: {\n\t\tvalue: 'svh',\n\t\tlabel: 'svh',\n\t\ta11yLabel: __( 'Small viewport height (svh)' ),\n\t\tstep: 0.1,\n\t},\n\tsvi: {\n\t\tvalue: 'svi',\n\t\tlabel: 'svi',\n\t\ta11yLabel: __( 'Small viewport width or height (svi)' ),\n\t\tstep: 0.1,\n\t},\n\tsvb: {\n\t\tvalue: 'svb',\n\t\tlabel: 'svb',\n\t\ta11yLabel: __( 'Small viewport width or height (svb)' ),\n\t\tstep: 0.1,\n\t},\n\tsvmin: {\n\t\tvalue: 'svmin',\n\t\tlabel: 'svmin',\n\t\ta11yLabel: __( 'Small viewport smallest dimension (svmin)' ),\n\t\tstep: 0.1,\n\t},\n\tlvw: {\n\t\tvalue: 'lvw',\n\t\tlabel: 'lvw',\n\t\ta11yLabel: __( 'Large viewport width (lvw)' ),\n\t\tstep: 0.1,\n\t},\n\tlvh: {\n\t\tvalue: 'lvh',\n\t\tlabel: 'lvh',\n\t\ta11yLabel: __( 'Large viewport height (lvh)' ),\n\t\tstep: 0.1,\n\t},\n\tlvi: {\n\t\tvalue: 'lvi',\n\t\tlabel: 'lvi',\n\t\ta11yLabel: __( 'Large viewport width or height (lvi)' ),\n\t\tstep: 0.1,\n\t},\n\tlvb: {\n\t\tvalue: 'lvb',\n\t\tlabel: 'lvb',\n\t\ta11yLabel: __( 'Large viewport width or height (lvb)' ),\n\t\tstep: 0.1,\n\t},\n\tlvmin: {\n\t\tvalue: 'lvmin',\n\t\tlabel: 'lvmin',\n\t\ta11yLabel: __( 'Large viewport smallest dimension (lvmin)' ),\n\t\tstep: 0.1,\n\t},\n\tdvw: {\n\t\tvalue: 'dvw',\n\t\tlabel: 'dvw',\n\t\ta11yLabel: __( 'Dynamic viewport width (dvw)' ),\n\t\tstep: 0.1,\n\t},\n\tdvh: {\n\t\tvalue: 'dvh',\n\t\tlabel: 'dvh',\n\t\ta11yLabel: __( 'Dynamic viewport height (dvh)' ),\n\t\tstep: 0.1,\n\t},\n\tdvi: {\n\t\tvalue: 'dvi',\n\t\tlabel: 'dvi',\n\t\ta11yLabel: __( 'Dynamic viewport width or height (dvi)' ),\n\t\tstep: 0.1,\n\t},\n\tdvb: {\n\t\tvalue: 'dvb',\n\t\tlabel: 'dvb',\n\t\ta11yLabel: __( 'Dynamic viewport width or height (dvb)' ),\n\t\tstep: 0.1,\n\t},\n\tdvmin: {\n\t\tvalue: 'dvmin',\n\t\tlabel: 'dvmin',\n\t\ta11yLabel: __( 'Dynamic viewport smallest dimension (dvmin)' ),\n\t\tstep: 0.1,\n\t},\n\tdvmax: {\n\t\tvalue: 'dvmax',\n\t\tlabel: 'dvmax',\n\t\ta11yLabel: __( 'Dynamic viewport largest dimension (dvmax)' ),\n\t\tstep: 0.1,\n\t},\n\tsvmax: {\n\t\tvalue: 'svmax',\n\t\tlabel: 'svmax',\n\t\ta11yLabel: __( 'Small viewport largest dimension (svmax)' ),\n\t\tstep: 0.1,\n\t},\n\tlvmax: {\n\t\tvalue: 'lvmax',\n\t\tlabel: 'lvmax',\n\t\ta11yLabel: __( 'Large viewport largest dimension (lvmax)' ),\n\t\tstep: 0.1,\n\t},\n\tcqw: {\n\t\tvalue: 'cqw',\n\t\tlabel: 'cqw',\n\t\ta11yLabel: __( 'Container width (cqw)' ),\n\t\tstep: 0.1,\n\t},\n\tcqh: {\n\t\tvalue: 'cqh',\n\t\tlabel: 'cqh',\n\t\ta11yLabel: __( 'Container height (cqh)' ),\n\t\tstep: 0.1,\n\t},\n\tcqi: {\n\t\tvalue: 'cqi',\n\t\tlabel: 'cqi',\n\t\ta11yLabel: __( 'Container inline size (cqi)' ),\n\t\tstep: 0.1,\n\t},\n\tcqb: {\n\t\tvalue: 'cqb',\n\t\tlabel: 'cqb',\n\t\ta11yLabel: __( 'Container block size (cqb)' ),\n\t\tstep: 0.1,\n\t},\n\tcqmin: {\n\t\tvalue: 'cqmin',\n\t\tlabel: 'cqmin',\n\t\ta11yLabel: __( 'Container smallest dimension (cqmin)' ),\n\t\tstep: 0.1,\n\t},\n\tcqmax: {\n\t\tvalue: 'cqmax',\n\t\tlabel: 'cqmax',\n\t\ta11yLabel: __( 'Container largest dimension (cqmax)' ),\n\t\tstep: 0.1,\n\t},\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values( allUnits );\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [\n\tallUnits.px,\n\tallUnits[ '%' ],\n\tallUnits.em,\n\tallUnits.rem,\n\tallUnits.vw,\n\tallUnits.vh,\n];\n\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(\n\trawValue?: string | number,\n\tfallbackUnit?: string,\n\tallowedUnits?: WPUnitControlUnit[]\n): [ number | undefined, string | undefined ] {\n\tconst initialValue = fallbackUnit\n\t\t? `${ rawValue ?? '' }${ fallbackUnit }`\n\t\t: rawValue;\n\n\treturn parseQuantityAndUnitFromRawValue( initialValue, allowedUnits );\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits(\n\tunits?: WPUnitControlUnit[]\n): units is WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( units ) && !! units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(\n\trawValue?: string | number,\n\tallowedUnits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): [ number | undefined, string | undefined ] {\n\tlet trimmedValue;\n\tlet quantityToReturn;\n\n\tif ( typeof rawValue !== 'undefined' || rawValue === null ) {\n\t\ttrimmedValue = `${ rawValue }`.trim();\n\t\tconst parsedQuantity = parseFloat( trimmedValue );\n\t\tquantityToReturn = ! isFinite( parsedQuantity )\n\t\t\t? undefined\n\t\t\t: parsedQuantity;\n\t}\n\n\tconst unitMatch = trimmedValue?.match( /[\\d.\\-\\+]*\\s*(.*)/ );\n\tconst matchedUnit = unitMatch?.[ 1 ]?.toLowerCase();\n\tlet unitToReturn: string | undefined;\n\tif ( hasUnits( allowedUnits ) ) {\n\t\tconst match = allowedUnits.find(\n\t\t\t( item ) => item.value === matchedUnit\n\t\t);\n\t\tunitToReturn = match?.value;\n\t} else {\n\t\tunitToReturn = DEFAULT_UNIT.value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(\n\trawValue: string | number,\n\tallowedUnits?: WPUnitControlUnit[],\n\tfallbackQuantity?: number,\n\tfallbackUnit?: string\n): [ number | undefined, string | undefined ] {\n\tconst [ parsedQuantity, parsedUnit ] = parseQuantityAndUnitFromRawValue(\n\t\trawValue,\n\t\tallowedUnits\n\t);\n\n\t// The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n\t// either a real number or undefined. If undefined, use the fallback value.\n\tconst quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n\t// If no unit is parsed from the raw value, or if the fallback unit is not\n\t// defined, use the first value from the list of allowed units as fallback.\n\tlet unitToReturn = parsedUnit || fallbackUnit;\n\n\tif ( ! unitToReturn && hasUnits( allowedUnits ) ) {\n\t\tunitToReturn = allowedUnits[ 0 ].value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(\n\tallowedUnitValues: string[] = [],\n\tavailableUnits: WPUnitControlUnit[]\n): WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( availableUnits )\n\t\t? availableUnits.filter( ( unit ) =>\n\t\t\t\tallowedUnitValues.includes( unit.value )\n\t\t\t)\n\t\t: [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ( {\n\tunits = ALL_CSS_UNITS,\n\tavailableUnits = [],\n\tdefaultValues,\n}: {\n\tunits?: WPUnitControlUnit[];\n\tavailableUnits?: string[];\n\tdefaultValues?: Record< string, number >;\n} ): WPUnitControlUnit[] => {\n\tconst customUnitsToReturn = filterUnitsWithSettings(\n\t\tavailableUnits,\n\t\tunits\n\t);\n\n\tif ( ! defaultValues ) {\n\t\treturn customUnitsToReturn;\n\t}\n\n\treturn customUnitsToReturn.map( ( unit ) => {\n\t\tconst [ defaultValue ] = defaultValues[ unit.value ]\n\t\t\t? parseQuantityAndUnitFromRawValue( defaultValues[ unit.value ] )\n\t\t\t: [];\n\t\treturn { ...unit, default: defaultValue };\n\t} );\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(\n\trawValue?: string | number,\n\tlegacyUnit?: string,\n\tunits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): WPUnitControlUnit[] {\n\tconst unitsToReturn = Array.isArray( units ) ? [ ...units ] : [];\n\tconst [ , currentUnit ] = getParsedQuantityAndUnit(\n\t\trawValue,\n\t\tlegacyUnit,\n\t\tALL_CSS_UNITS\n\t);\n\n\tif (\n\t\tcurrentUnit &&\n\t\t! unitsToReturn.some( ( unit ) => unit.value === currentUnit )\n\t) {\n\t\tif ( allUnits[ currentUnit ] ) {\n\t\t\tunitsToReturn.unshift( allUnits[ currentUnit ] );\n\t\t}\n\t}\n\n\treturn unitsToReturn;\n}\n"],"mappings":";;AAGA,MAAM,WAAgD;CACrD,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GAAI,aAAc;EAC7B,MAAM;CACP;CACA,KAAK;EACJ,OAAO;EACP,OAAO;EACP,WAAW,GAAI,aAAc;EAC7B,MAAM;CACP;CACA,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GAAI,OAAO,mCAAoC;EAC1D,MAAM;CACP;CACA,KAAK;EACJ,OAAO;EACP,OAAO;EACP,WAAW,GAAI,QAAQ,kCAAmC;EAC1D,MAAM;CACP;CACA,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GAAI,qBAAsB;EACrC,MAAM;CACP;CACA,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GAAI,sBAAuB;EACtC,MAAM;CACP;CACA,MAAM;EACL,OAAO;EACP,OAAO;EACP,WAAW,GAAI,oCAAqC;EACpD,MAAM;CACP;CACA,MAAM;EACL,OAAO;EACP,OAAO;EACP,WAAW,GAAI,mCAAoC;EACnD,MAAM;CACP;CACA,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GAAI,sCAAuC;EACtD,MAAM;CACP;CACA,IAAI;EACH,OAAO;EACP,OAAO;EACP,WAAW,GA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