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