transform-to-unocss-core 0.0.13 → 0.0.14

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 Sr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Rr=Object.prototype.hasOwnProperty;var Ar=(r,o)=>{for(var t in o)T(r,t,{get:o[t],enumerable:!0})},Pr=(r,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of Tr(o))!Rr.call(r,e)&&e!==t&&T(r,e,{get:()=>o[e],enumerable:!(n=Sr(o,e))||n.enumerable});return r};var Mr=r=>Pr(T({},"__esModule",{value:!0}),r);var pt={};Ar(pt,{cssMathFnRE:()=>A,diffTemplateStyle:()=>Br,flag:()=>Er,getFirstName:()=>p,getHundred:()=>b,getLastName:()=>c,getStyleScoped:()=>Dr,getVal:()=>a,isCalc:()=>V,isColor:()=>qr,isEmptyStyle:()=>Gr,isHex:()=>P,isHsl:()=>M,isNot:()=>Hr,isPercent:()=>N,isRgb:()=>$,isSize:()=>Zr,isUrl:()=>J,isVar:()=>K,joinEmpty:()=>E,joinWithLine:()=>h,joinWithUnderLine:()=>I,numberWithUnitRE:()=>q,toUnocss:()=>U,toUnocssClass:()=>Ur,transformImportant:()=>i,transformStyleToUnocss:()=>S,trim:()=>R});module.exports=Mr(pt);var Er=".__unocss_transfer__",A=/^(?:calc|clamp|min|max)\s*\(.*\)/,q=/[0-9]+(px|rem|em|%|vw|vh|vmin|vmax|deg)/;function Hr(r){return/\[&:not\(/.test(r)}function V(r){return A.test(r)}function p(r){return r.split("-")[0]}function c(r){let o=r.split("-");return o[o.length-1]}function J(r){return r.startsWith("url(")}function N(r){return r.endsWith("%")}function P(r){return/^#[0-9A-Fa-f]{2,}$/.test(r)}function $(r){return r.startsWith("rgb")}function M(r){return r.startsWith("hsl")}function a(r,o,t){return V(r)||J(r)||P(r)||$(r)||M(r)||N(r)||K(r)?t?`-[${R(r,"all").replace(/['"]/g,"")}]`:`="[${R(r,"all").replace(/['"]/g,"")}]"`:`-${o?o(r):r}`}function b(r){return typeof r=="string"&&r.endsWith("%")?r.slice(0,-1):+r*100}function h(r){return r.replace(/\s+/," ").split(" ").join("-")}function I(r){return r.replace(/\s+/," ").split(" ").join("_")}function R(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+/," ").replace(/\s*,\s*/g,",").replace(/\s*\/\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 Br(r,o){let t=r.match(/<style scoped>.*<\/style>/s),n=o.match(/<style scoped>.*<\/style>/s);return t[0]===n[0]}function Gr(r){return/<style scoped>[\n\s]*<\/style>/.test(r)}function Dr(r){let o=r.match(/<style scoped>(.*)<\/style>/s);return o?o[1]:""}function E(r){return r.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function K(r){return r.startsWith("var(--")}function Zr(r){return A.test(r)||q.test(r)}function qr(r){return P(r)||$(r)||M(r)}function L(r,o){let[t,n]=i(o);return`${r[0]}${a(t,p)}${n}`}var Jr=["background-color","background-size","background-attachment","background-position"],Kr=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Or=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Qr=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,w="__comma__";function O(r,o){let[t,n]=i(o);if(Jr.includes(r))return`bg${a(t,B)}${n}`;if(["background","background-image"].includes(r)){if(/(linear)-gradient/.test(t)){let m=t.replace(/rgba?\(([^)]+)\)/g,(u,x)=>u.replace(x,x.replace(/\s*,\s*/g,w))),f=m.match(Kr);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(Or);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(t)){let f=t.replace(/rgba?\(([^)]+)\)/g,(W,_)=>W.replace(_,_.replace(/\s*,\s*/g,w))).match(Qr);if(!f)return;let l=f[1],[u,x,j]=f.slice(2);return`bg-gradient-${l}${H(u,x,j)}`}let e=t.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${t.replace(m,`[${m}]`)}${n}"`}let s=t.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${t.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(t,B)}${n}`}return r==="background-blend-mode"?`bg-blend-${t}${n}`:`${Xr(r,t)}-${Yr(t)}${n}`}function Xr(r,o){return o.endsWith("repeat")?"bg":r.replace("background","bg")}function Yr(r){return/(border)|(content)|(padding)-box/.test(r)?r.replace("-box",""):r.startsWith("repeat-")?r.replace("repeat-",""):B(r)}function B(r){return r.replace(/\s+/," ").replace(" ","-")}function H(r,o,t){let n="";if(o&&!t&&(t=o,o=""),r){r=r.replaceAll(w,",");let[e,s]=r.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(t){t=t.replaceAll(w,",");let[e,s]=t.split(" ");s?n+=` to="${$(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${$(e)?`[${e}]`:e}"`)}return n}function G(r,o){let[t,n]=i(o),e=r.split("-");return`${e[0]}-${e[1][0]}${a(p(t))}${n}`}function Q(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="${yr(t)}${n}"`}function yr(r){return r.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function X(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}var kr={"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(r,o){let[t,n]=i(o),e=kr[r];if(e)return`${e}${a(t)}${n}`;let s=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 Y(r,o){let[t,n]=i(o);return N(o)?`op-${t.replace("%","")}${n}`:`op-${+t*100}${n}`}function y(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 rr(r,o){let[t,n]=i(o);return`v-${t}${n}`}function tr(r,o){let[t,n]=i(o);return`lh${a(t)}${n}`}var rt=["border-left","border-top","border-right","border-bottom"];function nr(r,o){let[t,n]=i(o);return r==="border-spacing"?`${r}="[${I(t)}]${n}"`:r==="border-color"?`border${a(t)}${n}`:r==="border-radius"?V(t)||!t.includes(" ")?`border-rd${a(t)}${n}`:`border-rd="[${I(t)}]${n}"`:rt.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 F(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`${p(r)}${a(t)}${n}`}function z(r,o){let[t,n]=i(o);return r.startsWith("box-decoration")?`box-decoration-${t}${n}`:r==="box-sizing"?`box-${p(t)}${n}`:`shadow="[${t.split(" ").join("_")}]${n}"`}var tt=["contrast","brightness","saturate"],nt=["grayscale","invert","sepia"];function C(r,o){let[t,n]=i(o),[e,s,m]=t.match(/([\w-]+)\((.*)\)/);return tt.includes(s)?`${s}-${b(m)}${n}`:s==="drop-shadow"?`drop-${z(s,m)}${n}`:nt.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 or(r,o){let[t,n]=i(o);return`backdrop-${C(r,t)}${n}`}function er(r,o){let[t,n]=i(o);return r==="transform-origin"?`origin-${h(t)}${n}`:r==="transform-style"?`transform-${t}`:E(t).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()}="${ir(u)}${n}"`:f==="scale"?u.includes(",")?`${f}="${u.split(",").join(" ")}${n}"`:`${f}-${b(u)}${n}`:`${f}="${ir(u).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function ir(r){return r.endsWith("deg")?r.slice(0,-3):r}var ot=["transition-delay","transition-duration"];function sr(r,o){let[t,n]=i(o);if(r==="transition-timing-function")return t==="linear"?`ease-${t}${n}`:`ease="[${t}]${n}"`;if(r==="transition")return`transition="${it(t)}"`;if(r==="transition-property")return t.includes("color")?`transition-color${n}`:t==="box-shadow"?`transition-shadow${n}`:`transition-${t}${n}`;if(ot.includes(r))return`${r.split("-")[1]}-${t.slice(0,-2)}`}function it(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 ar(r,o){let[t,n]=i(o);return r==="justify-content"?`justify-${c(t)}${n}`:`${r}-${c(t)}${n}`}function mr(r,o){let[t,n]=i(o);return`${c(r)}-${c(t)}${n}`}var et=["flex-basis","flex-grow","flex-shrink"];function pr(r,o){let[t,n]=i(o);if(et.includes(r))return`${c(r)}-${t}${n}`;if(t==="1")return`flex-1${n}`;let e=t[0];return r==="flex"&&(e==="0"||e==="1")?`flex="[${I(t)}]${n}"`:`${p(r)}-${t.replace("column","col")}${n}`}function fr(r,o){let[t,n]=i(o);return t==="auto"?`${p(r)}-${t}`:`${p(r)}="[${t}]${n}"`}function cr(r,o){let[t,n]=i(o);return r==="column-gap"?`gap-x-${t}${n}`:`${r}-${t}${n}`}function ur(r,o){let[t,n]=i(o);return o==="isolate"?`${t}${n}`:`${r}-${t}${n}`}function lr(r,o){let[t,n]=i(o);return r==="object-position"?`${p(r)}-${h(t)}${n}`:`${p(r)}-${t}${n}`}function $r(r,o){let[t,n]=i(o),[e,s,m]=r.split("-");return m?`${e}-${m}-${t}${n}`:`${e}-${t}${n}`}function gr(r,o){let[t,n]=i(o);if(r.startsWith("grid-template")){let s=t.match(/repeat\s*\(\s*([0-9]+)/);return s?`grid-${c(r)==="rows"?"rows":"cols"}-${s[1]}${n}`:`grid-${c(r)==="rows"?"rows":"cols"}-${t}${n}`}if(r==="grid-auto-flow")return`grid-flow-${h(t).replace("column","col")}${n}`;if(r.startsWith("grid-auto")){let s=t.match(/minmax\s*\(\s*0\s*,\s*1fr/);return`auto-${c(r)==="rows"?"rows":"cols"}-${s?"fr":p(t)}${n}`}let e=t.match(/span\s+([0-9])/);return e?`${r.slice(5).replace("column","col")}-span-${e[1]}${n}`:t==="1/-1"?`${r.slice(5).replace("column","col")}-span-full${n}`:`${r.slice(5).replace("column","col")}-${t}${n}`}function dr(r,o){let[t,n]=i(o);return`gap-y-${t}${n}`}function xr(r,o){let[t,n]=i(o);return`${r}-${c(t)}${n}`}function br(r,o){let[t,n]=i(o);return`tracking-${t}${n}`}function hr(r,o){let[t,n]=i(o);return`whitespace-${t}${n}`}function wr(r,o){let[t,n]=i(o);return r.startsWith("word-spacing")?`word-spacing${a(o)}`:t==="keep-all"?`break-keep${n}`:`break-${c(t)}${n}`}function Ir(r,o){let[t,n]=i(o);return r==="outline-offset"?`${r}-${t}${n}`:`${p(r)}-${t}${n}`}function vr(r,o){let[t,n]=i(o);return`mix-blend-${t}${n}`}var st={vertical:"y",horizontal:"x"};function jr(r,o){let[t,n]=i(o);return t==="both"?`${r}${n}`:`${r}-${st[t]||t}${n}`}function Wr(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,f]=r.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&f?`scroll-${s[0]}${f[0]}-${t}${n}`:m?`scroll-${s[0]}${m[0]}-${t}${n}`:`scroll-${s[0]}-${t}${n}`}function _r(r,o){let[t,n]=i(o);return`${c(r)}-${t}${n}`}function Vr(r,o){let[t,n]=i(o);return`${r}-${p(t)}${n}`}function Nr(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 Lr(r,o){let[t,n]=i(o);return`content="[${t}]${n}"`}var at={show:"visible",hide:"hidden"};function Fr(r,o){var e;let[t,n]=i(o);return`table-empty-cells-${(e=at[t])!=null?e:t}${n}`}function zr(r,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function Cr(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 Z={animation:Nr,aspect:fr,backface:d,caption:d,column:cr,columns:g,break:g,empty:Fr,box:z,writing:zr,display:F,float:g,clear:g,isolation:ur,object:lr,overflow:g,overscroll:$r,position:F,top:v,left:v,right:v,bottom:v,visibility:F,z:L,flex:pr,order:g,grid:gr,gap:v,justify:ar,align:mr,place:xr,padding:D,perspective:g,margin:D,width:L,min:G,max:G,height:L,font:Q,letter:br,line:tr,list:d,text:k,vertical:rr,white:hr,word:wr,content:Lr,background:O,border:nr,outline:Ir,opacity:Y,mix:vr,filter:C,backdrop:or,table:d,transition:sr,transform:er,accent:d,appearance:d,cursor:X,caret:d,pointer:g,resize:jr,scroll:Wr,inset:Cr,touch:d,user:_r,will:Vr,fill:g,stroke:d,color:y,row:dr},mt=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function U(r,o=!1){var l;let t=r.match(mt);if(!t)return;let[n,e,s]=t,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(r,o){let t=[];return[r.split(";").filter(Boolean).reduce((n,e)=>{let s=U(e,o)||"";return s||t.push(e),n+=`${s} `},"").trim(),t]}function Ur(r,o=!1){let[t,n]=S(r,o);return[t?t.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 Qr=".__unocss_transfer__",H=/^(?:calc|clamp|min|max)\s*\(.*\)/,Lr=/[0-9]+(px|rem|em|%|vw|vh|vmin|vmax|deg)/;function Xr(r){return/\[&:not\(/.test(r)}function z(r){return H.test(r)}function p(r){return r.split("-")[0]}function u(r){let o=r.split("-");return o[o.length-1]}function Fr(r){return r.startsWith("url(")}function C(r){return r.endsWith("%")}function B(r){return/^#[0-9A-Fa-f]{2,}$/.test(r)}function x(r){return r.startsWith("rgb")}function G(r){return r.startsWith("hsl")}function a(r,o,t){return z(r)||Fr(r)||B(r)||x(r)||G(r)||C(r)||zr(r)?t?`-[${E(r,"all").replace(/['"]/g,"")}]`:`="[${E(r,"all").replace(/['"]/g,"")}]"`:`-${o?o(r):r}`}function h(r){return typeof r=="string"&&r.endsWith("%")?r.slice(0,-1):+r*100}function w(r){return r.replace(/\s+/," ").split(" ").join("-")}function v(r){return r.replace(/\s+/," ").split(" ").join("_")}function E(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+/," ").replace(/\s*,\s*/g,",").replace(/\s*\/\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 Yr(r,o){let t=r.match(/<style scoped>.*<\/style>/s),n=o.match(/<style scoped>.*<\/style>/s);return t[0]===n[0]}function yr(r){return/<style scoped>[\n\s]*<\/style>/.test(r)}function kr(r){let o=r.match(/<style scoped>(.*)<\/style>/s);return o?o[1]:""}function D(r){return r.replace(/\(\s*/g,"(").replace(/\s*\)/g,")").replace(/\s*,\s*/g,",")}function zr(r){return r.startsWith("var(--")}function rt(r){return H.test(r)||Lr.test(r)}function tt(r){return B(r)||x(r)||G(r)}function V(r,o){let[t,n]=i(o);return`${r[0]}${a(t,p)}${n}`}var Cr=["background-color","background-size","background-attachment","background-position"],Ur=/linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Sr=/linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,Tr=/(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/,b="__comma__";function Z(r,o){let[t,n]=i(o);if(Cr.includes(r))return`bg${a(t,S)}${n}`;if(["background","background-image"].includes(r)){if(/(linear)-gradient/.test(t)){let m=t.replace(/rgba?\(([^)]+)\)/g,(c,d)=>c.replace(d,d.replace(/\s*,\s*/g,b))),f=m.match(Ur);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(Sr);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(t)){let f=t.replace(/rgba?\(([^)]+)\)/g,(W,_)=>W.replace(_,_.replace(/\s*,\s*/g,b))).match(Tr);if(!f)return;let l=f[1],[c,d,j]=f.slice(2);return`bg-gradient-${l}${U(c,d,j)}`}let e=t.match(/rgba?\([^)]+\)/);if(e){let m=e[0];return`bg="${t.replace(m,`[${m}]`)}${n}"`}let s=t.match(/url\(["'\s\.\-_\w\/]*\)/);return s?`bg="${t.replace(s[0],`[${s[0].replace(/['"]/g,"")}]${n}`)}"`:`bg${a(t,S)}${n}`}return r==="background-blend-mode"?`bg-blend-${t}${n}`:`${Rr(r,t)}-${Ar(t)}${n}`}function Rr(r,o){return o.endsWith("repeat")?"bg":r.replace("background","bg")}function Ar(r){return/(border)|(content)|(padding)-box/.test(r)?r.replace("-box",""):r.startsWith("repeat-")?r.replace("repeat-",""):S(r)}function S(r){return r.replace(/\s+/," ").replace(" ","-")}function U(r,o,t){let n="";if(o&&!t&&(t=o,o=""),r){r=r.replaceAll(b,",");let[e,s]=r.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(t){t=t.replaceAll(b,",");let[e,s]=t.split(" ");s?n+=` to="${x(e)?`[${e}]`:e} ${s}"`:e&&(n+=` to="${x(e)?`[${e}]`:e}"`)}return n}function T(r,o){let[t,n]=i(o),e=r.split("-");return`${e[0]}-${e[1][0]}${a(p(t))}${n}`}function q(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="${Pr(t)}${n}"`}function Pr(r){return r.split(" ").map(o=>/^[0-9]/.test(o)?`text-${o}`:o).join(" ")}function J(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}var Mr={"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(r,o){let[t,n]=i(o),e=Mr[r];if(e)return`${e}${a(t)}${n}`;let s=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 K(r,o){let[t,n]=i(o);return C(o)?`op-${t.replace("%","")}${n}`:`op-${+t*100}${n}`}function O(r,o){let[t,n]=i(o);return`text${a(t)}${n}`}function Q(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 X(r,o){let[t,n]=i(o);return`v-${t}${n}`}function Y(r,o){let[t,n]=i(o);return`lh${a(t)}${n}`}var Er=["border-left","border-top","border-right","border-bottom"];function y(r,o){let[t,n]=i(o);return r==="border-spacing"?`${r}="[${v(t)}]${n}"`:r==="border-color"?`border${a(t)}${n}`:r==="border-radius"?z(t)||!t.includes(" ")?`border-rd${a(t)}${n}`:`border-rd="[${v(t)}]${n}"`:Er.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 N(r,o){let[t,n]=i(o);return t==="none"?`hidden${n}`:t==="hidden"?`invisible${n}`:`${t}${n}`}function $(r,o){let[t,n]=i(o);return`${r}-${t}${n}`}function I(r,o){let[t,n]=i(o);return`${r}${a(t)}${n}`}function g(r,o){let[t,n]=i(o);return`${p(r)}${a(t)}${n}`}function L(r,o){let[t,n]=i(o);return r.startsWith("box-decoration")?`box-decoration-${t}${n}`:r==="box-sizing"?`box-${p(t)}${n}`:`shadow="[${t.split(" ").join("_")}]${n}"`}var Hr=["contrast","brightness","saturate"],Br=["grayscale","invert","sepia"];function F(r,o){let[t,n]=i(o),[e,s,m]=t.match(/([\w-]+)\((.*)\)/);return Hr.includes(s)?`${s}-${h(m)}${n}`:s==="drop-shadow"?`drop-${L(s,m)}${n}`:Br.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(r,o){let[t,n]=i(o);return`backdrop-${F(r,t)}${n}`}function tr(r,o){let[t,n]=i(o);return r==="transform-origin"?`origin-${w(t)}${n}`:r==="transform-style"?`transform-${t}`:D(t).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()}="${rr(c)}${n}"`:f==="scale"?c.includes(",")?`${f}="${c.split(",").join(" ")}${n}"`:`${f}-${h(c)}${n}`:`${f}="${rr(c).replace(/,/g," ")}${n}"`}).filter(Boolean).join(" ")}function rr(r){return r.endsWith("deg")?r.slice(0,-3):r}var Gr=["transition-delay","transition-duration"];function nr(r,o){let[t,n]=i(o);if(r==="transition-timing-function")return t==="linear"?`ease-${t}${n}`:`ease="[${t}]${n}"`;if(r==="transition")return`transition="${Dr(t)}"`;if(r==="transition-property")return t.includes("color")?`transition-color${n}`:t==="box-shadow"?`transition-shadow${n}`:`transition-${t}${n}`;if(Gr.includes(r))return`${r.split("-")[1]}-${t.slice(0,-2)}`}function Dr(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 or(r,o){let[t,n]=i(o);return r==="justify-content"?`justify-${u(t)}${n}`:`${r}-${u(t)}${n}`}function ir(r,o){let[t,n]=i(o);return`${u(r)}-${u(t)}${n}`}var Zr=["flex-basis","flex-grow","flex-shrink"];function er(r,o){let[t,n]=i(o);if(Zr.includes(r))return`${u(r)}-${t}${n}`;if(t==="1")return`flex-1${n}`;let e=t[0];return r==="flex"&&(e==="0"||e==="1")?`flex="[${v(t)}]${n}"`:`${p(r)}-${t.replace("column","col")}${n}`}function sr(r,o){let[t,n]=i(o);return t==="auto"?`${p(r)}-${t}`:`${p(r)}="[${t}]${n}"`}function ar(r,o){let[t,n]=i(o);return r==="column-gap"?`gap-x-${t}${n}`:`${r}-${t}${n}`}function mr(r,o){let[t,n]=i(o);return o==="isolate"?`${t}${n}`:`${r}-${t}${n}`}function pr(r,o){let[t,n]=i(o);return r==="object-position"?`${p(r)}-${w(t)}${n}`:`${p(r)}-${t}${n}`}function fr(r,o){let[t,n]=i(o),[e,s,m]=r.split("-");return m?`${e}-${m}-${t}${n}`:`${e}-${t}${n}`}function cr(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-${w(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":p(t)}${n}`}let e=t.match(/span\s+([0-9])/);return e?`${r.slice(5).replace("column","col")}-span-${e[1]}${n}`:t==="1/-1"?`${r.slice(5).replace("column","col")}-span-full${n}`:`${r.slice(5).replace("column","col")}-${t}${n}`}function ur(r,o){let[t,n]=i(o);return`gap-y-${t}${n}`}function lr(r,o){let[t,n]=i(o);return`${r}-${u(t)}${n}`}function $r(r,o){let[t,n]=i(o);return`tracking-${t}${n}`}function gr(r,o){let[t,n]=i(o);return`whitespace-${t}${n}`}function dr(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 xr(r,o){let[t,n]=i(o);return r==="outline-offset"?`${r}-${t}${n}`:`${p(r)}-${t}${n}`}function br(r,o){let[t,n]=i(o);return`mix-blend-${t}${n}`}var qr={vertical:"y",horizontal:"x"};function hr(r,o){let[t,n]=i(o);return t==="both"?`${r}${n}`:`${r}-${qr[t]||t}${n}`}function wr(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,f]=r.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);return m==="inline"&&f?`scroll-${s[0]}${f[0]}-${t}${n}`:m?`scroll-${s[0]}${m[0]}-${t}${n}`:`scroll-${s[0]}-${t}${n}`}function Ir(r,o){let[t,n]=i(o);return`${u(r)}-${t}${n}`}function vr(r,o){let[t,n]=i(o);return`${r}-${p(t)}${n}`}function jr(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 Wr(r,o){let[t,n]=i(o);return`content="[${t}]${n}"`}var Jr={show:"visible",hide:"hidden"};function _r(r,o){var e;let[t,n]=i(o);return`table-empty-cells-${(e=Jr[t])!=null?e:t}${n}`}function Vr(r,o){return o==="horizontal-tb"?"write-normal":`write-${o.replace("-rl","-right").replace("-lr","-left")}`}function Nr(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 A={animation:jr,aspect:sr,backface:g,caption:g,column:ar,columns:$,break:$,empty:_r,box:L,writing:Vr,display:N,float:$,clear:$,isolation:mr,object:pr,overflow:$,overscroll:fr,position:N,top:I,left:I,right:I,bottom:I,visibility:N,z:V,flex:er,order:$,grid:cr,gap:I,justify:or,align:ir,place:lr,padding:R,perspective:$,margin:R,width:V,min:T,max:T,height:V,font:q,letter:$r,line:Y,list:g,text:Q,vertical:X,white:gr,word:dr,content:Wr,background:Z,border:y,outline:xr,opacity:K,mix:br,filter:F,backdrop:k,table:g,transition:nr,transform:tr,accent:g,appearance:g,cursor:J,caret:g,pointer:$,resize:hr,scroll:wr,inset:Nr,touch:g,user:Ir,will:vr,fill:$,stroke:g,color:O,row:ur},Kr=/([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!]+)/;function P(r,o=!1){var l;let t=r.match(Kr);if(!t)return;let[n,e,s]=t,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(r,o){let t=[];return[r.split(";").filter(Boolean).reduce((n,e)=>{let s=P(e,o)||"";return s||t.push(e),n+=`${s} `},"").trim(),t]}function Or(r,o=!1){let[t,n]=M(r,o);return[t?t.replace(/="([^"]+)"/g,(e,s)=>`-${s}`):"",n]}export{H as cssMathFnRE,Yr as diffTemplateStyle,Qr as flag,p as getFirstName,h as getHundred,u as getLastName,kr as getStyleScoped,a as getVal,z as isCalc,tt as isColor,yr as isEmptyStyle,B as isHex,G as isHsl,Xr as isNot,C as isPercent,x as isRgb,rt as isSize,Fr as isUrl,zr as isVar,D as joinEmpty,w as joinWithLine,v as joinWithUnderLine,Lr as numberWithUnitRE,P as toUnocss,Or 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.14",
4
4
  "packageManager": "pnpm@7.2.1",
5
5
  "description": "",
6
6
  "author": "Simon He",