transform-to-unocss-core 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,4 +4,37 @@ declare function toUnocssClass(css: string, isRem?: boolean): [string, string[]]
4
4
 
5
5
  declare function transformStyleToUnocss(styles: string, isRem?: boolean): [string, string[]];
6
6
 
7
- export { toUnocss, toUnocssClass, transformStyleToUnocss };
7
+ declare const flag = ".__unocss_transfer__";
8
+ declare const cssMathFnRE: RegExp;
9
+ declare const numberWithUnitRE: RegExp;
10
+ declare function isNot(s: string): boolean;
11
+ declare function isCalc(s: string): boolean;
12
+ declare function getFirstName(s: string): string;
13
+ declare function getLastName(s: string): string;
14
+ declare function isUrl(s: string): boolean;
15
+ declare function isPercent(s: string): boolean;
16
+ declare function isHex(hex: string): boolean;
17
+ declare function isRgb(s: string): boolean;
18
+ declare function isHsl(s: string): boolean;
19
+ declare function getVal(val: string, transform?: Function, inClass?: boolean): string;
20
+ declare function getHundred(n: string | number): string | number;
21
+ declare function joinWithLine(s: string): string;
22
+ declare function joinWithUnderLine(s: string): string;
23
+ declare type TrimType = 'all' | 'pre' | 'around' | 'post';
24
+ /**
25
+ * 删除空格
26
+ * @param { string } s 字符串
27
+ * @param { TrimType } type 所有 | 前置 | 前后 | 后置 'all' | 'pre' | 'around' | 'post'
28
+ * @returns
29
+ */
30
+ declare function trim(s: string, type?: TrimType): string;
31
+ declare function transformImportant(v: string): string[];
32
+ declare function diffTemplateStyle(before: string, after: string): boolean;
33
+ declare function isEmptyStyle(code: string): boolean;
34
+ declare function getStyleScoped(code: string): string;
35
+ declare function joinEmpty(str: string): string;
36
+ declare function isVar(s: string): boolean;
37
+ declare function isSize(s: string): boolean;
38
+ declare function isColor(s: string): boolean;
39
+
40
+ export { TrimType, cssMathFnRE, diffTemplateStyle, flag, getFirstName, getHundred, getLastName, getStyleScoped, getVal, isCalc, isColor, isEmptyStyle, isHex, isHsl, isNot, isPercent, isRgb, isSize, isUrl, isVar, joinEmpty, joinWithLine, joinWithUnderLine, numberWithUnitRE, toUnocss, toUnocssClass, transformImportant, transformStyleToUnocss, trim };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var Lr=Object.getOwnPropertyNames;var Fr=Object.prototype.hasOwnProperty;var zr=(r,o)=>{for(var t in o)S(r,t,{get:o[t],enumerable:!0})},Cr=(r,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of Lr(o))!Fr.call(r,e)&&e!==t&&S(r,e,{get:()=>o[e],enumerable:!(n=Nr(o,e))||n.enumerable});return r};var Ur=r=>Cr(S({},"__esModule",{value:!0}),r);var tt={};zr(tt,{toUnocss:()=>C,toUnocssClass:()=>Vr,transformStyleToUnocss:()=>U});module.exports=Ur(tt);var Sr=/^(?:calc|clamp|min|max)\s*\(.*\)/;function T(r){return Sr.test(r)}function c(r){return r.split("-")[0]}function u(r){let o=r.split("-");return o[o.length-1]}function Tr(r){return r.startsWith("url(")}function R(r){return r.endsWith("%")}function Rr(r){return/^#[0-9A-Fa-f]{2,}$/.test(r)}function b(r){return r.startsWith("rgb")}function Ar(r){return r.startsWith("hsl")}function a(r,o,t){return T(r)||Tr(r)||Rr(r)||b(r)||Ar(r)||R(r)||Pr(r)?t?`-[${f(r,"all").replace(/['"]/g,"")}]`:`="[${f(r,"all").replace(/['"]/g,"")}]"`:`-${o?o(r):r}`}function w(r){return typeof r=="string"&&r.endsWith("%")?r.slice(0,-1):+r*100}function I(r){return r.replace(/\s+/," ").split(" ").join("-")}function j(r){return r.replace(/\s+/," ").split(" ").join("_")}function f(r,o="around"){return o==="pre"?r.replace(/(^\s*)/g,""):o==="post"?r.replace(/(\s*$)/g,""):o==="all"?r.replace(/\s+/g,""):o==="around"?r.replace(/(^\s*)|(\s*$)/g,""):r}function i(r){return r=r.replace(/\s+/," "),/rgb/.test(r)&&(r=r.replace(/rgba?\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/hsl/.test(r)&&(r=r.replace(/hsla?\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/var\([^\)]+\)/.test(r)&&(r=r.replace(/var\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),r.endsWith("!important")?[r.replace(/\s*\!important/,"").trim(),"!"]:[r.trim(),""]}function B(r){return r.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function Pr(r){return r.startsWith("var(--")}function N(r,o){let[t,n]=i(o);return`${r[0]}${a(t,c)}${n}`}var Mr=["background-color","background-size","background-attachment","background-position"],Er=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Hr=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Br=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,h="__comma__";function G(r,o){let[t,n]=i(o);if(Mr.includes(r))return`bg${a(t,P)}${n}`;if(["background","background-image"].includes(r)){if(/(linear)-gradient/.test(t)){let m=t.replace(/rgba?\(([^)]+)\)/g,(l,x)=>l.replace(x,x.replace(/\s*,\s*/g,h))),p=m.match(Er);if(p){let[l,x,W,_]=p.slice(1);return l=f(l,"around").split(" ").map(V=>V[0]).join(""),l?`bg-gradient-to-${l}${A(x,W,_)}`:A(x,W,_)}let $=m.match(Hr);return $?`bg-gradient-linear bg-gradient-[${$[1]},${$[2].trim().replace(/\s+/,"_").replaceAll(h,",")},${$[3].trim().replace(/\s+/,"_").replaceAll(h,",")}]`:void 0}else if(/(radial|conic)-gradient/.test(t)){let p=t.replace(/rgba?\(([^)]+)\)/g,(_,V)=>_.replace(V,V.replace(/\s*,\s*/g,h))).match(Br);if(!p)return;let $=p[1],[l,x,W]=p.slice(2);return`bg-gradient-${$}${A(l,x,W)}`}let e=t.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${t.replace(m,`[${f(m,"all")}]`)}${n}"`}let s=t.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${t.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(t,P)}${n}`}return r==="background-blend-mode"?`bg-blend-${t}${n}`:`${Gr(r,t)}-${Dr(t)}${n}`}function Gr(r,o){return o.endsWith("repeat")?"bg":r.replace("background","bg")}function Dr(r){return/(border)|(content)|(padding)-box/.test(r)?r.replace("-box",""):r.startsWith("repeat-")?r.replace("repeat-",""):P(r)}function P(r){return r.replace(/\s+/," ").replace(" ","-")}function A(r,o,t){let n="";if(o&&!t&&(t=o,o=""),r){r=r.replaceAll(h,",");let[e,s]=f(r,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` from="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` from="${b(e)?`[${e}]`:e}"`)}if(o){o=o.replaceAll(h,",");let[e,s]=f(o,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` via="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` via="${b(e)?`[${e}]`:e}"`)}if(t){t=t.replaceAll(h,",");let[e,s]=f(t,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` to="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${b(e)?`[${e}]`:e}"`)}return n}function M(r,o){let[t,n]=i(o),e=r.split("-");return`${e[0]}-${e[1][0]}${a(c(t))}${n}`}function D(r,o){let[t,n]=i(o);if(r==="font-size")return`text-${t}${n}`;if(r==="font-weight")return`font-${t}${n}`;if(r==="font-family"){let e=t.match(/ui-(\w{0,4})/);if(!e)return`font-${o}${n}`;let[s,m]=e;return`font-${m}${n}`}return r==="font-style"?t==="normal"?`font-not-italic${n}`:`font-${t}${n}`:r==="font-variant-numeric"?t==="normal"?`normal-nums${n}`:`${t}${n}`:`font="${Zr(t)}${n}"`}function Zr(r){return r.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function Z(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}var qr={"margin-left":"ml","margin-right":"mr","margin-top":"mt","margin-bottom":"mb","margin-inline-start":"ms","margin-inline-end":"me","padding-left":"pl","padding-right":"pr","padding-top":"pt","padding-bottom":"pb","padding-inline-start":"ps","padding-inline-end":"pe"};function E(r,o){let[t,n]=i(o),e=qr[r];if(e)return`${e}${a(t)}${n}`;let s=f(t).split(" "),m=s.length;return m===1?`${r[0]}${a(s[0])}${n}`:m===2?`${r[0]}x${a(s[1])}${n} ${r[0]}y${a(s[0])}${n}`:m===3?`${r[0]}x${a(s[1])}${n} ${r[0]}t${a(s[0])}${n} ${r[0]}b${a(s[2])}${n}`:`${r[0]}t${a(s[0])}${n} ${r[0]}b${a(s[2])}${n} ${r[0]}l${a(s[3])}${n} ${r[0]}r${a(s[1])}${n}`}function q(r,o){let[t,n]=i(o);return R(o)?`op-${t.replace("%","")}${n}`:`op-${+t*100}${n}`}function J(r,o){let[t,n]=i(o);return`text${a(t)}${n}`}function K(r,o){let[t,n]=i(o);return r==="text-decoration-line"?t==="none"?`no-underline${n}`:`${t}${n}`:r==="text-transform"?t==="none"?`normal-case${n}`:`${t}${n}`:r.startsWith("text-decoration")||r==="text-indent"?`${r.split("-")[1]}${a(t)}${n}`:r==="text-underline-offset"?`underline-offset-${t}${n}`:`text-${t}${n}`}function O(r,o){let[t,n]=i(o);return`v-${t}${n}`}function Q(r,o){let[t,n]=i(o);return`lh${a(t)}${n}`}var Jr=["border-left","border-top","border-right","border-bottom"];function X(r,o){let[t,n]=i(o);return r==="border-spacing"?`${r}="[${j(t)}]${n}"`:r==="border-color"?`border${a(t)}${n}`:r==="border-radius"?T(t)||!t.includes(" ")?`border-rd${a(t)}${n}`:`border-rd="[${j(t)}]${n}"`:Jr.some(e=>r.startsWith(e))?t.split(" ").map(e=>`border-${r.split("-")[1][0]}${a(e)}${n}`).join(" "):r==="border-inline-end-width"?`border-e${a(t)}${n}`:r==="border-inline-start-width"?`border-s${a(t)}${n}`:r.startsWith("border-image")?"":/^\d[%|(px)|(rem)]$/.test(t)||r==="border-collapse"?`border-${t}${n}`:r==="border-width"||r==="border-style"?`border${a(t)}${n}`:r==="border-color"?t==="currentColor"?`border-current${n}`:`border${a(t)}${n}`:t.split(" ").map(e=>t==="currentColor"?`border-current${n}`:`border${a(e)}${n}`).join(" ")}function L(r,o){let[t,n]=i(o);return t==="none"?`hidden${n}`:t==="hidden"?`invisible${n}`:`${t}${n}`}function g(r,o){let[t,n]=i(o);return`${r}-${t}${n}`}function v(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}function d(r,o){let[t,n]=i(o);return`${c(r)}${a(t)}${n}`}function F(r,o){let[t,n]=i(o);if(r.startsWith("box-decoration"))return`box-decoration-${t}${n}`;if(r==="box-sizing")return`box-${c(t)}${n}`;let e=/rgba?(\([^)]+\))/g;return t=t.replace(e,(s,m)=>s.replace(m,f(m,"all"))).replace(/\s*,\s*/g,","),`shadow="[${t.replace(/\s+/," ").split(" ").join("_")}]${n}"`}var Kr=["contrast","brightness","saturate"],Or=["grayscale","invert","sepia"];function z(r,o){let[t,n]=i(o),[e,s,m]=t.match(/([\w-]+)\((.*)\)/);return Kr.includes(s)?`${s}-${w(m)}${n}`:s==="drop-shadow"?`drop-${F(s,m)}${n}`:Or.includes(s)?`${s}-${m.endsWith("%")?m.slice(0,-1):w(m)}${n}`:s==="hue-rotate"?`${s}-${m.slice(0,-3)}${n}`:`${s}-${m}${n}`}function Y(r,o){let[t,n]=i(o);return`backdrop-${z(r,t)}${n}`}function k(r,o){let[t,n]=i(o);return r==="transform-origin"?`origin-${I(t)}${n}`:r==="transform-style"?`transform-${t}`:B(t).split(" ").map(e=>{let s=e.match(/([a-z]+)([A-Z])?\((.*)\)/);if(!s)return;let[m,p,$,l]=s;return $?p==="scale"?l.includes(",")?`${p}-${$.toLowerCase()}="${l.split(",").join(" ")}${n}"`:`${p}-${$.toLowerCase()}-${w(l)}${n}`:`${p}-${$.toLowerCase()}="${y(l)}${n}"`:p==="scale"?l.includes(",")?`${p}="${l.split(",").join(" ")}${n}"`:`${p}-${w(l)}${n}`:`${p}="${y(l).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function y(r){return r=f(r,"all"),r.endsWith("deg")?r.slice(0,-3):r}var Qr=["transition-delay","transition-duration"];function rr(r,o){let[t,n]=i(o);if(r==="transition-timing-function")return t==="linear"?`ease-${t}${n}`:`ease="[${f(t,"all")}]${n}"`;if(r==="transition")return`transition="${Xr(t)}"`;if(r==="transition-property")return t.includes("color")?`transition-color${n}`:t==="box-shadow"?`transition-shadow${n}`:`transition-${t}${n}`;if(Qr.includes(r))return`${r.split("-")[1]}-${t.slice(0,-2)}`}function Xr(r){let o=!1;return r.split(" ").map(t=>/^[0-9]/.test(t)||/^\.[0-9]/.test(t)?o?`delay${a(t,void 0,!0)}`:(o=!0,`duration${a(t,void 0,!0)}`):t==="background-color"?"colors":t).join(" ")}function tr(r,o){let[t,n]=i(o);return r==="justify-content"?`justify-${u(t)}${n}`:`${r}-${u(t)}${n}`}function nr(r,o){let[t,n]=i(o);return`${u(r)}-${u(t)}${n}`}var Yr=["flex-basis","flex-grow","flex-shrink"];function or(r,o){let[t,n]=i(o);if(Yr.includes(r))return`${u(r)}-${t}${n}`;if(t==="1")return`flex-1${n}`;let e=f(t)[0];return r==="flex"&&(e==="0"||e==="1")?`flex="[${j(t)}]${n}"`:`${c(r)}-${t.replace("column","col")}${n}`}function ir(r,o){let[t,n]=i(o);return t==="auto"?`${c(r)}-${t}`:`${c(r)}="[${f(t,"all")}]${n}"`}function er(r,o){let[t,n]=i(o);return r==="column-gap"?`gap-x-${t}${n}`:`${r}-${t}${n}`}function sr(r,o){let[t,n]=i(o);return o==="isolate"?`${t}${n}`:`${r}-${t}${n}`}function ar(r,o){let[t,n]=i(o);return r==="object-position"?`${c(r)}-${I(t)}${n}`:`${c(r)}-${t}${n}`}function mr(r,o){let[t,n]=i(o),[e,s,m]=r.split("-");return m?`${e}-${m}-${t}${n}`:`${e}-${t}${n}`}function pr(r,o){let[t,n]=i(o);if(r.startsWith("grid-template")){let s=t.match(/repeat\s*\(\s*([0-9]+)/);return s?`grid-${u(r)==="rows"?"rows":"cols"}-${s[1]}${n}`:`grid-${u(r)==="rows"?"rows":"cols"}-${t}${n}`}if(r==="grid-auto-flow")return`grid-flow-${I(t).replace("column","col")}${n}`;if(r.startsWith("grid-auto")){let s=t.match(/minmax\s*\(\s*0\s*,\s*1fr/);return`auto-${u(r)==="rows"?"rows":"cols"}-${s?"fr":c(t)}${n}`}let e=t.match(/span\s+([0-9])/);return e?`${r.slice(5).replace("column","col")}-span-${e[1]}${n}`:f(t,"all")==="1/-1"?`${r.slice(5).replace("column","col")}-span-full${n}`:`${r.slice(5).replace("column","col")}-${t}${n}`}function fr(r,o){let[t,n]=i(o);return`gap-y-${t}${n}`}function cr(r,o){let[t,n]=i(o);return`${r}-${u(t)}${n}`}function lr(r,o){let[t,n]=i(o);return`tracking-${t}${n}`}function ur(r,o){let[t,n]=i(o);return`whitespace-${t}${n}`}function $r(r,o){let[t,n]=i(o);return r.startsWith("word-spacing")?`word-spacing${a(o)}`:t==="keep-all"?`break-keep${n}`:`break-${u(t)}${n}`}function gr(r,o){let[t,n]=i(o);return r==="outline-offset"?`${r}-${t}${n}`:`${c(r)}-${t}${n}`}function dr(r,o){let[t,n]=i(o);return`mix-blend-${t}${n}`}var yr={vertical:"y",horizontal:"x"};function xr(r,o){let[t,n]=i(o);return t==="both"?`${r}${n}`:`${r}-${yr[t]||t}${n}`}function br(r,o){let[t,n]=i(o);if(r.startsWith("scroll-snap"))return`snap-${t}${n}`;if(r==="scroll-behavior")return`scroll-${t}${n}`;let[e,s,m,p]=r.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&p?`scroll-${s[0]}${p[0]}-${t}${n}`:m?`scroll-${s[0]}${m[0]}-${t}${n}`:`scroll-${s[0]}-${t}${n}`}function hr(r,o){let[t,n]=i(o);return`${u(r)}-${t}${n}`}function wr(r,o){let[t,n]=i(o);return`${r}-${c(t)}${n}`}function Ir(r,o){let[t,n]=i(o);return r==="animation-delay"?`animate${a(t)}${n}`:r==="animation"?`animate-${t.split(" ")[0]}${n}`:`animate-${t}${n}`}function vr(r,o){let[t,n]=i(o);return`content="[${t}]${n}"`}var kr={show:"visible",hide:"hidden"};function jr(r,o){var e;let[t,n]=i(o);return`table-empty-cells-${(e=kr[t])!=null?e:t}${n}`}function Wr(r,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function _r(r,o){let[t,n]=i(o);if(r==="inset-inline-start")return`start${a(t)}${n}`;if(r==="inset-inline-end")return`end${a(t)}${n}`}var H={animation:Ir,aspect:ir,backface:d,caption:d,column:er,columns:g,break:g,empty:jr,box:F,writing:Wr,display:L,float:g,clear:g,isolation:sr,object:ar,overflow:g,overscroll:mr,position:L,top:v,left:v,right:v,bottom:v,visibility:L,z:N,flex:or,order:g,grid:pr,gap:v,justify:tr,align:nr,place:cr,padding:E,perspective:g,margin:E,width:N,min:M,max:M,height:N,font:D,letter:lr,line:Q,list:d,text:K,vertical:O,white:ur,word:$r,content:vr,background:G,border:X,outline:gr,opacity:q,mix:dr,filter:z,backdrop:Y,table:d,transition:rr,transform:k,accent:d,appearance:d,cursor:Z,caret:d,pointer:g,resize:xr,scroll:br,inset:_r,touch:d,user:hr,will:wr,fill:g,stroke:d,color:J,row:fr},rt=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function C(r,o=!1){var $;let t=r.match(rt);if(!t)return;let[n,e,s]=t,m=c(e),p=($=H[m])==null?void 0:$.call(H,e,s);return p&&o?p.replace(/-([0-9\.]+)px/,(l,x)=>`-${+x/4}`):p}function U(r,o){let t=[];return[r.split(";").filter(Boolean).reduce((n,e)=>{let s=C(e,o)||"";return s||t.push(e),n+=`${s} `},"").trim(),t]}function Vr(r,o=!1){let[t,n]=U(r,o);return[t?t.replace(/="([^"]+)"/g,(e,s)=>`-${s}`):"",n]}0&&(module.exports={toUnocss,toUnocssClass,transformStyleToUnocss});
1
+ "use strict";var T=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var Rt=Object.prototype.hasOwnProperty;var At=(t,o)=>{for(var r in o)T(t,r,{get:o[r],enumerable:!0})},Pt=(t,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of Tt(o))!Rt.call(t,e)&&e!==r&&T(t,e,{get:()=>o[e],enumerable:!(n=St(o,e))||n.enumerable});return t};var Mt=t=>Pt(T({},"__esModule",{value:!0}),t);var pr={};At(pr,{cssMathFnRE:()=>A,diffTemplateStyle:()=>Bt,flag:()=>Et,getFirstName:()=>p,getHundred:()=>b,getLastName:()=>c,getStyleScoped:()=>Dt,getVal:()=>a,isCalc:()=>V,isColor:()=>qt,isEmptyStyle:()=>Gt,isHex:()=>P,isHsl:()=>M,isNot:()=>Ht,isPercent:()=>N,isRgb:()=>$,isSize:()=>Zt,isUrl:()=>J,isVar:()=>K,joinEmpty:()=>E,joinWithLine:()=>h,joinWithUnderLine:()=>I,numberWithUnitRE:()=>q,toUnocss:()=>U,toUnocssClass:()=>Ut,transformImportant:()=>i,transformStyleToUnocss:()=>S,trim:()=>R});module.exports=Mt(pr);var Et=".__unocss_transfer__",A=/^(?:calc|clamp|min|max)\s*\(.*\)/,q=/[0-9]+(px|rem|em|%|vw|vh|vmin|vmax|deg)/;function Ht(t){return/\[&:not\(/.test(t)}function V(t){return A.test(t)}function p(t){return t.split("-")[0]}function c(t){let o=t.split("-");return o[o.length-1]}function J(t){return t.startsWith("url(")}function N(t){return t.endsWith("%")}function P(t){return/^#[0-9A-Fa-f]{2,}$/.test(t)}function $(t){return t.startsWith("rgb")}function M(t){return t.startsWith("hsl")}function a(t,o,r){return V(t)||J(t)||P(t)||$(t)||M(t)||N(t)||K(t)?r?`-[${R(t,"all").replace(/['"]/g,"")}]`:`="[${R(t,"all").replace(/['"]/g,"")}]"`:`-${o?o(t):t}`}function b(t){return typeof t=="string"&&t.endsWith("%")?t.slice(0,-1):+t*100}function h(t){return t.replace(/\s+/," ").split(" ").join("-")}function I(t){return t.replace(/\s+/," ").split(" ").join("_")}function R(t,o="around"){return o==="pre"?t.replace(/(^\s*)/g,""):o==="post"?t.replace(/(\s*$)/g,""):o==="all"?t.replace(/\s+/g,""):o==="around"?t.replace(/(^\s*)|(\s*$)/g,""):t}function i(t){return t=t.replace(/\s+/," ").replace(/\s*,\s*/g,",").replace(/\s*\/\s*/,"/"),/rgb/.test(t)&&(t=t.replace(/rgba?\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/hsl/.test(t)&&(t=t.replace(/hsla?\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/var\([^\)]+\)/.test(t)&&(t=t.replace(/var\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),t.endsWith("!important")?[t.replace(/\s*\!important/,"").trim(),"!"]:[t.trim(),""]}function Bt(t,o){let r=t.match(/<style scoped>.*<\/style>/s),n=o.match(/<style scoped>.*<\/style>/s);return r[0]===n[0]}function Gt(t){return/<style scoped>[\n\s]*<\/style>/.test(t)}function Dt(t){let o=t.match(/<style scoped>(.*)<\/style>/s);return o?o[1]:""}function E(t){return t.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function K(t){return t.startsWith("var(--")}function Zt(t){return A.test(t)||q.test(t)}function qt(t){return P(t)||$(t)||M(t)}function L(t,o){let[r,n]=i(o);return`${t[0]}${a(r,p)}${n}`}var Jt=["background-color","background-size","background-attachment","background-position"],Kt=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Ot=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Qt=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,w="__comma__";function O(t,o){let[r,n]=i(o);if(Jt.includes(t))return`bg${a(r,B)}${n}`;if(["background","background-image"].includes(t)){if(/(linear)-gradient/.test(r)){let m=r.replace(/rgba?\(([^)]+)\)/g,(u,x)=>u.replace(x,x.replace(/\s*,\s*/g,w))),f=m.match(Kt);if(f){let[u,x,j,W]=f.slice(1);return u=u.split(" ").map(_=>_[0]).join(""),u?`bg-gradient-to-${u}${H(x,j,W)}`:H(x,j,W)}let l=m.match(Ot);return l?`bg-gradient-linear bg-gradient-[${l[1]},${l[2].replace(/\s+/,"_").replaceAll(w,",")},${l[3].replace(/\s+/,"_").replaceAll(w,",")}]`:void 0}else if(/(radial|conic)-gradient/.test(r)){let f=r.replace(/rgba?\(([^)]+)\)/g,(W,_)=>W.replace(_,_.replace(/\s*,\s*/g,w))).match(Qt);if(!f)return;let l=f[1],[u,x,j]=f.slice(2);return`bg-gradient-${l}${H(u,x,j)}`}let e=r.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${r.replace(m,`[${m}]`)}${n}"`}let s=r.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${r.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(r,B)}${n}`}return t==="background-blend-mode"?`bg-blend-${r}${n}`:`${Xt(t,r)}-${Yt(r)}${n}`}function Xt(t,o){return o.endsWith("repeat")?"bg":t.replace("background","bg")}function Yt(t){return/(border)|(content)|(padding)-box/.test(t)?t.replace("-box",""):t.startsWith("repeat-")?t.replace("repeat-",""):B(t)}function B(t){return t.replace(/\s+/," ").replace(" ","-")}function H(t,o,r){let n="";if(o&&!r&&(r=o,o=""),t){t=t.replaceAll(w,",");let[e,s]=t.split(" ");s?n+=` from="${$(e)?`[${e}]`:e} ${s}"`:e&&(n+=` from="${$(e)?`[${e}]`:e}"`)}if(o){o=o.replaceAll(w,",");let[e,s]=o.split(" ");s?n+=` via="${$(e)?`[${e}]`:e} ${s}"`:e&&(n+=` via="${$(e)?`[${e}]`:e}"`)}if(r){r=r.replaceAll(w,",");let[e,s]=r.split(" ");s?n+=` to="${$(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${$(e)?`[${e}]`:e}"`)}return n}function G(t,o){let[r,n]=i(o),e=t.split("-");return`${e[0]}-${e[1][0]}${a(p(r))}${n}`}function Q(t,o){let[r,n]=i(o);if(t==="font-size")return`text-${r}${n}`;if(t==="font-weight")return`font-${r}${n}`;if(t==="font-family"){let e=r.match(/ui-(\w{0,4})/);if(!e)return`font-${o}${n}`;let[s,m]=e;return`font-${m}${n}`}return t==="font-style"?r==="normal"?`font-not-italic${n}`:`font-${r}${n}`:t==="font-variant-numeric"?r==="normal"?`normal-nums${n}`:`${r}${n}`:`font="${yt(r)}${n}"`}function yt(t){return t.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function X(t,o){let[r,n]=i(o);return`${t}${a(r)}${n}`}var kt={"margin-left":"ml","margin-right":"mr","margin-top":"mt","margin-bottom":"mb","margin-inline-start":"ms","margin-inline-end":"me","padding-left":"pl","padding-right":"pr","padding-top":"pt","padding-bottom":"pb","padding-inline-start":"ps","padding-inline-end":"pe"};function D(t,o){let[r,n]=i(o),e=kt[t];if(e)return`${e}${a(r)}${n}`;let s=r.split(" "),m=s.length;return m===1?`${t[0]}${a(s[0])}${n}`:m===2?`${t[0]}x${a(s[1])}${n} ${t[0]}y${a(s[0])}${n}`:m===3?`${t[0]}x${a(s[1])}${n} ${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n}`:`${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n} ${t[0]}l${a(s[3])}${n} ${t[0]}r${a(s[1])}${n}`}function Y(t,o){let[r,n]=i(o);return N(o)?`op-${r.replace("%","")}${n}`:`op-${+r*100}${n}`}function y(t,o){let[r,n]=i(o);return`text${a(r)}${n}`}function k(t,o){let[r,n]=i(o);return t==="text-decoration-line"?r==="none"?`no-underline${n}`:`${r}${n}`:t==="text-transform"?r==="none"?`normal-case${n}`:`${r}${n}`:t.startsWith("text-decoration")||t==="text-indent"?`${t.split("-")[1]}${a(r)}${n}`:t==="text-underline-offset"?`underline-offset-${r}${n}`:`text-${r}${n}`}function tt(t,o){let[r,n]=i(o);return`v-${r}${n}`}function rt(t,o){let[r,n]=i(o);return`lh${a(r)}${n}`}var tr=["border-left","border-top","border-right","border-bottom"];function nt(t,o){let[r,n]=i(o);return t==="border-spacing"?`${t}="[${I(r)}]${n}"`:t==="border-color"?`border${a(r)}${n}`:t==="border-radius"?V(r)||!r.includes(" ")?`border-rd${a(r)}${n}`:`border-rd="[${I(r)}]${n}"`:tr.some(e=>t.startsWith(e))?r.split(" ").map(e=>`border-${t.split("-")[1][0]}${a(e)}${n}`).join(" "):t==="border-inline-end-width"?`border-e${a(r)}${n}`:t==="border-inline-start-width"?`border-s${a(r)}${n}`:t.startsWith("border-image")?"":/^\d[%|(px)|(rem)]$/.test(r)||t==="border-collapse"?`border-${r}${n}`:t==="border-width"||t==="border-style"?`border${a(r)}${n}`:t==="border-color"?r==="currentColor"?`border-current${n}`:`border${a(r)}${n}`:r.split(" ").map(e=>r==="currentColor"?`border-current${n}`:`border${a(e)}${n}`).join(" ")}function F(t,o){let[r,n]=i(o);return r==="none"?`hidden${n}`:r==="hidden"?`invisible${n}`:`${r}${n}`}function g(t,o){let[r,n]=i(o);return`${t}-${r}${n}`}function v(t,o){let[r,n]=i(o);return`${t}${a(r)}${n}`}function d(t,o){let[r,n]=i(o);return`${p(t)}${a(r)}${n}`}function z(t,o){let[r,n]=i(o);return t.startsWith("box-decoration")?`box-decoration-${r}${n}`:t==="box-sizing"?`box-${p(r)}${n}`:`shadow="[${r.split(" ").join("_")}]${n}"`}var rr=["contrast","brightness","saturate"],nr=["grayscale","invert","sepia"];function C(t,o){let[r,n]=i(o),[e,s,m]=r.match(/([\w-]+)\((.*)\)/);return rr.includes(s)?`${s}-${b(m)}${n}`:s==="drop-shadow"?`drop-${z(s,m)}${n}`:nr.includes(s)?`${s}-${m.endsWith("%")?m.slice(0,-1):b(m)}${n}`:s==="hue-rotate"?`${s}-${m.slice(0,-3)}${n}`:`${s}-${m}${n}`}function ot(t,o){let[r,n]=i(o);return`backdrop-${C(t,r)}${n}`}function et(t,o){let[r,n]=i(o);return t==="transform-origin"?`origin-${h(r)}${n}`:t==="transform-style"?`transform-${r}`:E(r).split(" ").map(e=>{let s=e.match(/([a-z]+)([A-Z])?\((.*)\)/);if(!s)return;let[m,f,l,u]=s;return l?f==="scale"?u.includes(",")?`${f}-${l.toLowerCase()}="${u.split(",").join(" ")}${n}"`:`${f}-${l.toLowerCase()}-${b(u)}${n}`:`${f}-${l.toLowerCase()}="${it(u)}${n}"`:f==="scale"?u.includes(",")?`${f}="${u.split(",").join(" ")}${n}"`:`${f}-${b(u)}${n}`:`${f}="${it(u).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function it(t){return t.endsWith("deg")?t.slice(0,-3):t}var or=["transition-delay","transition-duration"];function st(t,o){let[r,n]=i(o);if(t==="transition-timing-function")return r==="linear"?`ease-${r}${n}`:`ease="[${r}]${n}"`;if(t==="transition")return`transition="${ir(r)}"`;if(t==="transition-property")return r.includes("color")?`transition-color${n}`:r==="box-shadow"?`transition-shadow${n}`:`transition-${r}${n}`;if(or.includes(t))return`${t.split("-")[1]}-${r.slice(0,-2)}`}function ir(t){let o=!1;return t.split(" ").map(r=>/^[0-9]/.test(r)||/^\.[0-9]/.test(r)?o?`delay${a(r,void 0,!0)}`:(o=!0,`duration${a(r,void 0,!0)}`):r==="background-color"?"colors":r).join(" ")}function at(t,o){let[r,n]=i(o);return t==="justify-content"?`justify-${c(r)}${n}`:`${t}-${c(r)}${n}`}function mt(t,o){let[r,n]=i(o);return`${c(t)}-${c(r)}${n}`}var er=["flex-basis","flex-grow","flex-shrink"];function pt(t,o){let[r,n]=i(o);if(er.includes(t))return`${c(t)}-${r}${n}`;if(r==="1")return`flex-1${n}`;let e=r[0];return t==="flex"&&(e==="0"||e==="1")?`flex="[${I(r)}]${n}"`:`${p(t)}-${r.replace("column","col")}${n}`}function ft(t,o){let[r,n]=i(o);return r==="auto"?`${p(t)}-${r}`:`${p(t)}="[${r}]${n}"`}function ct(t,o){let[r,n]=i(o);return t==="column-gap"?`gap-x-${r}${n}`:`${t}-${r}${n}`}function ut(t,o){let[r,n]=i(o);return o==="isolate"?`${r}${n}`:`${t}-${r}${n}`}function lt(t,o){let[r,n]=i(o);return t==="object-position"?`${p(t)}-${h(r)}${n}`:`${p(t)}-${r}${n}`}function $t(t,o){let[r,n]=i(o),[e,s,m]=t.split("-");return m?`${e}-${m}-${r}${n}`:`${e}-${r}${n}`}function gt(t,o){let[r,n]=i(o);if(t.startsWith("grid-template")){let s=r.match(/repeat\s*\(\s*([0-9]+)/);return s?`grid-${c(t)==="rows"?"rows":"cols"}-${s[1]}${n}`:`grid-${c(t)==="rows"?"rows":"cols"}-${r}${n}`}if(t==="grid-auto-flow")return`grid-flow-${h(r).replace("column","col")}${n}`;if(t.startsWith("grid-auto")){let s=r.match(/minmax\s*\(\s*0\s*,\s*1fr/);return`auto-${c(t)==="rows"?"rows":"cols"}-${s?"fr":p(r)}${n}`}let e=r.match(/span\s+([0-9])/);return e?`${t.slice(5).replace("column","col")}-span-${e[1]}${n}`:r==="1/-1"?`${t.slice(5).replace("column","col")}-span-full${n}`:`${t.slice(5).replace("column","col")}-${r}${n}`}function dt(t,o){let[r,n]=i(o);return`gap-y-${r}${n}`}function xt(t,o){let[r,n]=i(o);return`${t}-${c(r)}${n}`}function bt(t,o){let[r,n]=i(o);return`tracking-${r}${n}`}function ht(t,o){let[r,n]=i(o);return`whitespace-${r}${n}`}function wt(t,o){let[r,n]=i(o);return t.startsWith("word-spacing")?`word-spacing${a(o)}`:r==="keep-all"?`break-keep${n}`:`break-${c(r)}${n}`}function It(t,o){let[r,n]=i(o);return t==="outline-offset"?`${t}-${r}${n}`:`${p(t)}-${r}${n}`}function vt(t,o){let[r,n]=i(o);return`mix-blend-${r}${n}`}var sr={vertical:"y",horizontal:"x"};function jt(t,o){let[r,n]=i(o);return r==="both"?`${t}${n}`:`${t}-${sr[r]||r}${n}`}function Wt(t,o){let[r,n]=i(o);if(t.startsWith("scroll-snap"))return`snap-${r}${n}`;if(t==="scroll-behavior")return`scroll-${r}${n}`;let[e,s,m,f]=t.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&f?`scroll-${s[0]}${f[0]}-${r}${n}`:m?`scroll-${s[0]}${m[0]}-${r}${n}`:`scroll-${s[0]}-${r}${n}`}function _t(t,o){let[r,n]=i(o);return`${c(t)}-${r}${n}`}function Vt(t,o){let[r,n]=i(o);return`${t}-${p(r)}${n}`}function Nt(t,o){let[r,n]=i(o);return t==="animation-delay"?`animate${a(r)}${n}`:t==="animation"?`animate-${r.split(" ")[0]}${n}`:`animate-${r}${n}`}function Lt(t,o){let[r,n]=i(o);return r==='" "'||r==="' '"?`content-['_']${n}`:`content="[${r}]${n}"`}var ar={show:"visible",hide:"hidden"};function Ft(t,o){var e;let[r,n]=i(o);return`table-empty-cells-${(e=ar[r])!=null?e:r}${n}`}function zt(t,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function Ct(t,o){let[r,n]=i(o);if(t==="inset-inline-start")return`start${a(r)}${n}`;if(t==="inset-inline-end")return`end${a(r)}${n}`}var Z={animation:Nt,aspect:ft,backface:d,caption:d,column:ct,columns:g,break:g,empty:Ft,box:z,writing:zt,display:F,float:g,clear:g,isolation:ut,object:lt,overflow:g,overscroll:$t,position:F,top:v,left:v,right:v,bottom:v,visibility:F,z:L,flex:pt,order:g,grid:gt,gap:v,justify:at,align:mt,place:xt,padding:D,perspective:g,margin:D,width:L,min:G,max:G,height:L,font:Q,letter:bt,line:rt,list:d,text:k,vertical:tt,white:ht,word:wt,content:Lt,background:O,border:nt,outline:It,opacity:Y,mix:vt,filter:C,backdrop:ot,table:d,transition:st,transform:et,accent:d,appearance:d,cursor:X,caret:d,pointer:g,resize:jt,scroll:Wt,inset:Ct,touch:d,user:_t,will:Vt,fill:g,stroke:d,color:y,row:dt},mr=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function U(t,o=!1){var l;let r=t.match(mr);if(!r)return;let[n,e,s]=r,m=p(e),f=(l=Z[m])==null?void 0:l.call(Z,e,s);return f&&o?f.replace(/-([0-9\.]+)px/,(u,x)=>`-${+x/4}`):f}function S(t,o){let r=[];return[t.split(";").filter(Boolean).reduce((n,e)=>{let s=U(e,o)||"";return s||r.push(e),n+=`${s} `},"").trim(),r]}function Ut(t,o=!1){let[r,n]=S(t,o);return[r?r.replace(/="([^"]+)"/g,(e,s)=>`-${s}`):"",n]}0&&(module.exports={cssMathFnRE,diffTemplateStyle,flag,getFirstName,getHundred,getLastName,getStyleScoped,getVal,isCalc,isColor,isEmptyStyle,isHex,isHsl,isNot,isPercent,isRgb,isSize,isUrl,isVar,joinEmpty,joinWithLine,joinWithUnderLine,numberWithUnitRE,toUnocss,toUnocssClass,transformImportant,transformStyleToUnocss,trim});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var _r=/^(?:calc|clamp|min|max)\s*\(.*\)/;function C(r){return _r.test(r)}function c(r){return r.split("-")[0]}function u(r){let o=r.split("-");return o[o.length-1]}function Vr(r){return r.startsWith("url(")}function U(r){return r.endsWith("%")}function Nr(r){return/^#[0-9A-Fa-f]{2,}$/.test(r)}function b(r){return r.startsWith("rgb")}function Lr(r){return r.startsWith("hsl")}function a(r,o,t){return C(r)||Vr(r)||Nr(r)||b(r)||Lr(r)||U(r)||Fr(r)?t?`-[${f(r,"all").replace(/['"]/g,"")}]`:`="[${f(r,"all").replace(/['"]/g,"")}]"`:`-${o?o(r):r}`}function w(r){return typeof r=="string"&&r.endsWith("%")?r.slice(0,-1):+r*100}function I(r){return r.replace(/\s+/," ").split(" ").join("-")}function j(r){return r.replace(/\s+/," ").split(" ").join("_")}function f(r,o="around"){return o==="pre"?r.replace(/(^\s*)/g,""):o==="post"?r.replace(/(\s*$)/g,""):o==="all"?r.replace(/\s+/g,""):o==="around"?r.replace(/(^\s*)|(\s*$)/g,""):r}function i(r){return r=r.replace(/\s+/," "),/rgb/.test(r)&&(r=r.replace(/rgba?\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/hsl/.test(r)&&(r=r.replace(/hsla?\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/var\([^\)]+\)/.test(r)&&(r=r.replace(/var\(([^\)]+)\)/g,(o,t)=>{let n=t.trim().split(" ");return o.replace(t,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),r.endsWith("!important")?[r.replace(/\s*\!important/,"").trim(),"!"]:[r.trim(),""]}function H(r){return r.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function Fr(r){return r.startsWith("var(--")}function N(r,o){let[t,n]=i(o);return`${r[0]}${a(t,c)}${n}`}var zr=["background-color","background-size","background-attachment","background-position"],Cr=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Ur=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Sr=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,h="__comma__";function B(r,o){let[t,n]=i(o);if(zr.includes(r))return`bg${a(t,T)}${n}`;if(["background","background-image"].includes(r)){if(/(linear)-gradient/.test(t)){let m=t.replace(/rgba?\(([^)]+)\)/g,(l,x)=>l.replace(x,x.replace(/\s*,\s*/g,h))),p=m.match(Cr);if(p){let[l,x,W,_]=p.slice(1);return l=f(l,"around").split(" ").map(V=>V[0]).join(""),l?`bg-gradient-to-${l}${S(x,W,_)}`:S(x,W,_)}let $=m.match(Ur);return $?`bg-gradient-linear bg-gradient-[${$[1]},${$[2].trim().replace(/\s+/,"_").replaceAll(h,",")},${$[3].trim().replace(/\s+/,"_").replaceAll(h,",")}]`:void 0}else if(/(radial|conic)-gradient/.test(t)){let p=t.replace(/rgba?\(([^)]+)\)/g,(_,V)=>_.replace(V,V.replace(/\s*,\s*/g,h))).match(Sr);if(!p)return;let $=p[1],[l,x,W]=p.slice(2);return`bg-gradient-${$}${S(l,x,W)}`}let e=t.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${t.replace(m,`[${f(m,"all")}]`)}${n}"`}let s=t.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${t.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(t,T)}${n}`}return r==="background-blend-mode"?`bg-blend-${t}${n}`:`${Tr(r,t)}-${Rr(t)}${n}`}function Tr(r,o){return o.endsWith("repeat")?"bg":r.replace("background","bg")}function Rr(r){return/(border)|(content)|(padding)-box/.test(r)?r.replace("-box",""):r.startsWith("repeat-")?r.replace("repeat-",""):T(r)}function T(r){return r.replace(/\s+/," ").replace(" ","-")}function S(r,o,t){let n="";if(o&&!t&&(t=o,o=""),r){r=r.replaceAll(h,",");let[e,s]=f(r,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` from="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` from="${b(e)?`[${e}]`:e}"`)}if(o){o=o.replaceAll(h,",");let[e,s]=f(o,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` via="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` via="${b(e)?`[${e}]`:e}"`)}if(t){t=t.replaceAll(h,",");let[e,s]=f(t,"around").replace(/rgba?\(([^)]+)\)/,(m,p)=>m.replace(p,f(p,"all"))).split(" ");s?n+=` to="${b(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${b(e)?`[${e}]`:e}"`)}return n}function R(r,o){let[t,n]=i(o),e=r.split("-");return`${e[0]}-${e[1][0]}${a(c(t))}${n}`}function G(r,o){let[t,n]=i(o);if(r==="font-size")return`text-${t}${n}`;if(r==="font-weight")return`font-${t}${n}`;if(r==="font-family"){let e=t.match(/ui-(\w{0,4})/);if(!e)return`font-${o}${n}`;let[s,m]=e;return`font-${m}${n}`}return r==="font-style"?t==="normal"?`font-not-italic${n}`:`font-${t}${n}`:r==="font-variant-numeric"?t==="normal"?`normal-nums${n}`:`${t}${n}`:`font="${Ar(t)}${n}"`}function Ar(r){return r.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function D(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}var Pr={"margin-left":"ml","margin-right":"mr","margin-top":"mt","margin-bottom":"mb","margin-inline-start":"ms","margin-inline-end":"me","padding-left":"pl","padding-right":"pr","padding-top":"pt","padding-bottom":"pb","padding-inline-start":"ps","padding-inline-end":"pe"};function A(r,o){let[t,n]=i(o),e=Pr[r];if(e)return`${e}${a(t)}${n}`;let s=f(t).split(" "),m=s.length;return m===1?`${r[0]}${a(s[0])}${n}`:m===2?`${r[0]}x${a(s[1])}${n} ${r[0]}y${a(s[0])}${n}`:m===3?`${r[0]}x${a(s[1])}${n} ${r[0]}t${a(s[0])}${n} ${r[0]}b${a(s[2])}${n}`:`${r[0]}t${a(s[0])}${n} ${r[0]}b${a(s[2])}${n} ${r[0]}l${a(s[3])}${n} ${r[0]}r${a(s[1])}${n}`}function Z(r,o){let[t,n]=i(o);return U(o)?`op-${t.replace("%","")}${n}`:`op-${+t*100}${n}`}function q(r,o){let[t,n]=i(o);return`text${a(t)}${n}`}function J(r,o){let[t,n]=i(o);return r==="text-decoration-line"?t==="none"?`no-underline${n}`:`${t}${n}`:r==="text-transform"?t==="none"?`normal-case${n}`:`${t}${n}`:r.startsWith("text-decoration")||r==="text-indent"?`${r.split("-")[1]}${a(t)}${n}`:r==="text-underline-offset"?`underline-offset-${t}${n}`:`text-${t}${n}`}function K(r,o){let[t,n]=i(o);return`v-${t}${n}`}function O(r,o){let[t,n]=i(o);return`lh${a(t)}${n}`}var Mr=["border-left","border-top","border-right","border-bottom"];function Q(r,o){let[t,n]=i(o);return r==="border-spacing"?`${r}="[${j(t)}]${n}"`:r==="border-color"?`border${a(t)}${n}`:r==="border-radius"?C(t)||!t.includes(" ")?`border-rd${a(t)}${n}`:`border-rd="[${j(t)}]${n}"`:Mr.some(e=>r.startsWith(e))?t.split(" ").map(e=>`border-${r.split("-")[1][0]}${a(e)}${n}`).join(" "):r==="border-inline-end-width"?`border-e${a(t)}${n}`:r==="border-inline-start-width"?`border-s${a(t)}${n}`:r.startsWith("border-image")?"":/^\d[%|(px)|(rem)]$/.test(t)||r==="border-collapse"?`border-${t}${n}`:r==="border-width"||r==="border-style"?`border${a(t)}${n}`:r==="border-color"?t==="currentColor"?`border-current${n}`:`border${a(t)}${n}`:t.split(" ").map(e=>t==="currentColor"?`border-current${n}`:`border${a(e)}${n}`).join(" ")}function L(r,o){let[t,n]=i(o);return t==="none"?`hidden${n}`:t==="hidden"?`invisible${n}`:`${t}${n}`}function g(r,o){let[t,n]=i(o);return`${r}-${t}${n}`}function v(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}function d(r,o){let[t,n]=i(o);return`${c(r)}${a(t)}${n}`}function F(r,o){let[t,n]=i(o);if(r.startsWith("box-decoration"))return`box-decoration-${t}${n}`;if(r==="box-sizing")return`box-${c(t)}${n}`;let e=/rgba?(\([^)]+\))/g;return t=t.replace(e,(s,m)=>s.replace(m,f(m,"all"))).replace(/\s*,\s*/g,","),`shadow="[${t.replace(/\s+/," ").split(" ").join("_")}]${n}"`}var Er=["contrast","brightness","saturate"],Hr=["grayscale","invert","sepia"];function z(r,o){let[t,n]=i(o),[e,s,m]=t.match(/([\w-]+)\((.*)\)/);return Er.includes(s)?`${s}-${w(m)}${n}`:s==="drop-shadow"?`drop-${F(s,m)}${n}`:Hr.includes(s)?`${s}-${m.endsWith("%")?m.slice(0,-1):w(m)}${n}`:s==="hue-rotate"?`${s}-${m.slice(0,-3)}${n}`:`${s}-${m}${n}`}function X(r,o){let[t,n]=i(o);return`backdrop-${z(r,t)}${n}`}function y(r,o){let[t,n]=i(o);return r==="transform-origin"?`origin-${I(t)}${n}`:r==="transform-style"?`transform-${t}`:H(t).split(" ").map(e=>{let s=e.match(/([a-z]+)([A-Z])?\((.*)\)/);if(!s)return;let[m,p,$,l]=s;return $?p==="scale"?l.includes(",")?`${p}-${$.toLowerCase()}="${l.split(",").join(" ")}${n}"`:`${p}-${$.toLowerCase()}-${w(l)}${n}`:`${p}-${$.toLowerCase()}="${Y(l)}${n}"`:p==="scale"?l.includes(",")?`${p}="${l.split(",").join(" ")}${n}"`:`${p}-${w(l)}${n}`:`${p}="${Y(l).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function Y(r){return r=f(r,"all"),r.endsWith("deg")?r.slice(0,-3):r}var Br=["transition-delay","transition-duration"];function k(r,o){let[t,n]=i(o);if(r==="transition-timing-function")return t==="linear"?`ease-${t}${n}`:`ease="[${f(t,"all")}]${n}"`;if(r==="transition")return`transition="${Gr(t)}"`;if(r==="transition-property")return t.includes("color")?`transition-color${n}`:t==="box-shadow"?`transition-shadow${n}`:`transition-${t}${n}`;if(Br.includes(r))return`${r.split("-")[1]}-${t.slice(0,-2)}`}function Gr(r){let o=!1;return r.split(" ").map(t=>/^[0-9]/.test(t)||/^\.[0-9]/.test(t)?o?`delay${a(t,void 0,!0)}`:(o=!0,`duration${a(t,void 0,!0)}`):t==="background-color"?"colors":t).join(" ")}function rr(r,o){let[t,n]=i(o);return r==="justify-content"?`justify-${u(t)}${n}`:`${r}-${u(t)}${n}`}function tr(r,o){let[t,n]=i(o);return`${u(r)}-${u(t)}${n}`}var Dr=["flex-basis","flex-grow","flex-shrink"];function nr(r,o){let[t,n]=i(o);if(Dr.includes(r))return`${u(r)}-${t}${n}`;if(t==="1")return`flex-1${n}`;let e=f(t)[0];return r==="flex"&&(e==="0"||e==="1")?`flex="[${j(t)}]${n}"`:`${c(r)}-${t.replace("column","col")}${n}`}function or(r,o){let[t,n]=i(o);return t==="auto"?`${c(r)}-${t}`:`${c(r)}="[${f(t,"all")}]${n}"`}function ir(r,o){let[t,n]=i(o);return r==="column-gap"?`gap-x-${t}${n}`:`${r}-${t}${n}`}function er(r,o){let[t,n]=i(o);return o==="isolate"?`${t}${n}`:`${r}-${t}${n}`}function sr(r,o){let[t,n]=i(o);return r==="object-position"?`${c(r)}-${I(t)}${n}`:`${c(r)}-${t}${n}`}function ar(r,o){let[t,n]=i(o),[e,s,m]=r.split("-");return m?`${e}-${m}-${t}${n}`:`${e}-${t}${n}`}function mr(r,o){let[t,n]=i(o);if(r.startsWith("grid-template")){let s=t.match(/repeat\s*\(\s*([0-9]+)/);return s?`grid-${u(r)==="rows"?"rows":"cols"}-${s[1]}${n}`:`grid-${u(r)==="rows"?"rows":"cols"}-${t}${n}`}if(r==="grid-auto-flow")return`grid-flow-${I(t).replace("column","col")}${n}`;if(r.startsWith("grid-auto")){let s=t.match(/minmax\s*\(\s*0\s*,\s*1fr/);return`auto-${u(r)==="rows"?"rows":"cols"}-${s?"fr":c(t)}${n}`}let e=t.match(/span\s+([0-9])/);return e?`${r.slice(5).replace("column","col")}-span-${e[1]}${n}`:f(t,"all")==="1/-1"?`${r.slice(5).replace("column","col")}-span-full${n}`:`${r.slice(5).replace("column","col")}-${t}${n}`}function pr(r,o){let[t,n]=i(o);return`gap-y-${t}${n}`}function fr(r,o){let[t,n]=i(o);return`${r}-${u(t)}${n}`}function cr(r,o){let[t,n]=i(o);return`tracking-${t}${n}`}function lr(r,o){let[t,n]=i(o);return`whitespace-${t}${n}`}function ur(r,o){let[t,n]=i(o);return r.startsWith("word-spacing")?`word-spacing${a(o)}`:t==="keep-all"?`break-keep${n}`:`break-${u(t)}${n}`}function $r(r,o){let[t,n]=i(o);return r==="outline-offset"?`${r}-${t}${n}`:`${c(r)}-${t}${n}`}function gr(r,o){let[t,n]=i(o);return`mix-blend-${t}${n}`}var Zr={vertical:"y",horizontal:"x"};function dr(r,o){let[t,n]=i(o);return t==="both"?`${r}${n}`:`${r}-${Zr[t]||t}${n}`}function xr(r,o){let[t,n]=i(o);if(r.startsWith("scroll-snap"))return`snap-${t}${n}`;if(r==="scroll-behavior")return`scroll-${t}${n}`;let[e,s,m,p]=r.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&p?`scroll-${s[0]}${p[0]}-${t}${n}`:m?`scroll-${s[0]}${m[0]}-${t}${n}`:`scroll-${s[0]}-${t}${n}`}function br(r,o){let[t,n]=i(o);return`${u(r)}-${t}${n}`}function hr(r,o){let[t,n]=i(o);return`${r}-${c(t)}${n}`}function wr(r,o){let[t,n]=i(o);return r==="animation-delay"?`animate${a(t)}${n}`:r==="animation"?`animate-${t.split(" ")[0]}${n}`:`animate-${t}${n}`}function Ir(r,o){let[t,n]=i(o);return`content="[${t}]${n}"`}var qr={show:"visible",hide:"hidden"};function vr(r,o){var e;let[t,n]=i(o);return`table-empty-cells-${(e=qr[t])!=null?e:t}${n}`}function jr(r,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function Wr(r,o){let[t,n]=i(o);if(r==="inset-inline-start")return`start${a(t)}${n}`;if(r==="inset-inline-end")return`end${a(t)}${n}`}var P={animation:wr,aspect:or,backface:d,caption:d,column:ir,columns:g,break:g,empty:vr,box:F,writing:jr,display:L,float:g,clear:g,isolation:er,object:sr,overflow:g,overscroll:ar,position:L,top:v,left:v,right:v,bottom:v,visibility:L,z:N,flex:nr,order:g,grid:mr,gap:v,justify:rr,align:tr,place:fr,padding:A,perspective:g,margin:A,width:N,min:R,max:R,height:N,font:G,letter:cr,line:O,list:d,text:J,vertical:K,white:lr,word:ur,content:Ir,background:B,border:Q,outline:$r,opacity:Z,mix:gr,filter:z,backdrop:X,table:d,transition:k,transform:y,accent:d,appearance:d,cursor:D,caret:d,pointer:g,resize:dr,scroll:xr,inset:Wr,touch:d,user:br,will:hr,fill:g,stroke:d,color:q,row:pr},Jr=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function M(r,o=!1){var $;let t=r.match(Jr);if(!t)return;let[n,e,s]=t,m=c(e),p=($=P[m])==null?void 0:$.call(P,e,s);return p&&o?p.replace(/-([0-9\.]+)px/,(l,x)=>`-${+x/4}`):p}function E(r,o){let t=[];return[r.split(";").filter(Boolean).reduce((n,e)=>{let s=M(e,o)||"";return s||t.push(e),n+=`${s} `},"").trim(),t]}function Kr(r,o=!1){let[t,n]=E(r,o);return[t?t.replace(/="([^"]+)"/g,(e,s)=>`-${s}`):"",n]}export{M as toUnocss,Kr as toUnocssClass,E as transformStyleToUnocss};
1
+ var Qt=".__unocss_transfer__",H=/^(?:calc|clamp|min|max)\s*\(.*\)/,Lt=/[0-9]+(px|rem|em|%|vw|vh|vmin|vmax|deg)/;function Xt(t){return/\[&:not\(/.test(t)}function z(t){return H.test(t)}function p(t){return t.split("-")[0]}function u(t){let o=t.split("-");return o[o.length-1]}function Ft(t){return t.startsWith("url(")}function C(t){return t.endsWith("%")}function B(t){return/^#[0-9A-Fa-f]{2,}$/.test(t)}function x(t){return t.startsWith("rgb")}function G(t){return t.startsWith("hsl")}function a(t,o,r){return z(t)||Ft(t)||B(t)||x(t)||G(t)||C(t)||zt(t)?r?`-[${E(t,"all").replace(/['"]/g,"")}]`:`="[${E(t,"all").replace(/['"]/g,"")}]"`:`-${o?o(t):t}`}function h(t){return typeof t=="string"&&t.endsWith("%")?t.slice(0,-1):+t*100}function w(t){return t.replace(/\s+/," ").split(" ").join("-")}function v(t){return t.replace(/\s+/," ").split(" ").join("_")}function E(t,o="around"){return o==="pre"?t.replace(/(^\s*)/g,""):o==="post"?t.replace(/(\s*$)/g,""):o==="all"?t.replace(/\s+/g,""):o==="around"?t.replace(/(^\s*)|(\s*$)/g,""):t}function i(t){return t=t.replace(/\s+/," ").replace(/\s*,\s*/g,",").replace(/\s*\/\s*/,"/"),/rgb/.test(t)&&(t=t.replace(/rgba?\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/hsl/.test(t)&&(t=t.replace(/hsla?\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),/var\([^\)]+\)/.test(t)&&(t=t.replace(/var\(([^\)]+)\)/g,(o,r)=>{let n=r.trim().split(" ");return o.replace(r,n.map((e,s)=>e.endsWith(",")?e:e+(n.length-1===s?"":",")).join(""))})),t.endsWith("!important")?[t.replace(/\s*\!important/,"").trim(),"!"]:[t.trim(),""]}function Yt(t,o){let r=t.match(/<style scoped>.*<\/style>/s),n=o.match(/<style scoped>.*<\/style>/s);return r[0]===n[0]}function yt(t){return/<style scoped>[\n\s]*<\/style>/.test(t)}function kt(t){let o=t.match(/<style scoped>(.*)<\/style>/s);return o?o[1]:""}function D(t){return t.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function zt(t){return t.startsWith("var(--")}function tr(t){return H.test(t)||Lt.test(t)}function rr(t){return B(t)||x(t)||G(t)}function V(t,o){let[r,n]=i(o);return`${t[0]}${a(r,p)}${n}`}var Ct=["background-color","background-size","background-attachment","background-position"],Ut=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,St=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Tt=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,b="__comma__";function Z(t,o){let[r,n]=i(o);if(Ct.includes(t))return`bg${a(r,S)}${n}`;if(["background","background-image"].includes(t)){if(/(linear)-gradient/.test(r)){let m=r.replace(/rgba?\(([^)]+)\)/g,(c,d)=>c.replace(d,d.replace(/\s*,\s*/g,b))),f=m.match(Ut);if(f){let[c,d,j,W]=f.slice(1);return c=c.split(" ").map(_=>_[0]).join(""),c?`bg-gradient-to-${c}${U(d,j,W)}`:U(d,j,W)}let l=m.match(St);return l?`bg-gradient-linear bg-gradient-[${l[1]},${l[2].replace(/\s+/,"_").replaceAll(b,",")},${l[3].replace(/\s+/,"_").replaceAll(b,",")}]`:void 0}else if(/(radial|conic)-gradient/.test(r)){let f=r.replace(/rgba?\(([^)]+)\)/g,(W,_)=>W.replace(_,_.replace(/\s*,\s*/g,b))).match(Tt);if(!f)return;let l=f[1],[c,d,j]=f.slice(2);return`bg-gradient-${l}${U(c,d,j)}`}let e=r.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${r.replace(m,`[${m}]`)}${n}"`}let s=r.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${r.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(r,S)}${n}`}return t==="background-blend-mode"?`bg-blend-${r}${n}`:`${Rt(t,r)}-${At(r)}${n}`}function Rt(t,o){return o.endsWith("repeat")?"bg":t.replace("background","bg")}function At(t){return/(border)|(content)|(padding)-box/.test(t)?t.replace("-box",""):t.startsWith("repeat-")?t.replace("repeat-",""):S(t)}function S(t){return t.replace(/\s+/," ").replace(" ","-")}function U(t,o,r){let n="";if(o&&!r&&(r=o,o=""),t){t=t.replaceAll(b,",");let[e,s]=t.split(" ");s?n+=` from="${x(e)?`[${e}]`:e} ${s}"`:e&&(n+=` from="${x(e)?`[${e}]`:e}"`)}if(o){o=o.replaceAll(b,",");let[e,s]=o.split(" ");s?n+=` via="${x(e)?`[${e}]`:e} ${s}"`:e&&(n+=` via="${x(e)?`[${e}]`:e}"`)}if(r){r=r.replaceAll(b,",");let[e,s]=r.split(" ");s?n+=` to="${x(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${x(e)?`[${e}]`:e}"`)}return n}function T(t,o){let[r,n]=i(o),e=t.split("-");return`${e[0]}-${e[1][0]}${a(p(r))}${n}`}function q(t,o){let[r,n]=i(o);if(t==="font-size")return`text-${r}${n}`;if(t==="font-weight")return`font-${r}${n}`;if(t==="font-family"){let e=r.match(/ui-(\w{0,4})/);if(!e)return`font-${o}${n}`;let[s,m]=e;return`font-${m}${n}`}return t==="font-style"?r==="normal"?`font-not-italic${n}`:`font-${r}${n}`:t==="font-variant-numeric"?r==="normal"?`normal-nums${n}`:`${r}${n}`:`font="${Pt(r)}${n}"`}function Pt(t){return t.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function J(t,o){let[r,n]=i(o);return`${t}${a(r)}${n}`}var Mt={"margin-left":"ml","margin-right":"mr","margin-top":"mt","margin-bottom":"mb","margin-inline-start":"ms","margin-inline-end":"me","padding-left":"pl","padding-right":"pr","padding-top":"pt","padding-bottom":"pb","padding-inline-start":"ps","padding-inline-end":"pe"};function R(t,o){let[r,n]=i(o),e=Mt[t];if(e)return`${e}${a(r)}${n}`;let s=r.split(" "),m=s.length;return m===1?`${t[0]}${a(s[0])}${n}`:m===2?`${t[0]}x${a(s[1])}${n} ${t[0]}y${a(s[0])}${n}`:m===3?`${t[0]}x${a(s[1])}${n} ${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n}`:`${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n} ${t[0]}l${a(s[3])}${n} ${t[0]}r${a(s[1])}${n}`}function K(t,o){let[r,n]=i(o);return C(o)?`op-${r.replace("%","")}${n}`:`op-${+r*100}${n}`}function O(t,o){let[r,n]=i(o);return`text${a(r)}${n}`}function Q(t,o){let[r,n]=i(o);return t==="text-decoration-line"?r==="none"?`no-underline${n}`:`${r}${n}`:t==="text-transform"?r==="none"?`normal-case${n}`:`${r}${n}`:t.startsWith("text-decoration")||t==="text-indent"?`${t.split("-")[1]}${a(r)}${n}`:t==="text-underline-offset"?`underline-offset-${r}${n}`:`text-${r}${n}`}function X(t,o){let[r,n]=i(o);return`v-${r}${n}`}function Y(t,o){let[r,n]=i(o);return`lh${a(r)}${n}`}var Et=["border-left","border-top","border-right","border-bottom"];function y(t,o){let[r,n]=i(o);return t==="border-spacing"?`${t}="[${v(r)}]${n}"`:t==="border-color"?`border${a(r)}${n}`:t==="border-radius"?z(r)||!r.includes(" ")?`border-rd${a(r)}${n}`:`border-rd="[${v(r)}]${n}"`:Et.some(e=>t.startsWith(e))?r.split(" ").map(e=>`border-${t.split("-")[1][0]}${a(e)}${n}`).join(" "):t==="border-inline-end-width"?`border-e${a(r)}${n}`:t==="border-inline-start-width"?`border-s${a(r)}${n}`:t.startsWith("border-image")?"":/^\d[%|(px)|(rem)]$/.test(r)||t==="border-collapse"?`border-${r}${n}`:t==="border-width"||t==="border-style"?`border${a(r)}${n}`:t==="border-color"?r==="currentColor"?`border-current${n}`:`border${a(r)}${n}`:r.split(" ").map(e=>r==="currentColor"?`border-current${n}`:`border${a(e)}${n}`).join(" ")}function N(t,o){let[r,n]=i(o);return r==="none"?`hidden${n}`:r==="hidden"?`invisible${n}`:`${r}${n}`}function $(t,o){let[r,n]=i(o);return`${t}-${r}${n}`}function I(t,o){let[r,n]=i(o);return`${t}${a(r)}${n}`}function g(t,o){let[r,n]=i(o);return`${p(t)}${a(r)}${n}`}function L(t,o){let[r,n]=i(o);return t.startsWith("box-decoration")?`box-decoration-${r}${n}`:t==="box-sizing"?`box-${p(r)}${n}`:`shadow="[${r.split(" ").join("_")}]${n}"`}var Ht=["contrast","brightness","saturate"],Bt=["grayscale","invert","sepia"];function F(t,o){let[r,n]=i(o),[e,s,m]=r.match(/([\w-]+)\((.*)\)/);return Ht.includes(s)?`${s}-${h(m)}${n}`:s==="drop-shadow"?`drop-${L(s,m)}${n}`:Bt.includes(s)?`${s}-${m.endsWith("%")?m.slice(0,-1):h(m)}${n}`:s==="hue-rotate"?`${s}-${m.slice(0,-3)}${n}`:`${s}-${m}${n}`}function k(t,o){let[r,n]=i(o);return`backdrop-${F(t,r)}${n}`}function rt(t,o){let[r,n]=i(o);return t==="transform-origin"?`origin-${w(r)}${n}`:t==="transform-style"?`transform-${r}`:D(r).split(" ").map(e=>{let s=e.match(/([a-z]+)([A-Z])?\((.*)\)/);if(!s)return;let[m,f,l,c]=s;return l?f==="scale"?c.includes(",")?`${f}-${l.toLowerCase()}="${c.split(",").join(" ")}${n}"`:`${f}-${l.toLowerCase()}-${h(c)}${n}`:`${f}-${l.toLowerCase()}="${tt(c)}${n}"`:f==="scale"?c.includes(",")?`${f}="${c.split(",").join(" ")}${n}"`:`${f}-${h(c)}${n}`:`${f}="${tt(c).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function tt(t){return t.endsWith("deg")?t.slice(0,-3):t}var Gt=["transition-delay","transition-duration"];function nt(t,o){let[r,n]=i(o);if(t==="transition-timing-function")return r==="linear"?`ease-${r}${n}`:`ease="[${r}]${n}"`;if(t==="transition")return`transition="${Dt(r)}"`;if(t==="transition-property")return r.includes("color")?`transition-color${n}`:r==="box-shadow"?`transition-shadow${n}`:`transition-${r}${n}`;if(Gt.includes(t))return`${t.split("-")[1]}-${r.slice(0,-2)}`}function Dt(t){let o=!1;return t.split(" ").map(r=>/^[0-9]/.test(r)||/^\.[0-9]/.test(r)?o?`delay${a(r,void 0,!0)}`:(o=!0,`duration${a(r,void 0,!0)}`):r==="background-color"?"colors":r).join(" ")}function ot(t,o){let[r,n]=i(o);return t==="justify-content"?`justify-${u(r)}${n}`:`${t}-${u(r)}${n}`}function it(t,o){let[r,n]=i(o);return`${u(t)}-${u(r)}${n}`}var Zt=["flex-basis","flex-grow","flex-shrink"];function et(t,o){let[r,n]=i(o);if(Zt.includes(t))return`${u(t)}-${r}${n}`;if(r==="1")return`flex-1${n}`;let e=r[0];return t==="flex"&&(e==="0"||e==="1")?`flex="[${v(r)}]${n}"`:`${p(t)}-${r.replace("column","col")}${n}`}function st(t,o){let[r,n]=i(o);return r==="auto"?`${p(t)}-${r}`:`${p(t)}="[${r}]${n}"`}function at(t,o){let[r,n]=i(o);return t==="column-gap"?`gap-x-${r}${n}`:`${t}-${r}${n}`}function mt(t,o){let[r,n]=i(o);return o==="isolate"?`${r}${n}`:`${t}-${r}${n}`}function pt(t,o){let[r,n]=i(o);return t==="object-position"?`${p(t)}-${w(r)}${n}`:`${p(t)}-${r}${n}`}function ft(t,o){let[r,n]=i(o),[e,s,m]=t.split("-");return m?`${e}-${m}-${r}${n}`:`${e}-${r}${n}`}function ct(t,o){let[r,n]=i(o);if(t.startsWith("grid-template")){let s=r.match(/repeat\s*\(\s*([0-9]+)/);return s?`grid-${u(t)==="rows"?"rows":"cols"}-${s[1]}${n}`:`grid-${u(t)==="rows"?"rows":"cols"}-${r}${n}`}if(t==="grid-auto-flow")return`grid-flow-${w(r).replace("column","col")}${n}`;if(t.startsWith("grid-auto")){let s=r.match(/minmax\s*\(\s*0\s*,\s*1fr/);return`auto-${u(t)==="rows"?"rows":"cols"}-${s?"fr":p(r)}${n}`}let e=r.match(/span\s+([0-9])/);return e?`${t.slice(5).replace("column","col")}-span-${e[1]}${n}`:r==="1/-1"?`${t.slice(5).replace("column","col")}-span-full${n}`:`${t.slice(5).replace("column","col")}-${r}${n}`}function ut(t,o){let[r,n]=i(o);return`gap-y-${r}${n}`}function lt(t,o){let[r,n]=i(o);return`${t}-${u(r)}${n}`}function $t(t,o){let[r,n]=i(o);return`tracking-${r}${n}`}function gt(t,o){let[r,n]=i(o);return`whitespace-${r}${n}`}function dt(t,o){let[r,n]=i(o);return t.startsWith("word-spacing")?`word-spacing${a(o)}`:r==="keep-all"?`break-keep${n}`:`break-${u(r)}${n}`}function xt(t,o){let[r,n]=i(o);return t==="outline-offset"?`${t}-${r}${n}`:`${p(t)}-${r}${n}`}function bt(t,o){let[r,n]=i(o);return`mix-blend-${r}${n}`}var qt={vertical:"y",horizontal:"x"};function ht(t,o){let[r,n]=i(o);return r==="both"?`${t}${n}`:`${t}-${qt[r]||r}${n}`}function wt(t,o){let[r,n]=i(o);if(t.startsWith("scroll-snap"))return`snap-${r}${n}`;if(t==="scroll-behavior")return`scroll-${r}${n}`;let[e,s,m,f]=t.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&f?`scroll-${s[0]}${f[0]}-${r}${n}`:m?`scroll-${s[0]}${m[0]}-${r}${n}`:`scroll-${s[0]}-${r}${n}`}function It(t,o){let[r,n]=i(o);return`${u(t)}-${r}${n}`}function vt(t,o){let[r,n]=i(o);return`${t}-${p(r)}${n}`}function jt(t,o){let[r,n]=i(o);return t==="animation-delay"?`animate${a(r)}${n}`:t==="animation"?`animate-${r.split(" ")[0]}${n}`:`animate-${r}${n}`}function Wt(t,o){let[r,n]=i(o);return r==='" "'||r==="' '"?`content-['_']${n}`:`content="[${r}]${n}"`}var Jt={show:"visible",hide:"hidden"};function _t(t,o){var e;let[r,n]=i(o);return`table-empty-cells-${(e=Jt[r])!=null?e:r}${n}`}function Vt(t,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function Nt(t,o){let[r,n]=i(o);if(t==="inset-inline-start")return`start${a(r)}${n}`;if(t==="inset-inline-end")return`end${a(r)}${n}`}var A={animation:jt,aspect:st,backface:g,caption:g,column:at,columns:$,break:$,empty:_t,box:L,writing:Vt,display:N,float:$,clear:$,isolation:mt,object:pt,overflow:$,overscroll:ft,position:N,top:I,left:I,right:I,bottom:I,visibility:N,z:V,flex:et,order:$,grid:ct,gap:I,justify:ot,align:it,place:lt,padding:R,perspective:$,margin:R,width:V,min:T,max:T,height:V,font:q,letter:$t,line:Y,list:g,text:Q,vertical:X,white:gt,word:dt,content:Wt,background:Z,border:y,outline:xt,opacity:K,mix:bt,filter:F,backdrop:k,table:g,transition:nt,transform:rt,accent:g,appearance:g,cursor:J,caret:g,pointer:$,resize:ht,scroll:wt,inset:Nt,touch:g,user:It,will:vt,fill:$,stroke:g,color:O,row:ut},Kt=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function P(t,o=!1){var l;let r=t.match(Kt);if(!r)return;let[n,e,s]=r,m=p(e),f=(l=A[m])==null?void 0:l.call(A,e,s);return f&&o?f.replace(/-([0-9\.]+)px/,(c,d)=>`-${+d/4}`):f}function M(t,o){let r=[];return[t.split(";").filter(Boolean).reduce((n,e)=>{let s=P(e,o)||"";return s||r.push(e),n+=`${s} `},"").trim(),r]}function Ot(t,o=!1){let[r,n]=M(t,o);return[r?r.replace(/="([^"]+)"/g,(e,s)=>`-${s}`):"",n]}export{H as cssMathFnRE,Yt as diffTemplateStyle,Qt as flag,p as getFirstName,h as getHundred,u as getLastName,kt as getStyleScoped,a as getVal,z as isCalc,rr as isColor,yt as isEmptyStyle,B as isHex,G as isHsl,Xt as isNot,C as isPercent,x as isRgb,tr as isSize,Ft as isUrl,zt as isVar,D as joinEmpty,w as joinWithLine,v as joinWithUnderLine,Lt as numberWithUnitRE,P as toUnocss,Ot as toUnocssClass,i as transformImportant,M as transformStyleToUnocss,E as trim};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transform-to-unocss-core",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "packageManager": "pnpm@7.2.1",
5
5
  "description": "",
6
6
  "author": "Simon He",