From 939bbf9e7675127391b88b5d372e9f1f1031de00 Mon Sep 17 00:00:00 2001 From: "asamuzaK (Kazz)" Date: Sat, 14 Dec 2024 09:31:06 +0900 Subject: [PATCH] v2.5.0 --- dist/cjs/css-color.min.cjs | 2 +- dist/cjs/css-color.min.cjs.map | 6 +++--- dist/esm/css-color.min.js | 2 +- dist/esm/css-color.min.js.map | 6 +++--- package.json | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/cjs/css-color.min.cjs b/dist/cjs/css-color.min.cjs index 814a163..b169392 100644 --- a/dist/cjs/css-color.min.cjs +++ b/dist/cjs/css-color.min.cjs @@ -1,4 +1,4 @@ -var Fr=Object.defineProperty;var rs=Object.getOwnPropertyDescriptor;var ns=Object.getOwnPropertyNames;var ss=Object.prototype.hasOwnProperty;var os=(e,t)=>{for(var r in t)Fr(e,r,{get:t[r],enumerable:!0})},is=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ns(t))!ss.call(e,s)&&s!==r&&Fr(e,s,{get:()=>t[s],enumerable:!(n=rs(t,s))||n.enumerable});return e};var as=e=>is(Fr({},"__esModule",{value:!0}),e);var ci={};os(ci,{convert:()=>ts,resolve:()=>Ct});module.exports=as(ci);var Ye=class extends Error{sourceStart;sourceEnd;parserState;constructor(t,r,n,s){super(t),this.name="ParseError",this.sourceStart=r,this.sourceEnd=n,this.parserState=s}},$e=class extends Ye{token;constructor(t,r,n,s,o){super(t,r,n,s),this.token=o}},Be={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},li=typeof globalThis<"u"&&"structuredClone"in globalThis;function fe(...e){let t="";for(let r=0;r=48&&e<=57}function us(e){return e>=65&&e<=90}function ls(e){return e>=97&&e<=122}function Ge(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function fs(e){return ls(e)||us(e)}function it(e){return fs(e)||hs(e)||e===95}function $r(e){return it(e)||ge(e)||e===te}function hs(e){return e===183||e===8204||e===8205||e===8255||e===8256||e===8204||192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||e===0||!!at(e)||e>=65536}function It(e){return e===st||e===nt||e===12}function qe(e){return e===32||e===st||e===9||e===nt||e===12}function at(e){return e>=55296&&e<=57343}function ct(e){return e.source.codePointAt(e.cursor)===92&&!It(e.source.codePointAt(e.cursor+1)??-1)}function Lt(e,t){return t.source.codePointAt(t.cursor)===te?t.source.codePointAt(t.cursor+1)===te||!!it(t.source.codePointAt(t.cursor+1)??-1)||t.source.codePointAt(t.cursor+1)===92&&!It(t.source.codePointAt(t.cursor+2)??-1):!!it(t.source.codePointAt(t.cursor)??-1)||ct(t)}function an(e){return e.source.codePointAt(e.cursor)===ot||e.source.codePointAt(e.cursor)===te?!!ge(e.source.codePointAt(e.cursor+1)??-1)||e.source.codePointAt(e.cursor+1)===46&&ge(e.source.codePointAt(e.cursor+2)??-1):e.source.codePointAt(e.cursor)===46?ge(e.source.codePointAt(e.cursor+1)??-1):ge(e.source.codePointAt(e.cursor)??-1)}function ps(e){return e.source.codePointAt(e.cursor)===47&&e.source.codePointAt(e.cursor+1)===42}function ds(e){return e.source.codePointAt(e.cursor)===te&&e.source.codePointAt(e.cursor+1)===te&&e.source.codePointAt(e.cursor+2)===62}var h,S,Wt;function cn(e){switch(e){case h.OpenParen:return h.CloseParen;case h.CloseParen:return h.OpenParen;case h.OpenCurly:return h.CloseCurly;case h.CloseCurly:return h.OpenCurly;case h.OpenSquare:return h.CloseSquare;case h.CloseSquare:return h.OpenSquare;default:return null}}function un(e){switch(e[0]){case h.OpenParen:return[h.CloseParen,")",-1,-1,void 0];case h.CloseParen:return[h.OpenParen,"(",-1,-1,void 0];case h.OpenCurly:return[h.CloseCurly,"}",-1,-1,void 0];case h.CloseCurly:return[h.OpenCurly,"{",-1,-1,void 0];case h.OpenSquare:return[h.CloseSquare,"]",-1,-1,void 0];case h.CloseSquare:return[h.OpenSquare,"[",-1,-1,void 0];default:return null}}function gs(e,t){for(t.advanceCodePoint(2);;){let r=t.readCodePoint();if(r===void 0){let n=[h.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new $e(Be.UnexpectedEOFInComment,t.representationStart,t.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],n)),n}if(r===42&&t.source.codePointAt(t.cursor)!==void 0&&t.source.codePointAt(t.cursor)===47){t.advanceCodePoint();break}}return[h.Comment,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0]}function zt(e,t){let r=t.readCodePoint();if(r===void 0)return e.onParseError(new Ye(Be.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),rt;if(Ge(r)){let n=[r],s;for(;(s=t.source.codePointAt(t.cursor))!==void 0&&Ge(s)&&n.length<6;)n.push(s),t.advanceCodePoint();qe(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===nt&&t.source.codePointAt(t.cursor+1)===st&&t.advanceCodePoint(),t.advanceCodePoint());let o=parseInt(String.fromCodePoint(...n),16);return o===0||at(o)||o>1114111?rt:o}return r===0||at(r)?rt:r}function Ut(e,t){let r=[];for(;;){let n=t.source.codePointAt(t.cursor)??-1;if(n===0||at(n))r.push(rt),t.advanceCodePoint(+(n>65535)+1);else if($r(n))r.push(n),t.advanceCodePoint(+(n>65535)+1);else{if(!ct(t))return r;t.advanceCodePoint(),r.push(zt(e,t))}}}function xs(e,t){t.advanceCodePoint();let r=t.source.codePointAt(t.cursor);if(r!==void 0&&($r(r)||ct(t))){let n=Wt.Unrestricted;Lt(0,t)&&(n=Wt.ID);let s=Ut(e,t);return[h.Hash,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...s),type:n}]}return[h.Delim,"#",t.representationStart,t.representationEnd,{value:"#"}]}function ms(e,t){let r=S.Integer;for(t.source.codePointAt(t.cursor)!==ot&&t.source.codePointAt(t.cursor)!==te||t.advanceCodePoint();ge(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===46&&ge(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint(2),r=S.Number;ge(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===101||t.source.codePointAt(t.cursor)===69){if(ge(t.source.codePointAt(t.cursor+1)??-1))t.advanceCodePoint(2);else{if(t.source.codePointAt(t.cursor+1)!==te&&t.source.codePointAt(t.cursor+1)!==ot||!ge(t.source.codePointAt(t.cursor+2)??-1))return r;t.advanceCodePoint(3)}for(r=S.Number;ge(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint()}return r}function Er(e,t){let r;{let o=t.source.codePointAt(t.cursor);o===te?r="-":o===ot&&(r="+")}let n=ms(0,t),s=parseFloat(t.source.slice(t.representationStart,t.representationEnd+1));if(Lt(0,t)){let o=Ut(e,t);return[h.Dimension,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:r,type:n,unit:String.fromCodePoint(...o)}]}return t.source.codePointAt(t.cursor)===37?(t.advanceCodePoint(),[h.Percentage,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:r}]):[h.Number,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s,signCharacter:r,type:n}]}function bs(e){for(;qe(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return[h.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}(function(e){e.Comment="comment",e.AtKeyword="at-keyword-token",e.BadString="bad-string-token",e.BadURL="bad-url-token",e.CDC="CDC-token",e.CDO="CDO-token",e.Colon="colon-token",e.Comma="comma-token",e.Delim="delim-token",e.Dimension="dimension-token",e.EOF="EOF-token",e.Function="function-token",e.Hash="hash-token",e.Ident="ident-token",e.Number="number-token",e.Percentage="percentage-token",e.Semicolon="semicolon-token",e.String="string-token",e.URL="url-token",e.Whitespace="whitespace-token",e.OpenParen="(-token",e.CloseParen=")-token",e.OpenSquare="[-token",e.CloseSquare="]-token",e.OpenCurly="{-token",e.CloseCurly="}-token",e.UnicodeRange="unicode-range-token"})(h||(h={})),function(e){e.Integer="integer",e.Number="number"}(S||(S={})),function(e){e.Unrestricted="unrestricted",e.ID="id"}(Wt||(Wt={}));var yr=class{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(t){this.source=t}advanceCodePoint(t=1){this.cursor=this.cursor+t,this.representationEnd=this.cursor-1}readCodePoint(){let t=this.source.codePointAt(this.cursor);if(t!==void 0)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,t}unreadCodePoint(t=1){this.cursor=this.cursor-t,this.representationEnd=this.cursor-1}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1}};function Cs(e,t){let r="",n=t.readCodePoint();for(;;){let s=t.readCodePoint();if(s===void 0){let o=[h.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}];return e.onParseError(new $e(Be.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(It(s)){t.unreadCodePoint();let o=[h.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new $e(Be.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===nt&&t.source.codePointAt(t.cursor+1)===st?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],o)),o}if(s===n)return[h.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}];if(s!==92)s===0||at(s)?r+=String.fromCodePoint(rt):r+=String.fromCodePoint(s);else{if(t.source.codePointAt(t.cursor)===void 0)continue;if(It(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===nt&&t.source.codePointAt(t.cursor+1)===st&&t.advanceCodePoint(),t.advanceCodePoint();continue}r+=String.fromCodePoint(zt(e,t))}}}function Fs(e){return!(e.length!==3||e[0]!==117&&e[0]!==85||e[1]!==114&&e[1]!==82||e[2]!==108&&e[2]!==76)}function wr(e,t){for(;;){let r=t.source.codePointAt(t.cursor);if(r===void 0)return;if(r===41)return void t.advanceCodePoint();ct(t)?(t.advanceCodePoint(),zt(e,t)):t.advanceCodePoint()}}function Es(e,t){for(;qe(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();let r="";for(;;){if(t.source.codePointAt(t.cursor)===void 0){let o=[h.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}];return e.onParseError(new $e(Be.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],o)),o}if(t.source.codePointAt(t.cursor)===41)return t.advanceCodePoint(),[h.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}];if(qe(t.source.codePointAt(t.cursor)??-1)){for(t.advanceCodePoint();qe(t.source.codePointAt(t.cursor)??-1);)t.advanceCodePoint();if(t.source.codePointAt(t.cursor)===void 0){let o=[h.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}];return e.onParseError(new $e(Be.UnexpectedEOFInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],o)),o}return t.source.codePointAt(t.cursor)===41?(t.advanceCodePoint(),[h.URL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:r}]):(wr(e,t),[h.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0])}let s=t.source.codePointAt(t.cursor);if(s===34||s===39||s===40||(n=s??-1)===11||n===127||0<=n&&n<=8||14<=n&&n<=31){wr(e,t);let o=[h.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new $e(Be.UnexpectedCharacterInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token",`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],o)),o}if(s===92){if(ct(t)){t.advanceCodePoint(),r+=String.fromCodePoint(zt(e,t));continue}wr(e,t);let o=[h.BadURL,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return e.onParseError(new $e(Be.InvalidEscapeSequenceInURL,t.representationStart,t.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],o)),o}t.source.codePointAt(t.cursor)===0||at(t.source.codePointAt(t.cursor)??-1)?(r+=String.fromCodePoint(rt),t.advanceCodePoint()):(r+=t.source[t.cursor],t.advanceCodePoint())}var n}function Ar(e,t){let r=Ut(e,t);if(t.source.codePointAt(t.cursor)!==40)return[h.Ident,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...r)}];if(Fs(r)){t.advanceCodePoint();let n=0;for(;;){let s=qe(t.source.codePointAt(t.cursor)??-1),o=qe(t.source.codePointAt(t.cursor+1)??-1);if(s&&o){n+=1,t.advanceCodePoint(1);continue}let i=s?t.source.codePointAt(t.cursor+1):t.source.codePointAt(t.cursor);if(i===34||i===39)return n>0&&t.unreadCodePoint(n),[h.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...r)}];break}return Es(e,t)}return t.advanceCodePoint(),[h.Function,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:String.fromCodePoint(...r)}]}function ws(e){return!(e.source.codePointAt(e.cursor)!==117&&e.source.codePointAt(e.cursor)!==85||e.source.codePointAt(e.cursor+1)!==ot||e.source.codePointAt(e.cursor+2)!==63&&!Ge(e.source.codePointAt(e.cursor+2)??-1))}function As(e,t){t.advanceCodePoint(2);let r=[],n=[],s;for(;(s=t.source.codePointAt(t.cursor))!==void 0&&r.length<6&&Ge(s);)r.push(s),t.advanceCodePoint();for(;(s=t.source.codePointAt(t.cursor))!==void 0&&r.length<6&&s===63;)n.length===0&&n.push(...r),r.push(48),n.push(70),t.advanceCodePoint();if(!n.length&&t.source.codePointAt(t.cursor)===te&&Ge(t.source.codePointAt(t.cursor+1)??-1))for(t.advanceCodePoint();(s=t.source.codePointAt(t.cursor))!==void 0&&n.length<6&&Ge(s);)n.push(s),t.advanceCodePoint();if(!n.length){let a=parseInt(String.fromCodePoint(...r),16);return[h.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:a,endOfRange:a}]}let o=parseInt(String.fromCodePoint(...r),16),i=parseInt(String.fromCodePoint(...n),16);return[h.UnicodeRange,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{startOfRange:o,endOfRange:i}]}function Vt(e,t){let r=Sr(e,t),n=[];for(;!r.endOfFile();)n.push(r.nextToken());return n.push(r.nextToken()),n}function Sr(e,t){let r=e.css.valueOf(),n=e.unicodeRangesAllowed??!1,s=new yr(r),o={onParseError:t?.onParseError??ys};return{nextToken:function(){s.resetRepresentation();let a=s.source.codePointAt(s.cursor);if(a===void 0)return[h.EOF,"",-1,-1,void 0];if(a===47&&ps(s))return gs(o,s);if(n&&(a===117||a===85)&&ws(s))return As(0,s);if(it(a))return Ar(o,s);if(ge(a))return Er(o,s);switch(a){case 44:return s.advanceCodePoint(),[h.Comma,",",s.representationStart,s.representationEnd,void 0];case 58:return s.advanceCodePoint(),[h.Colon,":",s.representationStart,s.representationEnd,void 0];case 59:return s.advanceCodePoint(),[h.Semicolon,";",s.representationStart,s.representationEnd,void 0];case 40:return s.advanceCodePoint(),[h.OpenParen,"(",s.representationStart,s.representationEnd,void 0];case 41:return s.advanceCodePoint(),[h.CloseParen,")",s.representationStart,s.representationEnd,void 0];case 91:return s.advanceCodePoint(),[h.OpenSquare,"[",s.representationStart,s.representationEnd,void 0];case 93:return s.advanceCodePoint(),[h.CloseSquare,"]",s.representationStart,s.representationEnd,void 0];case 123:return s.advanceCodePoint(),[h.OpenCurly,"{",s.representationStart,s.representationEnd,void 0];case 125:return s.advanceCodePoint(),[h.CloseCurly,"}",s.representationStart,s.representationEnd,void 0];case 39:case 34:return Cs(o,s);case 35:return xs(o,s);case ot:case 46:return an(s)?Er(o,s):(s.advanceCodePoint(),[h.Delim,s.source[s.representationStart],s.representationStart,s.representationEnd,{value:s.source[s.representationStart]}]);case st:case nt:case 12:case 9:case 32:return bs(s);case te:return an(s)?Er(o,s):ds(s)?(s.advanceCodePoint(3),[h.CDC,"-->",s.representationStart,s.representationEnd,void 0]):Lt(0,s)?Ar(o,s):(s.advanceCodePoint(),[h.Delim,"-",s.representationStart,s.representationEnd,{value:"-"}]);case 60:return cs(s)?(s.advanceCodePoint(4),[h.CDO,"",s.representationStart,s.representationEnd,void 0]):Wt(0,s)?Ar(o,s):(s.advanceCodePoint(),[h.Delim,"-",s.representationStart,s.representationEnd,{value:"-"}]);case 60:return cs(s)?(s.advanceCodePoint(4),[h.CDO,"",s.representationStart,s.representationEnd,void 0]):Lt(0,s)?wr(o,s):(s.advanceCodePoint(),[h.Delim,"-",s.representationStart,s.representationEnd,{value:"-"}]);case 60:return es(s)?(s.advanceCodePoint(4),[h.CDO,"",s.representationStart,s.representationEnd,void 0]):Wt(0,s)?wr(o,s):(s.advanceCodePoint(),[h.Delim,"-",s.representationStart,s.representationEnd,{value:"-"}]);case 60:return es(s)?(s.advanceCodePoint(4),[h.CDO,"