katoikia-app/web-ui/web-react/node_modules/postcss-image-set-function/index.cjs.js.map

1 line
10 KiB
Plaintext
Raw Normal View History

2022-07-06 04:15:11 +00:00
{"version":3,"file":"index.cjs.js","sources":["lib/get-comma.js","lib/get-image.js","lib/get-media.js","lib/handle-invalidation.js","lib/process-image-set.js","index.js"],"sourcesContent":["// return whether a node is a valid comma\nexport default node => Object(node).type === 'comma';\n","const imageSetFunctionMatchRegExp = /^(-webkit-)?image-set$/i\n\n// return a valid image\nexport default node =>\n\t// <url> | <image()> | <cross-fade()> | <gradient>\n\t// the image-set() function can not be nested inside of itself\n\tObject(node).type === 'func' && /^(cross-fade|image|(repeating-)?(conic|linear|radial)-gradient|url)$/i.test(node.value) && !(\n\t\tnode.parent.parent && node.parent.parent.type === 'func' && imageSetFunctionMatchRegExp.test(node.parent.parent.value)\n\t)\n\t? String(node)\n: Object(node).type === 'string'\n\t? node.value\n: false;\n","import postcss from 'postcss';\n\nconst dpiRatios = { dpcm: 2.54, dpi: 1, dppx: 96, x: 96 };\n\n// return a valid @media rule\nexport default (node, mediasByDpr) => {\n\tif (Object(node).type === 'number' && node.unit in dpiRatios) {\n\t\t// calculate min-device-pixel-ratio and min-resolution\n\t\tconst dpi = Number(node.value) * dpiRatios[node.unit.toLowerCase()];\n\t\tconst dpr = Math.floor(dpi / dpiRatios.x * 100) / 100;\n\n\t\tif (dpi in mediasByDpr) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\tconst media = mediasByDpr[dpi] = postcss.atRule({\n\t\t\t\tname: 'media',\n\t\t\t\tparams: `(-webkit-min-device-pixel-ratio: ${dpr}), (min-resolution: ${dpi}dpi)`\n\t\t\t});\n\n\t\t\treturn media;\n\t\t}\n\t} else {\n\t\treturn false;\n\t}\n};\n","export default (opts, message, word) => {\n\tif (opts.oninvalid === 'warn') {\n\t\topts.decl.warn(opts.result, message, { word: String(word) });\n\t} else if (opts.oninvalid === 'throw') {\n\t\tthrow opts.decl.error(message, { word: String(word) });\n\t}\n};\n","import getComma from './get-comma';\nimport getImage from './get-image';\nimport getMedia from './get-media';\nimport handleInvalidation from './handle-invalidation';\n\nexport default (imageSetOptionNodes, decl, opts) => {\n\tconst parent = decl.parent;\n\tconst mediasByDpr = {};\n\n\tlet length = imageSetOptionNodes.length;\n\tlet index = -1;\n\n\twhile (index < length) {\n\t\tconst [comma, value, media] = [\n\t\t\tindex < 0 ? true : getComma(imageSetOptionNodes[index]),\n\t\t\tgetImage(imageSetOptionNodes[index + 1]),\n\t\t\tgetMedia(imageSetOptionNodes[index + 2], mediasByDpr)\n\t\t];\n\n\t\t// handle invalidations\n\t\tif (!comma) {\n\t\t\treturn handleInvalidation(opts, 'unexpected comma', imageSetOptionNodes[index]);\n\t\t} else if (!value) {\n\t\t\treturn handleInvalidation(opts, 'unexpected image', imageSetOptionNodes[index + 1]);\n\t\t} else if (!media) {\n\t\t\treturn handleInvalidation(opts, 'unexpected resolution', imageSetOptionNodes[index + 2]);\n\t\t}\n\n\t\t// prepare @media { decl: <image> }\n\t\tconst parentClone = parent.clone().removeAll();\n\t\tconst declClone = decl.clone({ value });\n\n\t\tparentClone.append(declClone);\n\t\tmedia.append(parentClone);\n\n\t\tindex += 3\n\t}\n\n\tconst medias = Object.keys(mediasByDpr).sort((a, b) => a - b).map(params => mediasByDpr[params]);\n\n\t// conditionally prepend previous siblings\n\tif (medias.length) {\n\t\tconst firstDecl = medias[0].nodes[0].nodes[0];\n\n\t\tif (medias.length === 1) {\n\t\t\tdecl.value = firstDecl.value\n\t\t} else {\n\t\t\tconst siblings = parent.nodes;\n\t\t\tconst previousSiblings = siblings.slice(0, siblings.indexOf(decl)).concat(firstDecl);\n\n\t\t\tif (previousSiblings.length) {\n\t\t\t\tconst parentClone = parent.cloneBefore().removeAll();\n\n\t\t\t\tparentClone.append(previousSiblings);\n\t\t\t}\n\n\t\t\t// prepend any @media { decl: <image> } rules\n\t\t\tparent.before(medias.slice(1));\n\n\t\t\t// conditionally remove the current rule\n\t\t\tif (!opts.preserve) {\n\t\t\t\tdecl.remove();\n\n\t\t\t\t// and then conditionally remove its parent\n\t\t\t\tif (!parent.nodes.length) {\n\t\t\t\t\tparent.remove();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import postcss from 'postcss';\nimport v