mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
2.5 KiB
Plaintext
1 line
2.5 KiB
Plaintext
|
{"version":3,"file":"index.cjs.js","sources":["index.js"],"sourcesContent":["import postcss from 'postcss';\nimport parser from 'postcss-values-parser';\n\nconst placeMatch = /^place-(content|items|self)/;\n\nexport default postcss.plugin('postcss-place', opts => {\n\t// prepare options\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.prefix) : true;\n\n\treturn root => {\n\t\t// walk each matching declaration\n\t\troot.walkDecls(placeMatch, decl => {\n\t\t\t// alignment\n\t\t\tconst alignment = decl.prop.match(placeMatch)[1];\n\n\t\t\t// value ast and child nodes\n\t\t\tconst value = parser(decl.value).parse();\n\t\t\tconst children = value.nodes[0].nodes;\n\n\t\t\t// new justify-[alignment] and align-[alignment] declarations\n\t\t\tconst alignValue = children.length === 1 ? decl.value : String(children.slice(0, 1)).trim();\n\t\t\tconst justifyValue = children.length === 1 ? decl.value : String(children.slice(1)).trim();\n\n\t\t\tdecl.cloneBefore({\n\t\t\t\tprop: `align-${alignment}`,\n\t\t\t\tvalue: alignValue\n\t\t\t});\n\n\t\t\tdecl.cloneBefore({\n\t\t\t\tprop: `justify-${alignment}`,\n\t\t\t\tvalue: justifyValue\n\t\t\t});\n\n\t\t\t// conditionally remove place-[alignment]\n\t\t\tif (!preserve) {\n\t\t\t\tdecl.remove();\n\t\t\t}\n\t\t});\n\t};\n});\n"],"names":["placeMatch","postcss","plugin","opts","preserve","Object","Boolean","prefix","root","walkDecls","decl","alignment","prop","match","value","parser","parse","children","nodes","alignValue","length","String","slice","trim","justifyValue","cloneBefore","remove"],"mappings":";;;;;;;AAGA,MAAMA,UAAU,GAAG,6BAAnB;AAEA,YAAeC,OAAO,CAACC,MAAR,CAAe,eAAf,EAAgCC,IAAI,IAAI;;QAEhDC,QAAQ,GAAG,cAAcC,MAAM,CAACF,IAAD,CAApB,GAA6BG,OAAO,CAACH,IAAI,CAACI,M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