mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
3.9 KiB
Plaintext
1 line
3.9 KiB
Plaintext
|
{"version":3,"file":"index.cjs.js","sources":["index.js"],"sourcesContent":["import postcss from 'postcss';\nimport parser from 'postcss-selector-parser';\n\nconst anyAnyLinkMatch = /:any-link/;\n\nexport default postcss.plugin('postcss-pseudo-class-any-link', opts => {\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;\n\n\treturn root => {\n\t\t// walk each matching rule\n\t\troot.walkRules(anyAnyLinkMatch, rule => {\n\t\t\tconst rawSelector = rule.raws.selector && rule.raws.selector.raw || rule.selector;\n\n\t\t\t// workaround for https://github.com/postcss/postcss-selector-parser/issues/28#issuecomment-171910556\n\t\t\tif (rawSelector[rawSelector.length - 1] !== ':') {\n\t\t\t\t// update the selector\n\t\t\t\tconst updatedSelector = parser(selectors => {\n\t\t\t\t\t// cache variables\n\t\t\t\t\tlet node;\n\t\t\t\t\tlet nodeIndex;\n\t\t\t\t\tlet selector;\n\t\t\t\t\tlet selectorLink;\n\t\t\t\t\tlet selectorVisited;\n\n\t\t\t\t\t// cache the selector index\n\t\t\t\t\tlet selectorIndex = -1;\n\n\t\t\t\t\t// for each selector\n\t\t\t\t\twhile (selector = selectors.nodes[++selectorIndex]) {\n\t\t\t\t\t\t// reset the node index\n\t\t\t\t\t\tnodeIndex = -1;\n\n\t\t\t\t\t\t// for each node\n\t\t\t\t\t\twhile (node = selector.nodes[++nodeIndex]) {\n\t\t\t\t\t\t\t// if the node value matches the any-link value\n\t\t\t\t\t\t\tif (node.value === ':any-link') {\n\t\t\t\t\t\t\t\t// clone the selector\n\t\t\t\t\t\t\t\tselectorLink = selector.clone();\n\t\t\t\t\t\t\t\tselectorVisited = selector.clone();\n\n\t\t\t\t\t\t\t\t// update the matching clone values\n\t\t\t\t\t\t\t\tselectorLink.nodes[nodeIndex].value = ':link';\n\t\t\t\t\t\t\t\tselectorVisited.nodes[nodeIndex].value = ':visited';\n\n\t\t\t\t\t\t\t\t// replace the selector with the clones and roll back the selector index\n\t\t\t\t\t\t\t\tselectors.nodes.splice(selectorIndex--, 1, selectorLink, selectorVisited);\n\n\t\t\t\t\t\t\t\t// stop updating the selector\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}).processSync(rawSelector);\n\n\t\t\t\tif (updatedSelector !== rawSelector) {\n\t\t\t\t\tif (preserve) {\n\t\t\t\t\t\trule.cloneBefore({\n\t\t\t\t\t\t\tselector: updatedSelector\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\trule.selector = updatedSelector;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t};\n});\n"],"names":["anyAnyLinkMatch","postcss","plugin","opts","preserve","Object","Boolean","root","walkRules","rule","rawSelector","raws","selector","raw","length","updatedSelector","parser","selectors","node","nodeIndex","selectorLink","selectorVisited","selectorIndex","nodes","value","clone","splice","processSync","cloneBefore"],"mappings":";;;;;;;AAGA,MAAMA,eAAe,GAAG,WAAxB;AAEA,YAAeC,OAAO,CAACC,MAAR,CAAe,+BAAf,EAAgDC,IAAI,IAAI;QAChEC,QAAQ,GAAG,cAAcC,MAAM,CAACF,IAAD,CAApB,GAA6BG,OAAO,CAACH,IAAI,CAACC,QAAN,CAApC,GAAsD,IAAvE;SAEOG,IAAI,IAAI;;IAEdA,IAAI,CAACC,SAAL,CAAeR,eAAf,EAAgCS,IAAI,IAAI;YACjCC,WAAW,GAAGD,IAAI,CAACE,IAAL,CAAUC,QAAV,IAAsBH,IAAI,CAACE,IAAL,CAAUC,QAAV,CAAmBC,GAAzC,IAAgDJ,IAAI,CAACG,QAAzE,CADuC;;UAInCF,WAAW,CAACA,WAAW,CAACI,MAAZ,GAAqB,CAAtB,CAAX,KAAwC,GAA5C,EAAiD;;cAE1CC,eAAe,GAAGC,MAAM,CAACC,S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