{"version":3,"file":"index.cjs","sources":["../src/index.js"],"sourcesContent":["// overflow shorthand property matcher\nconst overflowPropertyRegExp = /^overflow/i;\n\nfunction onCSSDeclaration(postcssList, decl, preserve) {\n\t// split the declaration values\n\tconst [overflowX, overflowY, ...invalidatingValues] = postcssList.space(decl.value);\n\n\t// if there are two values, but no invalidating values\n\tif (overflowY && !invalidatingValues.length) {\n\t\t// insert the overflow-* longhand declarations\n\t\tdecl.cloneBefore({\n\t\t\tprop: `${decl.prop}-x`,\n\t\t\tvalue: overflowX,\n\t\t});\n\n\t\tdecl.cloneBefore({\n\t\t\tprop: `${decl.prop}-y`,\n\t\t\tvalue: overflowY,\n\t\t});\n\n\t\t// conditionally remove the original declaration\n\t\tif (!preserve) {\n\t\t\tdecl.remove();\n\t\t}\n\t}\n}\n\nconst creator = opts => {\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;\n\n\treturn {\n\t\tpostcssPlugin: 'postcss-overflow-shorthand',\n\t\tDeclaration: (decl, { list }) => {\n\t\t\tif (overflowPropertyRegExp.test(decl)) {\n\t\t\t\tonCSSDeclaration(list, decl, preserve);\n\t\t\t}\n\t\t},\n\t};\n};\n\ncreator.postcss = true;\n\nexport default creator;\n"],"names":["overflowPropertyRegExp","creator","opts","preserve","Object","Boolean","postcssPlugin","Declaration","decl","list","test","postcssList","overflowX","overflowY","invalidatingValues","space","value","length","cloneBefore","prop","remove","onCSSDeclaration","postcss"],"mappings":"aACA,MAAMA,EAAyB,mBA0BzBC,EAAUC,UACTC,IAAW,aAAcC,OAAOF,KAAQG,QAAQH,EAAKC,gBAEpD,CACNG,cAAe,6BACfC,YAAa,CAACC,GAAQC,KAAAA,MACjBT,EAAuBU,KAAKF,IA9BnC,SAA0BG,EAAaH,EAAML,SAErCS,EAAWC,KAAcC,GAAsBH,EAAYI,MAAMP,EAAKQ,OAGzEH,IAAcC,EAAmBG,SAEpCT,EAAKU,YAAY,CAChBC,KAAO,GAAEX,EAAKW,SACdH,MAAOJ,IAGRJ,EAAKU,YAAY,CAChBC,KAAO,GAAEX,EAAKW,SACdH,MAAOH,IAIHV,GACJK,EAAKY,UAYJC,CAAiBZ,EAAMD,EAAML,MAMjCF,EAAQqB,SAAU"}