postcss-normalize-positions
Advanced tools
Comparing version 5.0.4 to 5.1.0
{ | ||
"name": "postcss-normalize-positions", | ||
"version": "5.0.4", | ||
"version": "5.1.0", | ||
"description": "Normalize keyword values for position into length values.", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"src", | ||
"LICENSE-MIT" | ||
"LICENSE-MIT", | ||
"types" | ||
], | ||
@@ -10,0 +12,0 @@ "keywords": [ |
@@ -17,2 +17,6 @@ 'use strict'; | ||
/** | ||
* @param {valueParser.Node} node | ||
* @return {boolean} | ||
*/ | ||
function isCommaNode(node) { | ||
@@ -22,2 +26,6 @@ return node.type === 'div' && node.value === ','; | ||
/** | ||
* @param {valueParser.Node} node | ||
* @return {boolean} | ||
*/ | ||
function isVariableFunctionNode(node) { | ||
@@ -31,2 +39,6 @@ if (node.type !== 'function') { | ||
/** | ||
* @param {valueParser.Node} node | ||
* @return {boolean} | ||
*/ | ||
function isMathFunctionNode(node) { | ||
@@ -39,2 +51,6 @@ if (node.type !== 'function') { | ||
/** | ||
* @param {valueParser.Node} node | ||
* @return {boolean} | ||
*/ | ||
function isNumberNode(node) { | ||
@@ -50,2 +66,6 @@ if (node.type !== 'word') { | ||
/** | ||
* @param {valueParser.Node} node | ||
* @return {boolean} | ||
*/ | ||
function isDimensionNode(node) { | ||
@@ -65,4 +85,9 @@ if (node.type !== 'word') { | ||
/** | ||
* @param {string} value | ||
* @return {string} | ||
*/ | ||
function transform(value) { | ||
const parsed = valueParser(value); | ||
/** @type {({start: number, end: number} | {start: null, end: null})[]} */ | ||
const ranges = []; | ||
@@ -159,3 +184,3 @@ let rangeIndex = 0; | ||
if (map.has(firstNode)) { | ||
nodes[0].value = map.get(firstNode); | ||
nodes[0].value = /** @type {string}*/ (map.get(firstNode)); | ||
} | ||
@@ -166,21 +191,23 @@ | ||
if (firstNode === 'center' && directionKeywords.has(secondNode)) { | ||
nodes[0].value = nodes[1].value = ''; | ||
if (secondNode !== null) { | ||
if (firstNode === 'center' && directionKeywords.has(secondNode)) { | ||
nodes[0].value = nodes[1].value = ''; | ||
if (horizontal.has(secondNode)) { | ||
nodes[2].value = horizontal.get(secondNode); | ||
if (horizontal.has(secondNode)) { | ||
nodes[2].value = /** @type {string} */ (horizontal.get(secondNode)); | ||
} | ||
return; | ||
} | ||
return; | ||
} | ||
if (horizontal.has(firstNode) && verticalValue.has(secondNode)) { | ||
nodes[0].value = horizontal.get(firstNode); | ||
nodes[2].value = verticalValue.get(secondNode); | ||
if (horizontal.has(firstNode) && verticalValue.has(secondNode)) { | ||
nodes[0].value = /** @type {string} */ (horizontal.get(firstNode)); | ||
nodes[2].value = /** @type {string} */ (verticalValue.get(secondNode)); | ||
return; | ||
} else if (verticalValue.has(firstNode) && horizontal.has(secondNode)) { | ||
nodes[0].value = horizontal.get(secondNode); | ||
nodes[2].value = verticalValue.get(firstNode); | ||
return; | ||
} else if (verticalValue.has(firstNode) && horizontal.has(secondNode)) { | ||
nodes[0].value = /** @type {string} */ (horizontal.get(secondNode)); | ||
nodes[2].value = /** @type {string} */ (verticalValue.get(firstNode)); | ||
return; | ||
return; | ||
} | ||
} | ||
@@ -192,2 +219,6 @@ }); | ||
/** | ||
* @type {import('postcss').PluginCreator<void>} | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function pluginCreator() { | ||
@@ -194,0 +225,0 @@ return { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9007
5
206
0