物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
26 KiB

  1. function w(o){o={...ne,...o};var l=o.inline,m=o.tokenHooks,f=o.documentTypes||{},G=o.mediaTypes||{},J=o.mediaFeatures||{},Q=o.mediaValueKeywords||{},A=o.propertyKeywords||{},T=o.nonStandardPropertyKeywords||{},R=o.fontProperties||{},ee=o.counterDescriptors||{},F=o.colorKeywords||{},N=o.valueKeywords||{},b=o.allowNested,te=o.lineComment,re=o.supportsAtComponent===!0,$=o.highlightNonStandardPropertyKeywords!==!1,y,a;function c(e,r){return y=r,e}function oe(e,r){var t=e.next();if(m[t]){var i=m[t](e,r);if(i!==!1)return i}if(t=="@")return e.eatWhile(/[\w\\\-]/),c("def",e.current());if(t=="="||(t=="~"||t=="|")&&e.eat("="))return c(null,"compare");if(t=='"'||t=="'")return r.tokenize=L(t),r.tokenize(e,r);if(t=="#")return e.eatWhile(/[\w\\\-]/),c("atom","hash");if(t=="!")return e.match(/^\s*\w*/),c("keyword","important");if(/\d/.test(t)||t=="."&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),c("number","unit");if(t==="-"){if(/[\d.]/.test(e.peek()))return e.eatWhile(/[\w.%]/),c("number","unit");if(e.match(/^-[\w\\\-]*/))return e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?c("def","variable-definition"):c("variableName","variable");if(e.match(/^\w+-/))return c("meta","meta")}else return/[,+>*\/]/.test(t)?c(null,"select-op"):t=="."&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?c("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(t)?c(null,t):e.match(/^[\w-.]+(?=\()/)?(/^(url(-prefix)?|domain|regexp)$/i.test(e.current())&&(r.tokenize=ie),c("variableName.function","variable")):/[\w\\\-]/.test(t)?(e.eatWhile(/[\w\\\-]/),c("property","word")):c(null,null)}function L(e){return function(r,t){for(var i=!1,d;(d=r.next())!=null;){if(d==e&&!i){e==")"&&r.backUp(1);break}i=!i&&d=="\\"}return(d==e||!i&&e!=")")&&(t.tokenize=null),c("string","string")}}function ie(e,r){return e.next(),e.match(/^\s*[\"\')]/,!1)?r.tokenize=null:r.tokenize=L(")"),c(null,"(")}function W(e,r,t){this.type=e,this.indent=r,this.prev=t}function s(e,r,t,i){return e.context=new W(t,r.indentation()+(i===!1?0:r.indentUnit),e.context),t}function p(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function k(e,r,t){return n[t.context.type](e,r,t)}function h(e,r,t,i){for(var d=i||1;d>0;d--)t.context=t.context.prev;return k(e,r,t)}function H(e){var r=e.current().toLowerCase();N.hasOwnProperty(r)?a="atom":F.hasOwnProperty(r)?a="keyword":a="variable"}var n={};return n.top=function(e,r,t){if(e=="{")return s(t,r,"block");if(e=="}"&&t.context.prev)return p(t);if(re&&/@component/i.test(e))return s(t,r,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return s(t,r,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return s(t,r,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return t.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&e.charAt(0)=="@")return s(t,r,"at");if(e=="hash")a="builtin";else if(e=="word")a="tag";else{if(e=="variable-definition")return"maybeprop";if(e=="interpolation")return s(t,r,"interpolation");if(e==":")return"pseudo";if(b&&e=="(")return s(t,r,"parens")}return t.context.type},n.block=function(e,r,t){if(e=="word"){var i=r.current().toLowerCase();return A.hasOwnProperty(i)?(a="property","maybeprop"):T.hasOwnProperty(i)?(a=$?"string.special":"property","maybeprop"):b?(a=r.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(a="error","maybeprop")}else return e=="meta"?"block":!b&&(e=="hash"||e=="qualifier")?(a="error","block"):n.top(e,r,t)},n.maybeprop=function(e,r,t){return e==":"?s(t,r,"prop"):k(e,r,t)},n.prop=function(e,r,t){if(e==";")return p(t);if(e=="{"&&b)return s(t,r,"propBlock");if(e=="}"||e=="{")return h(e,r,t);if(e=="(")return s(t,r,"parens");if(e=="hash"&&!/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(r.current()))a="error";else if(e=="word")H(r);else if(e=="interpolation")return s(t,r,"interpolation");return"prop"},n.propBlock=function(e,r,t){return e=="}"?p(t):e=="word"?(a="property","maybeprop"):t.context.type},n.parens=function(e,r,t){return e=="{"||e=="}"?h(e,r,t):e==")"?p(t):e=="("?s(t,r,"parens"):e=="interpolation"?s(t,r,"interpolation"):(e=="word"