You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
56 KiB

4 years ago
{"version":3,"file":"index.es.mjs","sources":["lib/clone-rule.js","lib/transform-border.js","lib/transform-float.js","lib/transform-inset.js","lib/transform-resize.js","lib/match-side.js","lib/match-inset-prefix.js","lib/clone-decl.js","lib/transform-side.js","lib/match-size.js","lib/transform-size.js","lib/transform-spacing.js","lib/transform-text-align.js","lib/split.js","lib/transform-transition.js","lib/match-supported-properties.js","index.js"],"sourcesContent":["import postcss from 'postcss';\n\nexport default (decl, dir) => {\n\tconst rule = Object(decl.parent).type === 'rule' ? decl.parent.clone({\n\t\traws: {}\n\t}).removeAll() : postcss.rule({ selector: '&' });\n\n\trule.selectors = rule.selectors.map(selector => `${selector}:dir(${dir})`);\n\n\treturn rule;\n};\n","import cloneRule from './clone-rule';\n\nconst matchLogical = /^\\s*logical\\s+/i;\nconst matchLogicalBorder = /^border(-width|-style|-color)?$/i;\nconst matchLogicalBorderSide = /^border-(block|block-start|block-end|inline|inline-start|inline-end|start|end)(-(width|style|color))?$/i;\n\nexport default {\n\t// border\n\t'border': (decl, values, dir) => {\n\t\tconst isLogical = matchLogical.test(values[0]);\n\n\t\tif (isLogical) {\n\t\t\tvalues[0] = values[0].replace(matchLogical, '');\n\t\t}\n\n\t\tconst ltrDecls = [\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-top${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-left${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[1] || values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-bottom${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[2] || values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-right${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[3] || values[1] || values[0]\n\t\t\t})\n\t\t];\n\n\t\tconst rtlDecls = [\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-top${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-right${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[1] || values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-bottom${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[2] || values[0]\n\t\t\t}),\n\t\t\tdecl.clone({\n\t\t\t\tprop: `border-left${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\tvalue: values[3] || values[1] || values[0]\n\t\t\t})\n\t\t];\n\n\t\treturn isLogical ? 1 === values.length\n\t\t\t? decl.clone({\n\t\t\t\tvalue: decl.value.replace(matchLogical, '')\n\t\t\t})\n\t\t\t: !values[3] || values[3] === values[1]\n\t\t\t\t? [\n\t\t\t\t\tdecl.clone({\n\t\t\t\t\t\tprop: `border-top${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\t\t\tvalue: values[0]\n\t\t\t\t\t}),\n\t\t\t\t\tdecl.clone({\n\t\t\t\t\t\tprop: `border-right${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\t\t\tvalue: values[3] || values[1] || values[0]\n\t\t\t\t\t}),\n\t\t\t\t\tdecl.clone({\n\t\t\t\t\t\tprop: `border-bottom${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\t\t\tvalue: values[2] || values[0]\n\t\t\t\t\t}),\n\t\t\t\t\tdecl.clone({\n\t\t\t\t\t\tprop: `border-left${decl.prop.replace(matchLogicalBorder, '$1')}`,\n\t\t\t\t\t\tvalue: values[1] || values[0]\n\t\t\t\t\t})\n\t\t\t\t]\n\t\t\t\t: 'ltr' === dir ? ltrDecls : 'rtl' === dir ? rtlDecls : [\n\t\t\t\t\tcloneRule(decl, 'ltr').append(ltrDecls),\n\t\t\t\t\tcloneRule(decl, 'rtl').append(rtlDecls)\n\t\t\t\t]\n\t\t\t: null;\n\t},\n\n\t// border-block\n\t'border-block': (decl, values) => [\n\t\tdecl.clone({\n\t\t\tprop: `border-top${decl.prop.replace(matchLogicalBorderSide, '$2')}`,\n\t\t\tvalue: values[0]\n\t\t}),\n\t\tdecl.clone({\n\t\t\tprop: `border-bottom${decl.prop.replace(matchLogicalBorderSide, '$2')}`,\n\t\t\tvalue: values[0]\n\t\t})\n\t],\n\n\t// border-block-start\n\t'border-block-start': decl => {\n\t\tdecl.prop = 'border-top';\n\t},\n\n\t// border-block-end\n\t'border-block-end': decl => {\n\t\tdecl.prop = 'border-bottom';\n\t},