@fwkui/x-css 1.0.18 → 1.0.19
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-auto.js +11 -11
- package/dist/index-auto.js.map +1 -1
- package/dist/index-auto.mjs +11 -11
- package/dist/index-auto.mjs.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index-auto.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var we=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Be=e=>(e=e||new Map,{all:e,on(t,n){let s=e.get(t);s?s.push(n):e.set(t,[n])},off(t,n){let s=e.get(t);s&&(n?s.splice(s.indexOf(n)>>>0,1):e.set(t,[]))},emit(t,n){let s=e.get(t);s&&s.slice().forEach(d=>{d(n)});let o=e.get("*");o&&o.slice().forEach(d=>{d(t,n)})}});function lt(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){s>0&&s--;continue}if(d===58&&s===0)return o}return-1}function ct(e,t,n){let s=0;for(let o=n-1;o>=t;o--){let d=e.charCodeAt(o);if(d===93){s++;continue}if(d===91){s>0&&s--;continue}if(d===64&&s===0)return o}return-1}function dt(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){if(s===0)return!1;s--}}return s===0}function ft(e){return e>=97&&e<=122}function le(e){if(!e||e.length<2||!dt(e,0,e.length))return null;let t=0,n=e.length,s="",o=ct(e,t,n);o>t&&(s=e.substring(o+1,n),n=o);let d="",h="",u=lt(e,t,n);if(u>0&&u<n){let X=e.substring(t,u);t=u+1,d=X}let O=t;for(;O<n;){let X=e.charCodeAt(O);if(X>=48&&X<=57)O++;else break}if(O>t&&(h=e.substring(t,O),t=O),t>=n||e.charCodeAt(t)===38)return null;if(e.charCodeAt(t)===91){let X=e.indexOf("]",t);if(X>t)return{mq:d,layer:h,prop:e.substring(t,X+1),val:"",selector:s}}let R=t;for(;R<n;){let X=e.charCodeAt(R);if(X===45||X===46){if(R+1<n){let b=e.charCodeAt(R+1);if(X===45&&b===45&&R>t||b>=48&&b<=57)break}R++;continue}if(!ft(X))break;R++}if(R===t)return null;let K=e.substring(t,R),M=e.substring(R,n);return{mq:d,layer:h,prop:K,val:M,selector:s}}var We=e=>{let t=typeof e?.styleId=="string"&&e.styleId.trim()?e.styleId.trim():"fwkui",n=typeof e?.version=="string"&&e.version.trim()?e.version.trim():"v1",s=e?.compression??!0,o=typeof e?.debounceMs=="number"&&e.debounceMs>=0?e.debounceMs:1e3;return{styleId:t,version:n,compression:s,debounceMs:o}},ut=e=>`${e.styleId}_cache_${e.version}`,pt=e=>`${e.styleId}_sizeL_${e.version}`,Ve=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===2&&t.compressed===!0&&typeof t.payload=="string"},xe=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===3&&t.compressed===!0&&t.algorithm==="deflate-raw"&&t.encoding==="base64"&&typeof t.payload=="string"},Ue=()=>typeof CompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",Ne=()=>typeof DecompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",yt=e=>{if(typeof btoa=="function"){let n="";for(let o=0;o<e.length;o+=32768){let d=e.subarray(o,o+32768);for(let h=0;h<d.length;h++)n+=String.fromCharCode(d[h])}return btoa(n)}let t=globalThis.Buffer;if(typeof t<"u")return t.from(e).toString("base64");throw new Error("XCSS: base64 encoding is not supported in this runtime")},St=e=>{if(typeof atob=="function"){let n=atob(e),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return s}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("XCSS: base64 decoding is not supported in this runtime")},gt=async e=>{if(!Ue())throw new Error("XCSS: CompressionStream is not supported");let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate-raw")),n=await new Response(t).arrayBuffer();return yt(new Uint8Array(n))},ht=async e=>{if(!Ne())throw new Error("XCSS: DecompressionStream is not supported");let t=St(e),n=new Uint8Array(t.length);n.set(t);let s=new Blob([n.buffer]).stream().pipeThrough(new DecompressionStream("deflate-raw"));return await new Response(s).text()},mt=e=>{try{let t=JSON.parse(e);return xe(t)}catch{return!1}},Ct=e=>{if(!e)return"";let t=new Map,n=[],s=256;for(let d=0;d<256;d++)t.set(String.fromCharCode(d),d);let o=e[0];for(let d=1;d<e.length;d++){let h=e[d],u=o+h;t.has(u)?o=u:(n.push(t.get(o)),t.set(u,s++),o=h)}return n.push(t.get(o)),n.map(d=>String.fromCharCode(d)).join("")},ze=e=>{if(!e)return"";let t=new Map,n=256,s="";for(let u=0;u<256;u++)t.set(u,String.fromCharCode(u));let o=e.split("").map(u=>u.charCodeAt(0)),d=o[0],h=t.get(d)||"";s=h;for(let u=1;u<o.length;u++){let O=o[u],R=t.get(O);R||(R=O===n?h+h[0]:""),s+=R,t.set(n++,h+R[0]),h=R}return s},ve=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.default&&typeof t.default=="object"?t.default:t,s=n.SHORT_PROPERTIES,o=n.COMMON_VALUES,d=n.SPECIFIC_VALUES;return!s||!o||!d||typeof s!="object"||typeof o!="object"||typeof d!="object"?null:{SHORT_PROPERTIES:s,COMMON_VALUES:o,SPECIFIC_VALUES:d}},bt=async e=>{let t=await import(e),n=ve(t);if(!n)throw new Error(qe);return n},qe="XCSS: dictionary module must export SHORT_PROPERTIES, COMMON_VALUES and SPECIFIC_VALUES",Fe=()=>{let e=typeof we=="function"?we:null;if(!e)return null;for(let t of["./dictionary.js","./dictionary"])try{let n=e(t),s=ve(n);if(s)return s}catch{}return null},wt=async()=>{let e=Fe();if(e)return e;let t=["./dictionary.mjs","./dictionary.js","./dictionary"],n=null;for(let s of t)try{let o=await import(s),d=ve(o);if(d)return d}catch(o){n=o}throw n||new Error(qe)},xt=(e,t)=>{if(!e||typeof document>"u")return;t=t||"fwkui";let n=Array.from({length:24},(s,o)=>"l"+o);if(!e.querySelector('style[id="'+t+'"]')){let s=document.createElement("style");if(s.id=t,!(e instanceof ShadowRoot))document.head.append(s);else try{e.prepend(s)}catch{e.appendChild(s)}let o=`@layer ${n.join(", ")};`,d=setInterval(()=>{if(s.sheet){clearInterval(d);try{s.sheet.insertRule(o,s.sheet.cssRules.length)}catch{}}},10)}},vt=e=>{let t=Array.isArray(e.excludes)?e.excludes:[],n=We(e.cache),s=JSON.stringify({base:e.base||"",aliases:e.aliases||{},breakpoints:e.breakpoints||[],theme:e.theme||{},prefix:e.prefix||"",excludes:t,excludePrefixes:e.excludePrefixes||[],dictionaryImport:e.dictionaryImport??!0,cache:n}),o=0;if(s.length===0)return o.toString();for(let d=0;d<s.length;d++){let h=s.charCodeAt(d);o=(o<<5)-o+h,o|=0}return o.toString()},Ke=e=>{if(!e)return null;try{let t=JSON.parse(e);if(Ve(t)){let n=ze(t.payload);return n?JSON.parse(n):null}return xe(t)?null:t}catch{return null}},Et=async e=>{if(!e)return null;try{let t=JSON.parse(e);if(Ve(t)){let n=ze(t.payload);return n?JSON.parse(n):null}if(xe(t)){let n=await ht(t.payload);return n?JSON.parse(n):null}return t}catch{return null}},He=(e,t)=>{if(e==="root")return t;let n=/@media[^{]+\{\n?([\s\S]+)\n?\}/.exec(t);return n&&n[1]?n[1].trim():t},Ee=(e={base:"",aliases:{},excludes:[],excludePrefixes:[],breakpoints:[],theme:{},prefix:"",dictionaryImport:!0,cache:{styleId:"fwkui",version:"v1",compression:!0,debounceMs:1e3}})=>{let{base:t=null,breakpoints:n=[],aliases:s={},theme:o={},excludes:d=[],excludePrefixes:h=[],prefix:u="",dictionaryImport:O=!0,cache:R={}}=e||{};Array.isArray(n)||(n=[]),Array.isArray(d)||(d=[]),Array.isArray(h)||(h=[]),(!s||typeof s!="object")&&(s={}),(!o||typeof o!="object")&&(o={});let K=We(R),M=ut(K),X=d,b=h.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0),L=r=>{let a=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return new RegExp("^"+a.replace(/\*/g,".*")+"$")},Y=X.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0).map(r=>{if(r.includes("*")){let a=L(r);return c=>a.test(c)}return a=>a===r}),ce=r=>b.some(a=>r.startsWith(a))?!0:Y.some(a=>a(r)),de=r=>!(ce(r)||u&&!r.startsWith(u)),Ze=["default","xs","sm","md","lg","xl","2xl","sma","mda","lga","xla"],Je=n.filter(r=>!!r&&typeof r=="object"&&!Array.isArray(r)).map(r=>Object.keys(r)[0]).filter(r=>typeof r=="string"&&r.length>0),Ge=new Set([...Ze,...Je]),fe=r=>!r||Ge.has(r),Ye=O!==!1,Qe=new Set(["mx","my","px","py","bdx","bdy"]),ue=new Set,pe=r=>r?!Ye||!z||Object.keys(z).length===0?!0:!!z[r]||Qe.has(r)||ue.has(r):!1,z={},ne={},ye={},Se={},_e=()=>{Se={...ye,...o}},F=r=>{if(!r){z={},ne={},ye={},ue=new Set,_e();return}z=r.SHORT_PROPERTIES,ne=r.SPECIFIC_VALUES,ye=r.COMMON_VALUES,ue=new Set(Object.values(z)),_e()},Z=!0,se=Promise.resolve();if(O===!1)F(null);else if(typeof O=="string")Z=!1,F(null),se=bt(O).then(r=>{F(r)}).catch(r=>{console.warn("XCSS: Failed to import dictionary from URL",r)}).finally(()=>{Z=!0});else{let r=Fe();r?F(r):(Z=!1,F(null),se=wt().then(a=>{F(a)}).catch(a=>{console.warn("XCSS: Failed to load built-in dictionary module",a)}).finally(()=>{Z=!0}))}let Q=null,et=(r=typeof document<"u"?document:void 0)=>{let a=typeof window<"u"&&typeof document<"u",c=null,g=Array.isArray(t)?t.length>0:!!t;r&&(c="getRootNode"in r?r.getRootNode():r);let y=new Map,x=new Set,v=1e3,p=pt(K);a&&c&&xt(c,K.styleId);let m=Be(),S=[{default:""},{xs:"screen and (max-width: 575px)"},{sm:"screen and (min-width: 576px)"},{md:"screen and (min-width: 768px)"},{lg:"screen and (min-width: 992px)"},{xl:"screen and (min-width: 1200px)"},{"2xl":"screen and (min-width: 1400px)"},{sma:"screen and (max-width: 768px)"},{mda:"screen and (max-width: 992px)"},{lga:"screen and (max-width: 1200px)"},{xla:"screen and (max-width: 1400px)"},...n],$=S.filter((i,l)=>S.findLastIndex(f=>Object.keys(f)[0]==Object.keys(i)[0])==l),I=$.map(i=>Object.keys(i)[0]),D={},T={},_={root:""},ee={root:[]},k={root:!1},H=vt(e),V=null,J=0,j=!1,B=null,q=null,U=i=>{try{window.localStorage.setItem(M,i)}catch(l){console.warn("XCSS: Failed to save cache",l)}},te=()=>{if(!(!a||!window.localStorage))try{let i=parseInt(window.localStorage.getItem(p)||"0",10);i>v&&(v=i)}catch{}},E=()=>{if(!(!a||!window.localStorage))try{window.localStorage.setItem(p,String(v))}catch{}},oe=i=>{!a||!window.localStorage||typeof i=="string"&&window.localStorage.getItem(M)!==i||window.localStorage.removeItem(M)},me=i=>{if(!a||!window.localStorage)return;Q=i;let l=++J;try{let f=JSON.stringify(i),w=()=>{let C={__xcss_cache_v:2,compressed:!0,payload:Ct(f)};U(JSON.stringify(C))};if(!K.compression){U(f);return}if(Ue()&&Ne()){gt(f).then(C=>{if(l!==J)return;U(JSON.stringify({__xcss_cache_v:3,compressed:!0,algorithm:"deflate-raw",encoding:"base64",payload:C}))}).catch(()=>{l===J&&w()});return}w()}catch(f){console.warn("XCSS: Failed to save cache",f)}},ie=()=>{a&&(V&&clearTimeout(V),V=setTimeout(()=>{let i={};for(let w in D)i[w]=Array.from(D[w]);let l={};Object.keys(_).forEach(w=>{if(w==="root")l[w]=_[w];else{let C=S.find(P=>Object.keys(P)[0]===w)?.[w];C&&_[w]?l[w]=`@media ${C} {
|
|
2
|
-
${
|
|
3
|
-
}`:l[w]=
|
|
4
|
-
`),
|
|
5
|
-
`:"")+
|
|
6
|
-
`),je&&je.replaceSync(
|
|
7
|
-
`:"")+
|
|
8
|
-
`),
|
|
1
|
+
var we=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Be=e=>(e=e||new Map,{all:e,on(t,n){let s=e.get(t);s?s.push(n):e.set(t,[n])},off(t,n){let s=e.get(t);s&&(n?s.splice(s.indexOf(n)>>>0,1):e.set(t,[]))},emit(t,n){let s=e.get(t);s&&s.slice().forEach(d=>{d(n)});let o=e.get("*");o&&o.slice().forEach(d=>{d(t,n)})}});function ot(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){s>0&&s--;continue}if(d===58&&s===0)return o}return-1}function it(e,t,n){let s=0;for(let o=n-1;o>=t;o--){let d=e.charCodeAt(o);if(d===93){s++;continue}if(d===91){s>0&&s--;continue}if(d===64&&s===0)return o}return-1}function at(e,t,n){let s=0;for(let o=t;o<n;o++){let d=e.charCodeAt(o);if(d===91){s++;continue}if(d===93){if(s===0)return!1;s--}}return s===0}function lt(e){return e>=97&&e<=122}function ie(e){if(!e||e.length<2||!at(e,0,e.length))return null;let t=0,n=e.length,s="",o=it(e,t,n);o>t&&(s=e.substring(o+1,n),n=o);let d="",m="",u=ot(e,t,n);if(u>0&&u<n){let O=e.substring(t,u);t=u+1,d=O}let k=t;for(;k<n;){let O=e.charCodeAt(k);if(O>=48&&O<=57)k++;else break}if(k>t&&(m=e.substring(t,k),t=k),t>=n||e.charCodeAt(t)===38)return null;if(e.charCodeAt(t)===91){let O=e.indexOf("]",t);if(O>t)return{mq:d,layer:m,prop:e.substring(t,O+1),val:"",selector:s}}let D=t;for(;D<n;){let O=e.charCodeAt(D);if(O===45||O===46){if(D+1<n){let b=e.charCodeAt(D+1);if(O===45&&b===45&&D>t||b>=48&&b<=57)break}D++;continue}if(!lt(O))break;D++}if(D===t)return null;let K=e.substring(t,D),P=e.substring(D,n);return{mq:d,layer:m,prop:K,val:P,selector:s}}var Ke=e=>{let t=typeof e?.styleId=="string"&&e.styleId.trim()?e.styleId.trim():"fwkui",n=typeof e?.version=="string"&&e.version.trim()?e.version.trim():"v1",s=e?.compression??!0,o=typeof e?.debounceMs=="number"&&e.debounceMs>=0?e.debounceMs:1e3;return{styleId:t,version:n,compression:s,debounceMs:o}},ct=e=>`${e.styleId}_cache_${e.version}`,We=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===2&&t.compressed===!0&&typeof t.payload=="string"},ve=e=>{if(!e||typeof e!="object")return!1;let t=e;return t.__xcss_cache_v===3&&t.compressed===!0&&t.algorithm==="deflate-raw"&&t.encoding==="base64"&&typeof t.payload=="string"},Ue=()=>typeof CompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",Ve=()=>typeof DecompressionStream<"u"&&typeof Blob<"u"&&typeof Response<"u",dt=e=>{if(typeof btoa=="function"){let n="";for(let o=0;o<e.length;o+=32768){let d=e.subarray(o,o+32768);for(let m=0;m<d.length;m++)n+=String.fromCharCode(d[m])}return btoa(n)}let t=globalThis.Buffer;if(typeof t<"u")return t.from(e).toString("base64");throw new Error("XCSS: base64 encoding is not supported in this runtime")},ft=e=>{if(typeof atob=="function"){let n=atob(e),s=new Uint8Array(n.length);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return s}let t=globalThis.Buffer;if(typeof t<"u")return new Uint8Array(t.from(e,"base64"));throw new Error("XCSS: base64 decoding is not supported in this runtime")},ut=async e=>{if(!Ue())throw new Error("XCSS: CompressionStream is not supported");let t=new Blob([e]).stream().pipeThrough(new CompressionStream("deflate-raw")),n=await new Response(t).arrayBuffer();return dt(new Uint8Array(n))},pt=async e=>{if(!Ve())throw new Error("XCSS: DecompressionStream is not supported");let t=ft(e),n=new Uint8Array(t.length);n.set(t);let s=new Blob([n.buffer]).stream().pipeThrough(new DecompressionStream("deflate-raw"));return await new Response(s).text()},yt=e=>{try{let t=JSON.parse(e);return ve(t)}catch{return!1}},St=e=>{if(!e)return"";let t=new Map,n=[],s=256;for(let d=0;d<256;d++)t.set(String.fromCharCode(d),d);let o=e[0];for(let d=1;d<e.length;d++){let m=e[d],u=o+m;t.has(u)?o=u:(n.push(t.get(o)),t.set(u,s++),o=m)}return n.push(t.get(o)),n.map(d=>String.fromCharCode(d)).join("")},Ne=e=>{if(!e)return"";let t=new Map,n=256,s="";for(let u=0;u<256;u++)t.set(u,String.fromCharCode(u));let o=e.split("").map(u=>u.charCodeAt(0)),d=o[0],m=t.get(d)||"";s=m;for(let u=1;u<o.length;u++){let k=o[u],D=t.get(k);D||(D=k===n?m+m[0]:""),s+=D,t.set(n++,m+D[0]),m=D}return s},Ee=e=>{if(!e||typeof e!="object")return null;let t=e,n=t.default&&typeof t.default=="object"?t.default:t,s=n.SHORT_PROPERTIES,o=n.COMMON_VALUES,d=n.SPECIFIC_VALUES;return!s||!o||!d||typeof s!="object"||typeof o!="object"||typeof d!="object"?null:{SHORT_PROPERTIES:s,COMMON_VALUES:o,SPECIFIC_VALUES:d}},gt=async e=>{let t=await import(e),n=Ee(t);if(!n)throw new Error(ze);return n},ze="XCSS: dictionary module must export SHORT_PROPERTIES, COMMON_VALUES and SPECIFIC_VALUES",qe=()=>{let e=typeof we=="function"?we:null;if(!e)return null;for(let t of["./dictionary.js","./dictionary"])try{let n=e(t),s=Ee(n);if(s)return s}catch{}return null},ht=async()=>{let e=qe();if(e)return e;let t=["./dictionary.mjs","./dictionary.js","./dictionary"],n=null;for(let s of t)try{let o=await import(s),d=Ee(o);if(d)return d}catch(o){n=o}throw n||new Error(ze)},mt=(e,t)=>{if(!e||typeof document>"u")return;t=t||"fwkui";let n=Array.from({length:24},(s,o)=>"l"+o);if(!e.querySelector('style[id="'+t+'"]')){let s=document.createElement("style");if(s.id=t,!(e instanceof ShadowRoot))document.head.append(s);else try{e.prepend(s)}catch{e.appendChild(s)}let o=`@layer ${n.join(", ")};`,d=setInterval(()=>{if(s.sheet){clearInterval(d);try{s.sheet.insertRule(o,s.sheet.cssRules.length)}catch{}}},10)}},Ct=e=>{let t=Array.isArray(e.excludes)?e.excludes:[],n=Ke(e.cache),s=JSON.stringify({base:e.base||"",aliases:e.aliases||{},breakpoints:e.breakpoints||[],theme:e.theme||{},prefix:e.prefix||"",excludes:t,excludePrefixes:e.excludePrefixes||[],dictionaryImport:e.dictionaryImport??!0,cache:n}),o=0;if(s.length===0)return o.toString();for(let d=0;d<s.length;d++){let m=s.charCodeAt(d);o=(o<<5)-o+m,o|=0}return o.toString()},xe=e=>{if(!e)return null;try{let t=JSON.parse(e);if(We(t)){let n=Ne(t.payload);return n?JSON.parse(n):null}return ve(t)?null:t}catch{return null}},bt=async e=>{if(!e)return null;try{let t=JSON.parse(e);if(We(t)){let n=Ne(t.payload);return n?JSON.parse(n):null}if(ve(t)){let n=await pt(t.payload);return n?JSON.parse(n):null}return t}catch{return null}},He=(e,t)=>{if(e==="root")return t;let n=/@media[^{]+\{\n?([\s\S]+)\n?\}/.exec(t);return n&&n[1]?n[1].trim():t},Re=(e={base:"",aliases:{},excludes:[],excludePrefixes:[],breakpoints:[],theme:{},prefix:"",dictionaryImport:!0,cache:{styleId:"fwkui",version:"v1",compression:!0,debounceMs:1e3}})=>{let{base:t=null,breakpoints:n=[],aliases:s={},theme:o={},excludes:d=[],excludePrefixes:m=[],prefix:u="",dictionaryImport:k=!0,cache:D={}}=e||{};Array.isArray(n)||(n=[]),Array.isArray(d)||(d=[]),Array.isArray(m)||(m=[]),(!s||typeof s!="object")&&(s={}),(!o||typeof o!="object")&&(o={});let K=Ke(D),P=ct(K),O=d,b=m.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0),X=r=>{let i=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return new RegExp("^"+i.replace(/\*/g,".*")+"$")},J=O.filter(r=>typeof r=="string").map(r=>r.trim()).filter(r=>r.length>0).map(r=>{if(r.includes("*")){let i=X(r);return c=>i.test(c)}return i=>i===r}),ae=r=>b.some(i=>r.startsWith(i))?!0:J.some(i=>i(r)),le=r=>!(ae(r)||u&&!r.startsWith(u)),Fe=["default","xs","sm","md","lg","xl","2xl","sma","mda","lga","xla"],Ze=n.filter(r=>!!r&&typeof r=="object"&&!Array.isArray(r)).map(r=>Object.keys(r)[0]).filter(r=>typeof r=="string"&&r.length>0),Je=new Set([...Fe,...Ze]),ce=r=>!r||Je.has(r),Ge=k!==!1,Ye=new Set(["mx","my","px","py","bdx","bdy"]),de=new Set,fe=r=>r?!Ge||!N||Object.keys(N).length===0?!0:!!N[r]||Ye.has(r)||de.has(r):!1,N={},te={},ue={},pe={},ke=()=>{pe={...ue,...o}},q=r=>{if(!r){N={},te={},ue={},de=new Set,ke();return}N=r.SHORT_PROPERTIES,te=r.SPECIFIC_VALUES,ue=r.COMMON_VALUES,de=new Set(Object.values(N)),ke()},F=!0,re=Promise.resolve();if(k===!1)q(null);else if(typeof k=="string")F=!1,q(null),re=gt(k).then(r=>{q(r)}).catch(r=>{console.warn("XCSS: Failed to import dictionary from URL",r)}).finally(()=>{F=!0});else{let r=qe();r?q(r):(F=!1,q(null),re=ht().then(i=>{q(i)}).catch(i=>{console.warn("XCSS: Failed to load built-in dictionary module",i)}).finally(()=>{F=!0}))}let G=null,Qe=(r=typeof document<"u"?document:void 0)=>{let i=typeof window<"u"&&typeof document<"u",c=null,S=Array.isArray(t)?t.length>0:!!t;r&&(c="getRootNode"in r?r.getRootNode():r);let p=new Map,v=new Set,T=1e3;i&&c&&mt(c,K.styleId);let y=Be(),g=[{default:""},{xs:"screen and (max-width: 575px)"},{sm:"screen and (min-width: 576px)"},{md:"screen and (min-width: 768px)"},{lg:"screen and (min-width: 992px)"},{xl:"screen and (min-width: 1200px)"},{"2xl":"screen and (min-width: 1400px)"},{sma:"screen and (max-width: 768px)"},{mda:"screen and (max-width: 992px)"},{lga:"screen and (max-width: 1200px)"},{xla:"screen and (max-width: 1400px)"},...n],h=g.filter((a,l)=>g.findLastIndex(f=>Object.keys(f)[0]==Object.keys(a)[0])==l),$=h.map(a=>Object.keys(a)[0]),x={},E={},R={root:""},ne={root:[]},Y={root:!1},I=Ct(e),j=null,W=0,U=!1,B=null,M=null,Q=a=>{try{window.localStorage.setItem(P,a)}catch(l){console.warn("XCSS: Failed to save cache",l)}},z=a=>{!i||!window.localStorage||typeof a=="string"&&window.localStorage.getItem(P)!==a||window.localStorage.removeItem(P)},ge=a=>{if(!i||!window.localStorage)return;G=a;let l=++W;try{let f=JSON.stringify(a),w=()=>{let C={__xcss_cache_v:2,compressed:!0,payload:St(f)};Q(JSON.stringify(C))};if(!K.compression){Q(f);return}if(Ue()&&Ve()){ut(f).then(C=>{if(l!==W)return;Q(JSON.stringify({__xcss_cache_v:3,compressed:!0,algorithm:"deflate-raw",encoding:"base64",payload:C}))}).catch(()=>{l===W&&w()});return}w()}catch(f){console.warn("XCSS: Failed to save cache",f)}},A=()=>{i&&(j&&clearTimeout(j),j=setTimeout(()=>{let a={};for(let w in x)a[w]=Array.from(x[w]);let l={};Object.keys(R).forEach(w=>{if(w==="root")l[w]=R[w];else{let C=g.find(L=>Object.keys(L)[0]===w)?.[w];C&&R[w]?l[w]=`@media ${C} {
|
|
2
|
+
${R[w]}
|
|
3
|
+
}`:l[w]=R[w]||""}});let f={configHash:I,cssText:l,rulesSet:a,keys:Array.from(p.entries()),sizeLast:T};ge(f)},K.debounceMs))};if(i&&window.localStorage)try{let a=window.localStorage.getItem(P);if(a){let l=xe(a);if(!l)yt(a)?M={raw:a}:window.localStorage.removeItem(P);else if(l.configHash!==I)window.localStorage.removeItem(P);else{if(B=l,U=!0,l.keys&&l.keys.forEach(([f,w])=>{p.set(f,w),v.add(w)}),typeof l.sizeLast=="number"&&(T=l.sizeLast),l.cssText)for(let f in l.cssText)R[f]=He(f,l.cssText[f]);G=l}}}catch(a){console.error(a)}i&&(E.root=new CSSStyleSheet),$.forEach(a=>{if(x[a]=new Set,i){let l=h.find(f=>Object.keys(f)[0]==a)?.[a]||"";E[a]=new CSSStyleSheet({media:l})}U||(R[a]=""),ne[a]=[],Y[a]=!1});let he=()=>{if(!c)return;let a=c.querySelector(`style[id="${K.styleId}"]`);a&&a.remove()},se=a=>{if(a.keys&&a.keys.forEach(([l,f])=>{p.set(l,f),v.add(f)}),typeof a.sizeLast=="number"&&(T=a.sizeLast),a.cssText)for(let l in a.cssText){if(l==="root"&&S)continue;let f=He(l,a.cssText[l]);R[l]=f,i&&E[l]&&E[l].replaceSync(f)}if(a.rulesSet)for(let l in a.rulesSet)x[l]||(x[l]=new Set),a.rulesSet[l].forEach(f=>x[l].add(f));G=a,he()};U&&B&&se(B),t&&Array.isArray(t)?(R.root=t.join(`
|
|
4
|
+
`),i&&E.root&&E.root.replaceSync(R.root)):(R.root=t||"",i&&E.root&&E.root.replaceSync(R.root)),i&&c&&["root",...$].forEach(a=>{E[a]&&c?.adoptedStyleSheets&&(c.adoptedStyleSheets.includes(E[a])||(c.adoptedStyleSheets=[...c.adoptedStyleSheets,E[a]]))}),i&&window.localStorage&&M&&!U&&(async()=>{let a=await bt(M.raw);if(!a){z(M.raw);return}if(a.configHash!==I){z(M.raw);return}U=!0,B=a,se(a)})(),i&&window.addEventListener&&window.addEventListener("storage",a=>{if(a.key===P&&a.newValue)try{let l=xe(a.newValue);l&&l.configHash===I&&(typeof l.sizeLast=="number"&&l.sizeLast>T&&(T=l.sizeLast),l.keys&&l.keys.forEach(([f,w])=>{p.has(f)||(p.set(f,w),v.add(w))}))}catch{}});let me=(a,l)=>{let{media:f,property:w,selector:C,layer:L,className:_}=l,V=R,H=ne,Ce=Y;L=Number(L)||0;let $e=p.get(a),st=$e?`.${$e}${C}`:`.${_}${C}`;var be=`@layer l${L}{${st}{${w}}}`;x[f]||(x[f]=new Set);let Me=x[f];if(!Me.has(be))if(Me.add(be),H[f]||(H[f]=[]),H[f].push(be),i)Ce[f]||(Ce[f]=!0,queueMicrotask(()=>{let ee=H[f],je=E[f];ee.length>0&&(V[f]+=(V[f]?`
|
|
5
|
+
`:"")+ee.join(`
|
|
6
|
+
`),je&&je.replaceSync(V[f]),H[f]=[],A()),Ce[f]=!1}));else{let ee=H[f];ee.length>0&&(V[f]+=(V[f]?`
|
|
7
|
+
`:"")+ee.join(`
|
|
8
|
+
`),H[f]=[])}},oe=a=>{a.forEach(l=>{let f=Le(l);f&&me(l,f)})},Pe=a=>{if(a.length===0)return;let l=()=>oe(a);F?l():re.then(l)};return y.on("observeDom",Pe),{clsx:(...a)=>{let l=a.map(C=>Array.isArray(C)?C:[C]).flat(1/0).map(C=>typeof C=="string"?C.split(/(\s|\t)+/g):[]).flat(1/0);l=l.filter(C=>typeof C=="string"&&C.trim()),l=[...new Set(l)];let f=C=>{if(!le(C))return!1;if(F)return!!Le(C);let L=u?C.slice(u.length):C,_=ie(L);if(!_||!ce(_.mq))return!1;let V=(_.selector||"").replace(/(';|;)/g,H=>H=="';"?";":" ");return V&&!ye(V)?!1:_.prop.startsWith("[")?!!Oe(_.prop+_.val):fe(_.prop)?(_.prop==="&",_.val.length>0):!1},w=l.map(C=>{let L=C;if(p.has(C))L=p.get(C);else if(f(C)){let _;do _="D"+(T++).toString(32).toUpperCase();while(v.has(_));p.set(C,_),v.add(_),L=_,A()}return L});return i?queueMicrotask(()=>y.emit("observeDom",l)):y.emit("observeDom",l),w.join(" ")},observe:()=>{!i||!c||nt(c,a=>{Pe(a)})},getCssString:()=>Object.entries(R).map(([a,l])=>{if(!l)return"";if(a==="root"||a==="default")return l;let f=g.find(w=>Object.keys(w)[0]===a)?.[a];return f?`@media ${f} {
|
|
9
9
|
${l}
|
|
10
10
|
}`:l}).join(`
|
|
11
|
-
`)}};function
|
|
11
|
+
`)}};function Oe(r){let i=new RegExp("^(\\[(?<p>[a-zA-Z]+)\\])$"),{p:c=""}=i.exec(r)?.groups??{};if(c&&s[c]&&Array.isArray(s[c])){let S=s[c],p=[],v=!0,T=y=>{let g=y.trim();if(!g)return null;let h=g.endsWith(";")?g.slice(0,-1).trim():g,$=h.indexOf(":");if($<=0||$>=h.length-1)return null;let x=h.slice(0,$).trim(),E=h.slice($+1).trim();return!x||!E||!/^(?:--[a-zA-Z0-9-_]+|-?[a-zA-Z][a-zA-Z0-9-]*)$/.test(x)?null:`${x}:${E}`};for(let y of S){if(typeof y!="string"){v=!1;break}let g=T(y);if(g){if(typeof CSS<"u"&&!CSS.supports(g)){v=!1;break}p.push(g);continue}v=!1;break}if(p.length>0&&v)return p.join(";")}return null}function Xe(r,i){let c=Oe(r+i);if(c)return c;if(!r||i===void 0)return null;let S=N[r],p=S||r,v=i[0],T=!1,y=i;if(v==="!"&&(T=!0,y=y.substring(1),v=y[0]),y.startsWith("--"))y="var("+y+")";else if(v==="["&&y.endsWith("]"))y=y.substring(1,y.length-1);else if(y.length>0){let x=y[0].toLowerCase()+y.substring(1),E=te[r]?.[x]||pe[x];if(!E){let R=y.toLowerCase();E=te[r]?.[R]||pe[R]}y=E||y}if(y=y.replace(/(';|;)/g,x=>x=="';"?";":" "),!y)return null;let g=y+(T?" !important":""),h=[p+":"+g];switch(p){case"mx":h=[`margin-left:${g}`,`margin-right:${g}`];break;case"my":h=[`margin-top:${g}`,`margin-bottom:${g}`];break;case"px":h=[`padding-left:${g}`,`padding-right:${g}`];break;case"py":h=[`padding-top:${g}`,`padding-bottom:${g}`];break;case"bdx":h=[`border-left:${g}`,`border-right:${g}`];break;case"bdy":h=[`border-top:${g}`,`border-bottom:${g}`];break}return!(typeof CSS<"u")||h.every(x=>CSS.supports(x))?h.join(";"):null}let et=r=>{let i=0;for(let c=r.length-1;c>=0;c--){let S=r[c];if(S==="]"){i++;continue}if(S==="["){i>0&&i--;continue}if(S==="@"&&i===0)return{body:r.slice(0,c),selector:r.slice(c+1)}}return{body:r,selector:""}},tt=r=>{let i=[],c=0,S=0;for(let p=0;p<r.length;p++){let v=r[p];if(v==="["){S++;continue}if(v==="]"){S>0&&S--;continue}v==="&"&&S===0&&(i.push(r.slice(c,p)),c=p+1)}return i.push(r.slice(c)),i},ye=r=>{if(!r)return!0;let i=r.trim();if(!i)return!0;if(/[{}]/.test(i)||i==="#"||i==="("||i===")"||i===","||i===">"||i==="+"||i==="~"||i.startsWith("(")||i.startsWith(")"))return!1;let c=0;for(let S=0;S<i.length;S++){let p=i[S];if(p==="("){c++;continue}if(p===")"){if(c===0)return!1;c--}}return c===0};function Le(r){if(!le(r))return null;let i=u?r.slice(u.length):r,c=typeof CSS<"u"?CSS.escape(r):rt(r);if(i.includes("&")&&!i.startsWith("&")){let{body:R,selector:ne}=et(i),Y=tt(R).map(I=>I.trim()).filter(I=>I.length>0).map(I=>u&&I.startsWith(u)?I.slice(u.length):I);if(Y.length>1){let I="",j="",W=ne,U=!1,B=[];for(let z of Y){let ge=W?`${z}@${W}`:z,A=ie(ge);if(!A||!ce(A.mq)||!A.prop.startsWith("[")&&!fe(A.prop))return null;U?(!A.mq&&I&&(A.mq=I),!A.layer&&j&&(A.layer=j)):(I=A.mq||"",j=A.layer||"",U=!0);let he=A.mq||"",se=A.layer||"",me=A.selector||"";if(he!==I||se!==j||me!==W)return null;let oe=Xe(A.prop,A.val);if(!oe)return null;B.push(oe)}if(B.length===0)return null;let M=W.replace(/(';|;)/g,z=>z=="';"?";":" "),Q=`selector(${c}${M})`;if(M){if(typeof CSS<"u"){if(!CSS.supports(Q))return null}else if(!ye(M))return null}return{media:I||"default",layer:j||"0",className:c,property:B.join(";"),selector:M,cssRules:`.${c}${M}{${B.join(";")}}`}}}let S=ie(i);if(!S||!ce(S.mq)||!S.prop.startsWith("[")&&!fe(S.prop))return null;let{mq:p="default",layer:v="0",prop:T,val:y,selector:g=""}=S,h=[],$=Xe(T,y);if($&&h.push($),h.length===0)return null;let x=g.replace(/(';|;)/g,R=>R=="';"?";":" "),E=`selector(${c}${x})`;if(x){if(typeof CSS<"u"){if(!CSS.supports(E))return null}else if(!ye(x))return null}return{media:p||"default",layer:v||"0",className:c,property:h.join(";"),selector:x,cssRules:`.${c}${x}{${h.join(";")}}`}}let rt=r=>r.replace(/([^\w-])/g,"\\$1"),Se=r=>{var i=[...r?.classList||[]].filter(c=>{if(c){let S=c.charCodeAt(0)==45?c.charCodeAt(1):c.charCodeAt(0);return S>=97&&S<=122||S>=48&&S<=57}return!1});return r?.children?.length>0&&Array.from(r?.children).forEach(c=>{i.push(...Se(c))}),i.flat(1/0)},nt=(r,i)=>{if(typeof i!="function")throw new Error("Callback is not a function");if(!r)return;let c;"documentElement"in r?c=r.documentElement:(r instanceof Element||"tagName"in r||"host"in r)&&(c=r),c&&(c instanceof Element&&i(Se(c)),typeof MutationObserver<"u"&&new MutationObserver(S=>{for(let p of S)if(p.type=="attributes"&&p.attributeName=="class"){if(p.target.nodeType==1){let v=String(p.target?.className??""),T=String(p?.oldValue??"");if(v||T){let y=v.split(" ").map(h=>h.trim()).filter(h=>h),g=T.split(" ").map(h=>h.trim()).filter(h=>h);y=y.filter(h=>!g.includes(h)),typeof i=="function"&&i([...new Set(y)])}}}else if(p.type=="childList"&&p.addedNodes.length>0){let v=[...p.addedNodes].filter(T=>T.nodeType==1).map(T=>Se(T)).flat(1/0);typeof i=="function"&&i([...new Set(v)])}}).observe(c,{attributes:!0,attributeOldValue:!0,attributeFilter:["class"],childList:!0,subtree:!0}))};return{buildCss:Qe,exportCache:()=>typeof window>"u"||!window.localStorage?G:xe(window.localStorage.getItem(P))||G,ready:re}},wt=(e,t)=>{Re(t).buildCss(e).observe()},xt=(e,t)=>Re(t).buildCss(e).clsx,Te={css:Re,cssObserve:wt,clsx:xt};var vt=(e,t)=>(e=e||"fwkui",t=t||"v1",`${e}_cache_${t}`),Et=(e="fwkui",t="v1",n)=>{let s=String(e||"").trim()||"fwkui",o=vt(s,t),d=JSON.stringify(s),m=JSON.stringify(o),u=`
|
|
12
12
|
(async function () {
|
|
13
13
|
function decompressLZW(compressed) {
|
|
14
14
|
if (!compressed) return '';
|
|
@@ -94,7 +94,7 @@ ${l}
|
|
|
94
94
|
if (typeof window === 'undefined' || !window.localStorage) return;
|
|
95
95
|
|
|
96
96
|
var styleId = ${d};
|
|
97
|
-
var key = ${
|
|
97
|
+
var key = ${m};
|
|
98
98
|
var raw = localStorage.getItem(key);
|
|
99
99
|
if (!raw) return;
|
|
100
100
|
var payload=await parseCache(raw);
|
|
@@ -118,5 +118,5 @@ ${l}
|
|
|
118
118
|
styleEl.textContent = css;
|
|
119
119
|
} catch (_error) {}
|
|
120
120
|
})();
|
|
121
|
-
`.trim();return n?.compact?u.replace(/\s+/g," ").trim():u};var
|
|
121
|
+
`.trim();return n?.compact?u.replace(/\s+/g," ").trim():u};var De="__FWXCSS_SHARED__",Rt={base:"html,body{font-size:16px;padding:0;margin:0;}"},Tt=e=>{if(!e)return!1;let t=typeof Document<"u",n=typeof ShadowRoot<"u",s=t&&e instanceof Document,o=n&&e instanceof ShadowRoot;return s||o},Dt=e=>{let t=[],n=s=>{if(s){if(typeof s=="string"||typeof s=="number"){t.push(String(s));return}if(Array.isArray(s)){s.forEach(n);return}typeof s=="object"&&Object.keys(s).forEach(o=>{s[o]&&t.push(o)})}};return e.forEach(n),t},Ae=e=>{let t=new WeakMap,n=null,s=e??Rt,o=typeof document<"u"?document:null,d=b=>{let X=Te.css(s);return{...X.buildCss(b??void 0),ready:X.ready}},m=()=>(n||(n=d(null)),n),u=b=>{if(!b)return m();let X=t.get(b);return X||(X=d(b),t.set(b,X)),X};return{clsx:(...b)=>{let X,J=b[b.length-1];Tt(J)&&(X=J,b=b.slice(0,-1));let ae=Dt(b);return u(X||o).clsx(ae.join(" "))},observe:b=>{u(b||o).observe()},setClsxRoot:b=>{o=b||(typeof document<"u"?document:null)},getCss:b=>b?u(b).getCssString():o?u(o).getCssString():m().getCssString(),ready:b=>b?u(b).ready:o?u(o).ready:m().ready}},Wt=e=>Ae(e),Ut=e=>Ae(e),Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:global,Z=Ie[De]||Ae();Ie[De]||(Ie[De]=Z);var Vt=Z.clsx,Nt=Z.observe,zt=Z.setClsxRoot,qt=Z.getCss,Ft=Z.ready;var _e=Te;typeof document<"u"&&(_e.cssObserve(document),console.log("\u{1F680} fwxcss Auto-Observer Activated"));var Gt=_e;export{Vt as clsx,Ut as createSharedClsx,Wt as createSharedInstance,Gt as default,Et as getBootloaderScript,qt as getCss,Nt as observe,Ft as ready,zt as setClsxRoot};
|
|
122
122
|
//# sourceMappingURL=index-auto.mjs.map
|