Gazebo_simulation-Frontend/node_modules/convert-css-length/dist/index.umd.js.map

1 line
4.7 KiB
Plaintext
Raw Normal View History

2020-12-21 11:29:31 -04:00
{"version":3,"file":"index.umd.js","sources":["../src/index.js","../src/unit.js"],"sourcesContent":["/*\n * decaffeinate suggestions:\n * DS102: Remove unnecessary code created because of implicit returns\n * DS207: Consider shorter variations of null checks\n * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md\n */\n// Ported from Compass\n// https://github.com/Compass/compass/blob/master/core/stylesheets/compass/typography/_units.scss\n\n// Emulate the sass function \"unit\"\nimport unit from \"./unit\"\n\nconst baseFontSize = \"16px\"\n\n// Emulate the sass function \"unitless\"\nconst unitLess = length => parseFloat(length)\n\n// Convert any CSS <length> or <percentage> value to any another.\n//\n// @param length\n// A css <length> value\n//\n// @param toUnit\n// String matching a css unit keyword, e.g. 'em', 'rem', etc.\n//\n// @param fromContext\n// When converting from relative units, the absolute length (in px) to\n// which length refers (e.g. for lengths in em units, would normally be the\n// font-size of the current element).\n//\n// @param toContext\n// For converting to relative units, the absolute length in px to which the\n// output value will refer. Defaults to the same as fromContext, since it is\n// rarely needed.\nexport default function convertCSSLength(baseFontSize) {\n if (baseFontSize == null) {\n baseFontSize = baseFontSize\n }\n return function(length, toUnit, fromContext, toContext) {\n if (fromContext == null) {\n fromContext = baseFontSize\n }\n if (toContext == null) {\n toContext = fromContext\n }\n const fromUnit = unit(length)\n\n // Optimize for cases where `from` and `to` units are accidentally the same.\n if (fromUnit === toUnit) {\n return length\n }\n\n // Convert input length to pixels.\n let pxLength = unitLess(length)\n\n // Warn if to or from context aren't in pixels.\n // if (unit(fromContext) !== \"px\") {\n // console.warn(`Parameter fromContext must resolve to a value \\\n // in pixel units.`)\n // }\n // if (unit(toContext) !== \"px\") {\n // console.warn(`Parameter toContext must resolve to a value \\\n // in pixel units.`)\n // }\n\n if (fromUnit !== \"px\") {\n if (fromUnit === \"em\") {\n pxLength = unitLess(length) * unitLess(fromContext)\n } else if (fromUnit === \"rem\") {\n pxLength = unitLess(length) * unitLess(baseFontSize)\n } else if (fromUnit === \"ex\") {\n pxLength = unitLess(length) * unitLess(fromContext) * 2\n } else {\n return length\n }\n // } else if ([\"ch\", \"vw\", \"vh\", \"vmin\"].includes(fromUnit)) {\n // console.warn(`${fromUnit} units can't be reliably converted; Returning \\\n // original value.`)\n // return length\n // } else {\n // console.warn(`${fromUnit} is an unknown or unsupported length unit; \\\n // Returning original value.`)\n // return length\n // }\n }\n\n // Convert length in pixels to the output unit\n let outputLength = pxLength\n if (toUnit !== \"px\") {\n if (toUnit === \"em\") {\n outputLength = pxLength / unitLess(toContext)\n } else if (toUnit === \"rem\") {\n outputLength = pxLength / unitLess(baseFontSize)\n } else if (toUnit === \"ex\") {\n outputLength = pxLength / unitLess(toContext) / 2\n // } else if ([\"ch\", \"vw\", \"vh\", \"vmin\"].includes(toUnit)) {\n // console.warn(`${toUnit} units can't be reliably converted; Returning \\\n // original value.`)\n // return length\n // } else {\n // console.warn(`${toUnit} is an unknown or unsupported length unit; \\\n // Returning original value.`)\n } else {\n return length\n }\n }\n\n return parseFloat(outputLength.toFixed(5)) + toUnit\n }\n}\n","export default function unit(input) {\n return String(input).match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || \"\"\n}\n"],"names":["const","unitLess","length","parseFloat","baseFontSize","toUni