- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/postcss-convert-values/dist/index.js
r59329aa re29cc2e 16 16 function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } 17 17 18 const LENGTH_UNITS = ['em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', 'cm', 'mm', 'q', 'in', 'pt', 'pc', 'px']; 18 const LENGTH_UNITS = ['em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', 'cm', 'mm', 'q', 'in', 'pt', 'pc', 'px']; // These properties only accept percentages, so no point in trying to transform 19 20 const notALength = new Set(['descent-override', 'ascent-override', 'font-stretch', 'size-adjust', 'line-gap-override']); // Can't change the unit on these properties when they're 0 21 22 const keepWhenZero = new Set(['stroke-dashoffset', 'stroke-width', 'line-height']); 19 23 /* 20 24 * Numbers without digits after the dot are technically invalid, … … 67 71 } 68 72 69 function shouldKeep Unit(decl) {73 function shouldKeepZeroUnit(decl) { 70 74 const { 71 75 parent 72 76 } = decl; 73 77 const lowerCasedProp = decl.prop.toLowerCase(); 74 return ~decl.value.indexOf('%') && (lowerCasedProp === 'max-height' || lowerCasedProp === 'height') || parent.parent && parent.parent.name && parent.parent.name.toLowerCase() === 'keyframes' && lowerCasedProp === 'stroke-dasharray' || lowerCasedProp === 'stroke-dashoffset' || lowerCasedProp === 'stroke-width' || lowerCasedProp === 'line-height';78 return ~decl.value.indexOf('%') && (lowerCasedProp === 'max-height' || lowerCasedProp === 'height') || parent.parent && parent.parent.name && parent.parent.name.toLowerCase() === 'keyframes' && lowerCasedProp === 'stroke-dasharray' || keepWhenZero.has(lowerCasedProp); 75 79 } 76 80 … … 78 82 const lowerCasedProp = decl.prop.toLowerCase(); 79 83 80 if (~lowerCasedProp.indexOf('flex') || lowerCasedProp.indexOf('--') === 0 ) {84 if (~lowerCasedProp.indexOf('flex') || lowerCasedProp.indexOf('--') === 0 || notALength.has(lowerCasedProp)) { 81 85 return; 82 86 } … … 86 90 87 91 if (node.type === 'word') { 88 parseWord(node, opts, shouldKeep Unit(decl));92 parseWord(node, opts, shouldKeepZeroUnit(decl)); 89 93 90 94 if (lowerCasedProp === 'opacity' || lowerCasedProp === 'shape-image-threshold') {
Note:
See TracChangeset
for help on using the changeset viewer.