UNPKG

@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) 4.32 kB
!function(e,t){if("function"==typeof define&&define.amd)define([],t);else if("undefined"!=typeof exports)t();else{t(),e.unknown={}}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(){var e="keyword",t="comment",n="selector",r="prop",i="prolog",s="string",a="number",o="function",c="operator",l="bracket",u="delimiter",f="space";function d(e){return null!==e&&"object"==typeof e}function m(e){return void 0===e}function p(e,t){if(e)for(var n=Object.keys(e),r=0;r<n.length;r++)t(e[n[r]],n[r])}var b,g=/[+-]?(\d+\.?\d*|\d*\.?\d+)([eE][+-]?\d+)?/,S=/\b(?:true|false)\b/,y=/[[\]{}()]/,k=/[ \t]+/,h=/'(?:\\'|.)*?'/,w=/"(?:\\"|.)*?"/,x=/\/\*[\s\S]*?(\*\/|$)/,v=/\/\/.*/,A=/\b(?:break|catch|class|continue|do|else|extends|finally|for|function|if|implements|in|instanceof|interface|new|null|return|throw|try|while)\b/;function F(){return{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:[[s,/(["'])[\s\S]*?(?:(?!\\)[\s\S])\1/],[t,x],[f,k]],block:[["#inner",/{/,"@rest"],[l,/}/,"@break"],["#findAtrule"],["#findSelector"],[f,k]],inner:[[l,/{/],["#common"],["#findBlock"],["#props"],["#findAtrule"],["",/}/,"@back"]],atrule:[["#common"],["#url",/\burl\(/,"@rest"],[f,k],["atrule",/[^\s();]+/],[u,/[:;,]/],["#paren",/\(/,"@rest"]],paren:[[l,/^\(/],["#common"],["#paren",/\(/,"@rest"],[l,/\)/,"@break"],["#props"]],selector:[["#common"],[c,/[>+~]/],[l,/[[\]()]/],[u,/=/],[n,/::?\S+/],[n,/[\W\d]\S+/],["tag",/\b[a-z]+|\*/i],[n,/\S+/]],url:[["#common"],[o,/^url/],[l,/\(/],[s,/[^)]+/],[l,/\)/,"@break"]],props:[[r,/[a-z0-9-_\xA0-\uFFFF]+(?=:)/i],["#url",/\burl\(/,"@rest"],[o,/\b[\w-]+(?=\()\b/],[e,/!important|\b(?:initial|inherit|unset)/],[r,/[a-z0-9-]+(?=:)/],[a,/#([0-9a-f]{6}|[0-9a-f]{3})/i],[a,/\bU\+[0-9a-f?-]+/i],[a,/[+-]?(\d+\.?\d*|\d*\.?\d+)/],[u,/[:;,]/],["#paren",/\(/,"@rest"],[l,/[[\])]/],[f,k]]}}}function $(){return{id:"javascript",name:"JavaScript",alias:["js"],source:{func:/[_$a-z\xA0-\uFFFF][_$a-z0-9\xA0-\uFFFF]*/},grammar:{main:[[s,h],[s,w],["#backtick",/`/,"@rest"],[t,x],[t,v],["regexp",/\/(\[.*?]|\\\/|.)+?\/[gimsuy]*/],[e,A],[e,/\b(?:as|async|await|case|catch|const|debugger|default|delete|enum|export|from|import|let|package|private|protected|public|super|switch|static|this|typeof|undefined|var|void|with|yield)\b/],[e,/\b((get|set)(?=\s+%func))/i],["class",/\b[A-Z][\w$]*\b/],[o,/%func(?=\s*\()/i],["boolean",S],["decorator",/@[^\s(@]+/],["identifier",/\b[a-z_$][\w$]*\b/],[a,g],[c,/=>/],[c,/\+[+=]?|-[-=]?|\*\*?=?|[/%^]=?|&&?=?|\|\|?=?|\?\??=?|<<?=?|>>>=?|>>?=?|[!=]=?=?|[~:^]/],[l,y],[u,/[;.,]+/],[f,k]],backtick:[[s,/^`/],[s,/(\$[^{]|\\[$`]|[^`$])+/],["#expression",/\${/,"@rest"],[s,/`/,"@break"]],expression:[[u,/^\${/],[u,/}/,"@break"],["#main"]]}}}function z(e){void 0===e&&(e={});var n=(e.script||$)(),r=(e.style||F)(),s=["cdata",/<!\[CDATA\[[\s\S]*\]\]>/i];return n.grammar.main.unshift(s),r.grammar.main.unshift(s),{id:"html",alias:["markup"],name:"HTML",use:{script:n,style:r},grammar:{main:[[t,/<!\x2D\x2D[\s\S]*?\x2D\x2D>/],[i,/<!DOCTYPE[\s\S]*?>/i],s,["#script",/<script[\s\S]*?>[\s\S]*?<\/script>/],["#style",/<style[\s\S]*?>[\s\S]*?<\/style>/],["#tag",/<[\s\S]*?>/],["entity",/&[\da-z]+;|&#\d+;/i],[f,k]],script:[["#tag",/^<script[\s\S]*?>/],s,["@script",/[\s\S]+(?=<\/script>)/],["#tag",/<\/script>/]],style:[["#tag",/^<style[\s\S]*?>/],["@style",/[\s\S]+(?=<\/style>)/],["#tag",/<\/style>/]],tag:[["#closeTag",/<\/.+>/],["#tagContent"]],closeTag:[["tag.close",/[^\s/<>"'=]+/],["#tagContent"]],tagContent:[["#attr",/[\t\n\r ]+[\s\S]+(?=[\t\n\r \/>])/],["tag",/[^\s/<>"'=]+/],[l,/[<>]/],[u,/[/]/]],attr:[[f,k],["value",/(['"])(\\\1|.)*?\1/],[u,/[/=]/],["attr",/[^\s/>"'=]+/]]}}}"undefined"!=typeof window&&window.RyuseiLight&&window.RyuseiLight.register(((b=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach((function(t){d(t)&&p(t,(function(n,r){m(t[r])||(e[r]=t[r])}))})),e}(z(),{id:"xml",name:"XML",alias:[]})).grammar.main.unshift([i,/<\?[\s\S]*?\?>/]),b))}));