@ryusei/light
Version:
<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
2 lines (1 loc) • 3.57 kB
JavaScript
!function(e,n){if("function"==typeof define&&define.amd)define([],n);else if("undefined"!=typeof exports)n();else{n(),e.unknown={}}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(){var e,n,r="comment",t="selector",i="prop",o="string",s="number",u="function",l="operator",f="bracket",a="delimiter",c="space",d=/[ \t]+/,p=/\/\*[\s\S]*?(\*\/|$)/,S=/\/\/.*/;function m(e){return null!==e&&"object"==typeof e}function b(e){return void 0===e}function g(e,n){if(e)for(var r=Object.keys(e),t=0;t<r.length;t++)n(e[r[t]],r[t])}function k(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),t=1;t<n;t++)r[t-1]=arguments[t];return r.forEach((function(n){m(n)&&g(n,(function(r,t){b(n[t])||(e[t]=n[t])}))})),e}function y(e,n,r){var t=function(e,n){for(var r=0;r<e.length;r++)if(e[r][0]===n)return r;return-1}(e,n);t>-1?e.splice.apply(e,[t,0].concat(r)):e.push.apply(e,r)}"undefined"!=typeof window&&window.RyuseiLight&&window.RyuseiLight.register((e=k({id:"css",name:"CSS",grammar:{main:[["#common"],["#findSingleAtrule"],["#findBlock"]],findBlock:[["#block",/(?:(?![\t\n\r ;\{\}])[\s\S])(?:(?![;\{\}])[\s\S])*\{[\s\S]*?\}/,"@rest"]],findSingleAtrule:[["#atrule",/@(?:(?![;\{])[\s\S])+?;/]],findAtrule:[["#atrule",/@(?:(?![;\{])[\s\S])*?(?=[;\{])/]],findSelector:[["#selector",/(?:(?![\t\n\r ;\{\}])[\s\S])[\s\S]*?(?=\{)/]],common:[[o,/(["'])[\s\S]*?(?:(?!\\)[\s\S])\1/],[r,p],[c,d]],block:[["#inner",/{/,"@rest"],[f,/}/,"@break"],["#findAtrule"],["#findSelector"],[c,d]],inner:[[f,/{/],["#common"],["#findBlock"],["#props"],["#findAtrule"],["",/}/,"@back"]],atrule:[["#common"],["#url",/\burl\(/,"@rest"],[c,d],["atrule",/[^\s();]+/],[a,/[:;,]/],["#paren",/\(/,"@rest"]],paren:[[f,/^\(/],["#common"],["#paren",/\(/,"@rest"],[f,/\)/,"@break"],["#props"]],selector:[["#common"],[l,/[>+~]/],[f,/[[\]()]/],[a,/=/],[t,/::?\S+/],[t,/[\W\d]\S+/],["tag",/\b[a-z]+|\*/i],[t,/\S+/]],url:[["#common"],[u,/^url/],[f,/\(/],[o,/[^)]+/],[f,/\)/,"@break"]],props:[[i,/[a-z0-9-_\xA0-\uFFFF]+(?=:)/i],["#url",/\burl\(/,"@rest"],[u,/\b[\w-]+(?=\()\b/],["keyword",/!important|\b(?:initial|inherit|unset)/],[i,/[a-z0-9-]+(?=:)/],[s,/#([0-9a-f]{6}|[0-9a-f]{3})/i],[s,/\bU\+[0-9a-f?-]+/i],[s,/[+-]?(\d+\.?\d*|\d*\.?\d+)/],[a,/[:;,]/],["#paren",/\(/,"@rest"],[f,/[[\])]/],[c,d]]}},{id:"scss",name:"SCSS"}),k(n=e.grammar,{findBlock:[["#block",/([\*-_a-z]|#\{(?:(?!;)[\s\S])*?\}|((#\{(?:(?!;)[\s\S])*?\}|(?:(?![\t-\r ;\{\}\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])[\s\S]))(#\{(?:(?!;)[\s\S])*?\}|(?:(?![#;\{\}])[\s\S])|#(?:(?!\{)[\s\S]))+?))(?!#)\{[\s\S]*?\}/i,"@rest"]],findSingleAtrule:[["#atrule",/@(#\{|(?:(?![;\{])[\s\S]))+?;/]],findAtrule:[["#atrule",/@(#\{|(?:(?![;\{])[\s\S]))*?(?=[;\{])/]],findSelector:[["#selector",/(?:(?!;)[\s\S])*?(?:(?!#)[\s\S])(?=\{)/,""]],findInterp:[["#interp",/#{/,"@rest"]],common:[["#string"],[r,p],[r,S],[a,/;/],[c,d]],string:[["#singleQuote",/'/,"@rest"],["#doubleQuote",/"/,"@rest"]],singleQuote:[[o,/^'/],["#findInterp"],[o,/(\\'|#[^{]|[^'#])+/],[o,/'/,"@break"]],doubleQuote:[[o,/^"/],["#findInterp"],[o,/(\\"|#[^{]|[^"#])+/],[o,/"/,"@break"]],selector:[["#common"],["#findInterp"],[l,/[>+~]/],[f,/[[\]()]/],[a,/=/],[t,/::?\S+(?=#{)/],[t,/[\W\d]\S+(?=#{)/],["tag",/\b[a-zA-Z]+\b|\*/],[t,/([^#\s]|#[^{\s])+/]],url:[["#common"],["#findInterp"],[u,/^url/],[f,/\(/],[o,/[^)]+(?=#{)/],[o,/[^)]+/],[f,/\)/,"@break"]],interp:[[a,/#{/],[a,/}/,"@break"],["#common"],["#props"]]}),n.inner.unshift(["#findInterp"]),y(n.atrule,"#url",[["#findInterp"]]),y(n.props,i,[["#findInterp"],["variable",/\$[\w-_]+/]]),e))}));