@tachui/responsive 0.8.20 → 0.8.22

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.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("@tachui/registry"),ce=require("@tachui/modifiers"),u=require("@tachui/core"),g={Clean:0,Check:1,Dirty:2,Disposed:3};let Ve=0;const Ee=Math.random().toString(36).substr(2,6);let re=null,se=null;const Ie=new Set;Ie.add(Ee);const j={get currentComputation(){return re},set currentComputation(s){re=s},get currentOwner(){return se},set currentOwner(s){se=s}};function de(){return j.currentComputation}function Te(){return j.currentOwner}class je{id;owner;fn;sources=new Set;observers=new Set;state=g.Dirty;value=void 0;constructor(e,t=null){this.id=++Ve,this.fn=e,this.owner=t,t&&!t.disposed&&t.sources.add(this)}execute(){if(this.state===g.Disposed)return this.value;for(const t of this.sources)t&&typeof t=="object"&&"removeObserver"in t&&t.removeObserver(this);this.sources.clear();const e=j.currentComputation;j.currentComputation=this;try{return this.state=g.Clean,this.value=this.fn(),this.value}catch(t){throw this.state=g.Disposed,(typeof process>"u"||process.env.NODE_ENV!=="test")&&console.error("Error in computation:",t),t}finally{j.currentComputation=e}}dispose(){if(this.state!==g.Disposed){this.state=g.Disposed;for(const e of this.sources)e&&typeof e=="object"&&"removeObserver"in e&&e.removeObserver(this);this.sources.clear();for(const e of this.observers)e.sources.delete(this);this.observers.clear(),this.owner&&!this.owner.disposed&&this.owner.sources.delete(this)}}}typeof globalThis.__DEV__>"u"&&(globalThis.__DEV__=process.env.NODE_ENV!=="production");const Pe=(s,e)=>s===e;var W=(s=>(s[s.Immediate=0]="Immediate",s[s.High=1]="High",s[s.Normal=2]="Normal",s[s.Low=3]="Low",s[s.Idle=4]="Idle",s))(W||{});class De extends je{type="computed";priority;_hasValue=!1;_error=null;equalsFn;options;constructor(e,t={},i=Te()){super(e,i),this.priority=t.priority??W.Normal,this.equalsFn=t.equals??Pe,this.options=t}getValue(){const e=de();return e&&e.state!==g.Disposed&&(this.observers.add(e),e.sources.add(this)),(this.state===g.Dirty||!this._hasValue)&&(this.execute(),this._hasValue=!0),this.value}peek(){return(this.state===g.Dirty||!this._hasValue)&&(this.execute(),this._hasValue=!0),this.value}removeObserver(e){this.observers.delete(e),this.options.releaseOnNoObservers===!0&&this.observers.size===0&&e.state===g.Disposed&&this.releaseSources()}releaseSources(){for(const e of this.sources)"removeObserver"in e&&e.removeObserver(this);this.sources.clear(),this._hasValue=!1,this.state=g.Dirty}execute(){const e=this._hasValue?this.value:void 0,t=super.execute();if(!this._hasValue||!this.equalsFn(e,t))for(const i of this.observers)i.state!==g.Disposed&&(i.state=g.Dirty,"execute"in i&&typeof i.execute=="function"&&queueMicrotask(()=>{i.state===g.Dirty&&i.execute()}));return t}notify(){this.execute()}cleanup(){for(const e of this.sources)"removeObserver"in e&&e.removeObserver(this);this.sources.clear();for(const e of this.observers)e.sources.delete(this);this.observers.clear(),this._hasValue=!1,this._error=null,this.state=g.Disposed}dispose(){this.cleanup(),super.dispose()}[Symbol.for("tachui.debug")](){return{id:this.id,type:this.type,value:this._hasValue?this.value:void 0,hasValue:this._hasValue,error:this._error?.message,state:this.state,sourceCount:this.sources.size,observerCount:this.observers.size,priority:W[this.priority],debugName:this.options.debugName,equalsFn:this.equalsFn.name||"anonymous"}}toString(){return`Computed(${this.options.debugName||this.id}): ${this._hasValue?this.value:"no value"}`}}function _e(s,e){const t=new De(s,e),i=t.getValue.bind(t);return i.peek=t.peek.bind(t),Object.defineProperty(i,Symbol.for("tachui.computed"),{value:t,enumerable:!1}),i}let ze=0;class Le{id;observers=new Set;_value;constructor(e){this.id=++ze,this._value=e}getValue(){const e=de();return e&&e.state!==g.Disposed&&(this.observers.add(e),e.sources.add(this)),this._value}peek(){return this._value}set(e){const t=typeof e=="function"?e(this._value):e;return t!==this._value&&(this._value=t,this.notify()),t}notify(){for(const e of this.observers)e.state!==g.Disposed&&(e.state=g.Dirty,Ne(e))}removeObserver(e){this.observers.delete(e)}[Symbol.for("tachui.debug")](){return{id:this.id,value:this._value,observerCount:this.observers.size,type:"Signal"}}}const z=new Set;let L=!1;function Ne(s){z.add(s),L||queueMicrotask(qe)}function qe(){if(!L){L=!0;try{for(;z.size>0;){const s=Array.from(z).sort((e,t)=>e.id-t.id);z.clear();for(const e of s)e.state===g.Dirty&&e.execute()}}finally{L=!1}}}function Ae(s){const e=new Le(s),t=e.getValue.bind(e);t.peek=e.peek.bind(e);const i=e.set.bind(e);return Object.defineProperty(t,Symbol.for("tachui.signal"),{value:e,enumerable:!1}),[t,i]}const[Qe,Mt]=Ae("light");_e(()=>{const s=Qe();return s==="system"?Fe():s});function Fe(){return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}process.env.NODE_ENV,process.env.NODE_ENV;process.env.NODE_ENV==="development"&&console.log("📤 Created RegistryAdapter for globalModifierRegistry",{registryId:H.globalModifierRegistry.instanceId,currentSize:H.globalModifierRegistry.list().length});const He="0.8.20",We=He,ne=new WeakSet,oe=new WeakMap,Ge={name:"@tachui/core",version:We,author:"TachUI Team",verified:!0};function Ue(s){ne.has(s)||(s.setFeatureFlags({metadataRegistration:!0}),ne.add(s))}function Ke(s,e){let t=oe.get(s);t||(t=new Set,oe.set(s,t)),!t.has(e.name)&&(s.registerPlugin(e),t.add(e.name))}function Ze(s,e,t,i=H.globalModifierRegistry,r=Ge){Ue(i),Ke(i,r),i.has(s)||i.register(s,e),i.getMetadata(s)||i.registerMetadata({...t,name:s,plugin:r.name})}const Ye="0.8.20",Xe=Ye,q={base:"0px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function w(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&Object.keys(s).some(e=>["base","sm","md","lg","xl","2xl"].includes(e))}function G(s){return["base","sm","md","lg","xl","2xl"].includes(s)}let I={...q};const[ue,U]=u.createSignal("base"),[le,pe]=u.createSignal({width:0,height:0});let N=!1;const he=()=>{Q(),E()},fe=()=>{setTimeout(()=>{Q(),E()},100)};function Je(s){at(s),I={...q,...s},E(),typeof window<"u"&&window.addEventListener("resize",E)}function V(){return{...I}}function x(){return ue}function et(){return le}function tt(){typeof window>"u"||N||(Q(),E(),window.addEventListener("resize",he),window.addEventListener("orientationchange",fe),N=!0)}function it(){typeof window>"u"||(Q(),E())}function rt(){I={...q},U("base"),pe({width:0,height:0}),typeof window<"u"&&N&&(window.removeEventListener("resize",he),window.removeEventListener("orientationchange",fe)),N=!1}function S(){const s=ue(),e=le();return{current:s,width:e.width,height:e.height,isAbove:t=>K(s,t),isBelow:t=>Z(s,t),isBetween:(t,i)=>K(s,t)&&Z(s,i),matches:t=>window.matchMedia(t).matches}}function A(s){const e=I[s];return e.endsWith("px")?parseInt(e,10):e.endsWith("em")||e.endsWith("rem")?parseInt(e,10)*16:parseInt(e,10)||0}function b(s){return["base","sm","md","lg","xl","2xl"].indexOf(s)}function K(s,e){return b(s)>b(e)}function Z(s,e){return b(s)<b(e)}function me(s){return s==="base"?"":`(min-width: ${I[s]})`}function st(s,e){const t=[];if(s!=="base"&&t.push(`(min-width: ${I[s]})`),e&&e!=="2xl"){const i=["sm","md","lg","xl","2xl"],r=i.indexOf(e);if(r>=0&&r<i.length-1){const o=i[r+1],n=`${A(o)-1}px`;t.push(`(max-width: ${n})`)}}return t.length>0?t.join(" and "):""}function D(){return["base","sm","md","lg","xl","2xl"]}function nt(s){const e=D(),t=e.indexOf(s);return t>=0?e.slice(t+1):[]}function ot(s){const e=D(),t=e.indexOf(s);return t>0?e.slice(0,t):[]}function E(){if(typeof window>"u")return;const s=window.innerWidth,e=D().reverse();for(const t of e)if(t==="base"||s>=A(t)){U(t);return}U("base")}function Q(){typeof window<"u"&&pe({width:window.innerWidth,height:window.innerHeight})}function at(s){for(const[t,i]of Object.entries(s)){if(!G(t))throw new Error(`Invalid breakpoint key: "${t}". Valid keys are: base, sm, md, lg, xl, 2xl`);if(typeof i!="string")throw new Error(`Breakpoint value for "${t}" must be a string (e.g., "768px")`);if(!i.match(/^\d+(\.\d+)?(px|em|rem|%)$/))throw new Error(`Invalid breakpoint value for "${t}": "${i}". Must be a valid CSS length (e.g., "768px", "48em")`)}const e=Object.keys(s).filter(G).sort((t,i)=>b(t)-b(i));for(let t=1;t<e.length;t++){const i=e[t-1],r=e[t],o=s[i],n=s[r];if(A(i)>=parseInt(n,10))throw new Error(`Breakpoint "${r}" (${n}) must be larger than "${i}" (${o})`)}}const ct={tailwind:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},bootstrap:{sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1400px"},material:{sm:"600px",md:"960px",lg:"1280px",xl:"1920px","2xl":"2560px"},mobileFocus:{sm:"480px",md:"768px",lg:"1024px",xl:"1200px","2xl":"1440px"}};class Y{options;constructor(e){this.options={generateMinified:!1,includeComments:!0,optimizeOutput:!0,mobileFirst:!0,...e}}generateResponsiveCSS(e){const t=[],i=[],r={};let o=!1;for(const[n,a]of Object.entries(e))if(w(a)){o=!0;const c=this.generatePropertyMediaQueries(n,a);t.push(...c.mediaQueries),c.baseStyles&&Object.assign(r,c.baseStyles)}else r[this.toCSSPropertyName(n)]=this.formatCSSValue(n,a);return i.push(...this.generateCSSRules(t,r)),{cssRules:i,mediaQueries:t,fallbackStyles:r,hasResponsiveStyles:o}}generatePropertyMediaQueries(e,t){const i=[],r={},o=D();for(const n of o){const a=t[n];if(a===void 0)continue;const c=this.toCSSPropertyName(e),d=this.formatCSSValue(e,a);if(n==="base")r[c]=d;else{const p=me(n),h={[c]:d};i.push({breakpoint:n,query:p,styles:h,selector:this.options.selector})}}return{mediaQueries:i,baseStyles:Object.keys(r).length>0?r:void 0}}generateCSSRules(e,t){const i=[];if(Object.keys(t).length>0){const o=this.generateCSSRule(this.options.selector,t);i.push(o)}const r=this.groupQueriesByMediaQuery(e);for(const[o,n]of Object.entries(r)){if(o==="")continue;const a={};for(const d of n)Object.assign(a,d.styles);const c=this.generateMediaQueryRule(o,this.options.selector,a);i.push(c)}return i}groupQueriesByMediaQuery(e){const t={};for(const i of e)t[i.query]||(t[i.query]=[]),t[i.query].push(i);return t}generateCSSRule(e,t){const{generateMinified:i,includeComments:r}=this.options,o=i?"":" ",n=i?"":`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("@tachui/registry"),ce=require("@tachui/modifiers"),u=require("@tachui/core"),g={Clean:0,Check:1,Dirty:2,Disposed:3};let Ve=0;const Ee=Math.random().toString(36).substr(2,6);let re=null,se=null;const Ie=new Set;Ie.add(Ee);const j={get currentComputation(){return re},set currentComputation(s){re=s},get currentOwner(){return se},set currentOwner(s){se=s}};function de(){return j.currentComputation}function Te(){return j.currentOwner}class je{id;owner;fn;sources=new Set;observers=new Set;state=g.Dirty;value=void 0;constructor(e,t=null){this.id=++Ve,this.fn=e,this.owner=t,t&&!t.disposed&&t.sources.add(this)}execute(){if(this.state===g.Disposed)return this.value;for(const t of this.sources)t&&typeof t=="object"&&"removeObserver"in t&&t.removeObserver(this);this.sources.clear();const e=j.currentComputation;j.currentComputation=this;try{return this.state=g.Clean,this.value=this.fn(),this.value}catch(t){throw this.state=g.Disposed,(typeof process>"u"||process.env.NODE_ENV!=="test")&&console.error("Error in computation:",t),t}finally{j.currentComputation=e}}dispose(){if(this.state!==g.Disposed){this.state=g.Disposed;for(const e of this.sources)e&&typeof e=="object"&&"removeObserver"in e&&e.removeObserver(this);this.sources.clear();for(const e of this.observers)e.sources.delete(this);this.observers.clear(),this.owner&&!this.owner.disposed&&this.owner.sources.delete(this)}}}typeof globalThis.__DEV__>"u"&&(globalThis.__DEV__=process.env.NODE_ENV!=="production");const Pe=(s,e)=>s===e;var W=(s=>(s[s.Immediate=0]="Immediate",s[s.High=1]="High",s[s.Normal=2]="Normal",s[s.Low=3]="Low",s[s.Idle=4]="Idle",s))(W||{});class De extends je{type="computed";priority;_hasValue=!1;_error=null;equalsFn;options;constructor(e,t={},i=Te()){super(e,i),this.priority=t.priority??W.Normal,this.equalsFn=t.equals??Pe,this.options=t}getValue(){const e=de();return e&&e.state!==g.Disposed&&(this.observers.add(e),e.sources.add(this)),(this.state===g.Dirty||!this._hasValue)&&(this.execute(),this._hasValue=!0),this.value}peek(){return(this.state===g.Dirty||!this._hasValue)&&(this.execute(),this._hasValue=!0),this.value}removeObserver(e){this.observers.delete(e),this.options.releaseOnNoObservers===!0&&this.observers.size===0&&e.state===g.Disposed&&this.releaseSources()}releaseSources(){for(const e of this.sources)"removeObserver"in e&&e.removeObserver(this);this.sources.clear(),this._hasValue=!1,this.state=g.Dirty}execute(){const e=this._hasValue?this.value:void 0,t=super.execute();if(!this._hasValue||!this.equalsFn(e,t))for(const i of this.observers)i.state!==g.Disposed&&(i.state=g.Dirty,"execute"in i&&typeof i.execute=="function"&&queueMicrotask(()=>{i.state===g.Dirty&&i.execute()}));return t}notify(){this.execute()}cleanup(){for(const e of this.sources)"removeObserver"in e&&e.removeObserver(this);this.sources.clear();for(const e of this.observers)e.sources.delete(this);this.observers.clear(),this._hasValue=!1,this._error=null,this.state=g.Disposed}dispose(){this.cleanup(),super.dispose()}[Symbol.for("tachui.debug")](){return{id:this.id,type:this.type,value:this._hasValue?this.value:void 0,hasValue:this._hasValue,error:this._error?.message,state:this.state,sourceCount:this.sources.size,observerCount:this.observers.size,priority:W[this.priority],debugName:this.options.debugName,equalsFn:this.equalsFn.name||"anonymous"}}toString(){return`Computed(${this.options.debugName||this.id}): ${this._hasValue?this.value:"no value"}`}}function _e(s,e){const t=new De(s,e),i=t.getValue.bind(t);return i.peek=t.peek.bind(t),Object.defineProperty(i,Symbol.for("tachui.computed"),{value:t,enumerable:!1}),i}let ze=0;class Le{id;observers=new Set;_value;constructor(e){this.id=++ze,this._value=e}getValue(){const e=de();return e&&e.state!==g.Disposed&&(this.observers.add(e),e.sources.add(this)),this._value}peek(){return this._value}set(e){const t=typeof e=="function"?e(this._value):e;return t!==this._value&&(this._value=t,this.notify()),t}notify(){for(const e of this.observers)e.state!==g.Disposed&&(e.state=g.Dirty,Ne(e))}removeObserver(e){this.observers.delete(e)}[Symbol.for("tachui.debug")](){return{id:this.id,value:this._value,observerCount:this.observers.size,type:"Signal"}}}const z=new Set;let L=!1;function Ne(s){z.add(s),L||queueMicrotask(qe)}function qe(){if(!L){L=!0;try{for(;z.size>0;){const s=Array.from(z).sort((e,t)=>e.id-t.id);z.clear();for(const e of s)e.state===g.Dirty&&e.execute()}}finally{L=!1}}}function Ae(s){const e=new Le(s),t=e.getValue.bind(e);t.peek=e.peek.bind(e);const i=e.set.bind(e);return Object.defineProperty(t,Symbol.for("tachui.signal"),{value:e,enumerable:!1}),[t,i]}const[Qe,Mt]=Ae("light");_e(()=>{const s=Qe();return s==="system"?Fe():s});function Fe(){return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}process.env.NODE_ENV,process.env.NODE_ENV;process.env.NODE_ENV==="development"&&console.log("📤 Created RegistryAdapter for globalModifierRegistry",{registryId:H.globalModifierRegistry.instanceId,currentSize:H.globalModifierRegistry.list().length});const He="0.8.22",We=He,ne=new WeakSet,oe=new WeakMap,Ge={name:"@tachui/core",version:We,author:"TachUI Team",verified:!0};function Ue(s){ne.has(s)||(s.setFeatureFlags({metadataRegistration:!0}),ne.add(s))}function Ke(s,e){let t=oe.get(s);t||(t=new Set,oe.set(s,t)),!t.has(e.name)&&(s.registerPlugin(e),t.add(e.name))}function Ze(s,e,t,i=H.globalModifierRegistry,r=Ge){Ue(i),Ke(i,r),i.has(s)||i.register(s,e),i.getMetadata(s)||i.registerMetadata({...t,name:s,plugin:r.name})}const Ye="0.8.22",Xe=Ye,q={base:"0px",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function w(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)&&Object.keys(s).some(e=>["base","sm","md","lg","xl","2xl"].includes(e))}function G(s){return["base","sm","md","lg","xl","2xl"].includes(s)}let I={...q};const[ue,U]=u.createSignal("base"),[le,pe]=u.createSignal({width:0,height:0});let N=!1;const he=()=>{Q(),E()},fe=()=>{setTimeout(()=>{Q(),E()},100)};function Je(s){at(s),I={...q,...s},E(),typeof window<"u"&&window.addEventListener("resize",E)}function V(){return{...I}}function x(){return ue}function et(){return le}function tt(){typeof window>"u"||N||(Q(),E(),window.addEventListener("resize",he),window.addEventListener("orientationchange",fe),N=!0)}function it(){typeof window>"u"||(Q(),E())}function rt(){I={...q},U("base"),pe({width:0,height:0}),typeof window<"u"&&N&&(window.removeEventListener("resize",he),window.removeEventListener("orientationchange",fe)),N=!1}function S(){const s=ue(),e=le();return{current:s,width:e.width,height:e.height,isAbove:t=>K(s,t),isBelow:t=>Z(s,t),isBetween:(t,i)=>K(s,t)&&Z(s,i),matches:t=>window.matchMedia(t).matches}}function A(s){const e=I[s];return e.endsWith("px")?parseInt(e,10):e.endsWith("em")||e.endsWith("rem")?parseInt(e,10)*16:parseInt(e,10)||0}function b(s){return["base","sm","md","lg","xl","2xl"].indexOf(s)}function K(s,e){return b(s)>b(e)}function Z(s,e){return b(s)<b(e)}function me(s){return s==="base"?"":`(min-width: ${I[s]})`}function st(s,e){const t=[];if(s!=="base"&&t.push(`(min-width: ${I[s]})`),e&&e!=="2xl"){const i=["sm","md","lg","xl","2xl"],r=i.indexOf(e);if(r>=0&&r<i.length-1){const o=i[r+1],n=`${A(o)-1}px`;t.push(`(max-width: ${n})`)}}return t.length>0?t.join(" and "):""}function D(){return["base","sm","md","lg","xl","2xl"]}function nt(s){const e=D(),t=e.indexOf(s);return t>=0?e.slice(t+1):[]}function ot(s){const e=D(),t=e.indexOf(s);return t>0?e.slice(0,t):[]}function E(){if(typeof window>"u")return;const s=window.innerWidth,e=D().reverse();for(const t of e)if(t==="base"||s>=A(t)){U(t);return}U("base")}function Q(){typeof window<"u"&&pe({width:window.innerWidth,height:window.innerHeight})}function at(s){for(const[t,i]of Object.entries(s)){if(!G(t))throw new Error(`Invalid breakpoint key: "${t}". Valid keys are: base, sm, md, lg, xl, 2xl`);if(typeof i!="string")throw new Error(`Breakpoint value for "${t}" must be a string (e.g., "768px")`);if(!i.match(/^\d+(\.\d+)?(px|em|rem|%)$/))throw new Error(`Invalid breakpoint value for "${t}": "${i}". Must be a valid CSS length (e.g., "768px", "48em")`)}const e=Object.keys(s).filter(G).sort((t,i)=>b(t)-b(i));for(let t=1;t<e.length;t++){const i=e[t-1],r=e[t],o=s[i],n=s[r];if(A(i)>=parseInt(n,10))throw new Error(`Breakpoint "${r}" (${n}) must be larger than "${i}" (${o})`)}}const ct={tailwind:{sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},bootstrap:{sm:"576px",md:"768px",lg:"992px",xl:"1200px","2xl":"1400px"},material:{sm:"600px",md:"960px",lg:"1280px",xl:"1920px","2xl":"2560px"},mobileFocus:{sm:"480px",md:"768px",lg:"1024px",xl:"1200px","2xl":"1440px"}};class Y{options;constructor(e){this.options={generateMinified:!1,includeComments:!0,optimizeOutput:!0,mobileFirst:!0,...e}}generateResponsiveCSS(e){const t=[],i=[],r={};let o=!1;for(const[n,a]of Object.entries(e))if(w(a)){o=!0;const c=this.generatePropertyMediaQueries(n,a);t.push(...c.mediaQueries),c.baseStyles&&Object.assign(r,c.baseStyles)}else r[this.toCSSPropertyName(n)]=this.formatCSSValue(n,a);return i.push(...this.generateCSSRules(t,r)),{cssRules:i,mediaQueries:t,fallbackStyles:r,hasResponsiveStyles:o}}generatePropertyMediaQueries(e,t){const i=[],r={},o=D();for(const n of o){const a=t[n];if(a===void 0)continue;const c=this.toCSSPropertyName(e),d=this.formatCSSValue(e,a);if(n==="base")r[c]=d;else{const p=me(n),h={[c]:d};i.push({breakpoint:n,query:p,styles:h,selector:this.options.selector})}}return{mediaQueries:i,baseStyles:Object.keys(r).length>0?r:void 0}}generateCSSRules(e,t){const i=[];if(Object.keys(t).length>0){const o=this.generateCSSRule(this.options.selector,t);i.push(o)}const r=this.groupQueriesByMediaQuery(e);for(const[o,n]of Object.entries(r)){if(o==="")continue;const a={};for(const d of n)Object.assign(a,d.styles);const c=this.generateMediaQueryRule(o,this.options.selector,a);i.push(c)}return i}groupQueriesByMediaQuery(e){const t={};for(const i of e)t[i.query]||(t[i.query]=[]),t[i.query].push(i);return t}generateCSSRule(e,t){const{generateMinified:i,includeComments:r}=this.options,o=i?"":" ",n=i?"":`
2
2
  `,a=i?"":" ";let c=`${e}${a}{${n}`;for(const[d,p]of Object.entries(t))c+=`${o}${d}:${a}${p};${n}`;return c+=`}${n}`,r&&!i&&(c=`/* Base styles (mobile-first) */${n}${c}`),c}generateMediaQueryRule(e,t,i){const{generateMinified:r,includeComments:o}=this.options,n=r?"":" ",a=r?"":" ",c=r?"":`
3
3
  `,d=r?"":" ";let p=`@media ${e}${d}{${c}`;p+=`${n}${t}${d}{${c}`;for(const[h,m]of Object.entries(i))p+=`${a}${h}:${d}${m};${c}`;return p+=`${n}}${c}`,p+=`}${c}`,o&&!r&&(p=`/* ${this.getBreakpointFromQuery(e)} styles */${c}${p}`),p}toCSSProperty(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}formatCSSValue(e,t){if(t==null)return"inherit";if(typeof t=="number"){const i=["opacity","z-index","font-weight","line-height","flex-grow","flex-shrink","order","grid-column-start","grid-column-end","grid-row-start","grid-row-end"],r=this.toCSSProperty(e);if(i.includes(r))return this.addImportantIfNeeded(e,t.toString());if(["width","height","min-width","max-width","min-height","max-height","padding","margin","border-width","border-radius","top","right","bottom","left","font-size","letter-spacing","text-indent"].some(n=>r.includes(n)))return this.addImportantIfNeeded(e,`${t}px`)}return this.addImportantIfNeeded(e,t.toString())}addImportantIfNeeded(e,t){const i=["flexDirection","flex-direction","justifyContent","justify-content","alignItems","align-items","display"],r=this.toCSSProperty(e);return i.includes(e)||i.includes(r)?`${t} !important`:t}toCSSPropertyName(e){return this.toCSSProperty(e)}getBreakpointFromQuery(e){const t=V();for(const[i,r]of Object.entries(t))if(e.includes(r))return i;return"custom"}}function dt(s,e,t,i){if(!w(t)){const a=e.replace(/[A-Z]/g,d=>`-${d.toLowerCase()}`),c=typeof t=="number"?`${t}px`:t.toString();return[`${s} { ${a}: ${c}; }`]}const r=new Y({selector:s,...i}),o={[e]:t};return r.generateResponsiveCSS(o).cssRules}function ut(s,e,t){const{generateMinified:i=!1}=t||{},r=i?"":" ",o=i?"":`
4
4
  `,n=i?"":" ";let a=`@media ${e.query}${n}{${o}`;a+=`${r}${s}${n}{${o}`;for(const[c,d]of Object.entries(e.styles)){const p=c.replace(/[A-Z]/g,m=>`-${m.toLowerCase()}`),h=typeof d=="number"?`${d}px`:d.toString();a+=`${r}${r}${p}:${n}${h};${o}`}return a+=`${r}}${o}`,a+=`}${o}`,a}class X{static styleSheet=null;static injectedRules=new Set;static getStyleSheet(){if(this.styleSheet)return this.styleSheet;const e=document.createElement("style");return e.setAttribute("data-tachui-responsive","true"),document.head.appendChild(e),this.styleSheet=e.sheet,this.styleSheet}static injectCSS(e){if(typeof document>"u")return;const t=this.getStyleSheet();for(const i of e)if(!this.injectedRules.has(i))try{t.insertRule(i,t.cssRules.length),this.injectedRules.add(i)}catch(r){console.warn("Failed to inject CSS rule:",i,r)}}static clearCSS(){if(this.styleSheet){for(;this.styleSheet.cssRules.length>0;)this.styleSheet.deleteRule(0);this.injectedRules.clear()}}static hasRule(e){return this.injectedRules.has(e)}}class lt{cache=new Map;hitCount=0;missCount=0;get(e){const t=this.cache.get(e);return t?this.hitCount++:this.missCount++,t}set(e,t){this.cache.set(e,t)}clear(){this.cache.clear(),this.hitCount=0,this.missCount=0}getStats(){return{size:this.cache.size,hitRate:this.hitCount/(this.hitCount+this.missCount)||0,hits:this.hitCount,misses:this.missCount}}}const k=new lt;class pt{static BATCH_SIZE=50;static ruleQueue=[];static flushTimer=null;static generateOptimizedCSS(e,t,i={}){const{minify:r=process.env.NODE_ENV==="production",batch:o=!0,deduplicate:n=!0}=i,a=this.createCacheKey(e,t,{minify:r});if(n){const d=k.get(a);if(d)return d}const c=this.generateCSS(e,t,{minify:r});return n&&k.set(a,c),o&&c.trim()?(this.addToBatch(c),""):c}static createCacheKey(e,t,i){return JSON.stringify({selector:e,config:t,options:i})}static generateCSS(e,t,i){const{minify:r=!1}=i,o=r?"":" ",n=r?"":`
package/dist/index.mjs CHANGED
@@ -269,7 +269,7 @@ process.env.NODE_ENV === "development" && console.log("📤 Created RegistryAdap
269
269
  registryId: F.instanceId,
270
270
  currentSize: F.list().length
271
271
  });
272
- const Pe = "0.8.20", _e = Pe, ee = /* @__PURE__ */ new WeakSet(), te = /* @__PURE__ */ new WeakMap(), ze = {
272
+ const Pe = "0.8.22", _e = Pe, ee = /* @__PURE__ */ new WeakSet(), te = /* @__PURE__ */ new WeakMap(), ze = {
273
273
  name: "@tachui/core",
274
274
  version: _e,
275
275
  author: "TachUI Team",
@@ -291,7 +291,7 @@ function qe(s, e, t, i = F, r = ze) {
291
291
  plugin: r.name
292
292
  });
293
293
  }
294
- const Ae = "0.8.20", Qe = Ae, K = {
294
+ const Ae = "0.8.22", Qe = Ae, K = {
295
295
  base: "0px",
296
296
  // Mobile-first base
297
297
  sm: "640px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachui/responsive",
3
- "version": "0.8.20",
3
+ "version": "0.8.22",
4
4
  "description": "Advanced responsive design patterns and utilities for tachUI framework",
5
5
  "homepage": "https://tachui.dev/",
6
6
  "main": "./dist/index.js",
@@ -22,9 +22,9 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@tachui/core": "0.8.20",
26
- "@tachui/modifiers": "0.8.20",
27
- "@tachui/registry": "0.8.20"
25
+ "@tachui/modifiers": "0.8.22",
26
+ "@tachui/core": "0.8.22",
27
+ "@tachui/registry": "0.8.22"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.0.0",