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