@stacksjs/stx 0.2.81 → 0.2.82
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/build-mode-detector.js +2 -2
- package/dist/build-views.js +2 -2
- package/dist/cli.js +1 -1
- package/dist/components.js +2 -2
- package/dist/conditionals.js +1 -1
- package/dist/custom-directives.js +1 -1
- package/dist/dev-server/index.js +2 -2
- package/dist/dev-server/serve-markdown.js +2 -2
- package/dist/docs.js +2 -2
- package/dist/error-handling.js +1 -1
- package/dist/errors/formatter.js +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/interactive.js +2 -2
- package/dist/lazy-loader.js +2 -2
- package/dist/misc-directives.js +1 -1
- package/dist/pwa/index.js +2 -2
- package/dist/pwa/offline.js +2 -2
- package/dist/render.js +2 -2
- package/dist/seo.js +1 -1
- package/dist/serve.js +2 -2
- package/dist/site-builder/build.js +2 -2
- package/dist/site-builder/index.js +2 -2
- package/dist/ssr.js +2 -2
- package/dist/story/cli.js +1 -1
- package/dist/story/commands/dev.js +2 -2
- package/dist/story/commands/index.js +2 -2
- package/dist/story/index.js +2 -2
- package/dist/story/renderer.js +2 -2
- package/dist/story/server.js +2 -2
- package/dist/story/visual-testing.js +2 -2
- package/dist/template-compiler.js +2 -2
- package/dist/template-hydrator.js +2 -2
- package/dist/template-tag-balance.js +1 -1
- package/dist/testing.js +2 -2
- package/dist/web-components.js +2 -2
- package/package.json +5 -5
|
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)z.push(`
|
|
|
1783
1783
|
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function iK($,Z,Y){let X=$.split(`
|
|
1784
1784
|
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${X[K]}`)}return G.join(`
|
|
1785
1785
|
`)}function nK($,Z,Y){let X=$.split(`
|
|
1786
|
-
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}
|
|
1786
|
+
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;z.push(`${B}${W}\x1B[0m | ${j}`)}return z.join(`
|
|
1787
1787
|
`)}function qZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function zZ($,Z){let X=$.substring(0,Z).split(`
|
|
1788
1788
|
`);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return J3({type:$,message:Z,code:Y,format:"html"}).formatted}function oK($,Z,Y,X,J){return J3({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function sK($,Z,Y){let X=Y.template.split(`
|
|
1789
1789
|
`),J=zZ(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
|
|
@@ -4020,7 +4020,7 @@ else {
|
|
|
4020
4020
|
${q?`{${q}}`:"{}"}
|
|
4021
4021
|
</script>
|
|
4022
4022
|
</div>`}}});var h2={};l(h2,{warnUnbalancedTags:()=>r3,findUnbalancedTags:()=>g2});function F1($){return $.replace(/[^\n]/g," ")}function g2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,F1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,F1).replace(/<!--[\s\S]*?-->/g,F1).replace(/\{\{\{[\s\S]*?\}\}\}/g,F1).replace(/\{\{[\s\S]*?\}\}/g,F1).replace(/\{!![\s\S]*?!!\}/g,F1).replace(/"[^"]*"/g,F1).replace(/'[^']*'/g,F1),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],z=Q[3]==="/";if(dU.has(q.toLowerCase()))continue;if(z)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let W=Z.slice(0,Q.index).split(`
|
|
4023
|
-
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(mU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function r3($,Z){let Y;try{Y=g2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(f2.has(X))return;f2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z}
|
|
4023
|
+
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(mU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function r3($,Z){let Y;try{Y=g2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(f2.has(X))return;f2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var dU,mU,f2;var a3=y(()=>{dU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);f2=new Set});import d0 from"path";import t3 from"fs";function d2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function m2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class u2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let B=[J,J.toLowerCase(),d2(J),m2(J)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${d2(J)}.stx`,`${m2(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=d0.resolve(d0.dirname(Z),`${J}.stx`);if(await i(B))return B;return null}let K=[],q=Y.componentsDir||"",z=X?.__originalFilePath;if(z)K.push(d0.join(d0.dirname(z),"components"));if(q)K.push(q);let U=d0.join(d0.dirname(Z),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),_=[d0.resolve(W,"src/components"),d0.resolve(W,"components"),d0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=d0.join(B,j);if(await i(H))return H}try{if(!t3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=t3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=d0.join(B,L.name);for(let O of G){let V=d0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var y0;var e3=y(()=>{V0();y0=new u2});function V1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function uU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var $6;var Z6=y(()=>{$6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=uU($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${V1(X.value)}"`);else q.push(`href="${V1(X.value)}"`);if(J)q.push(`class="${V1(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${V1(Q)}"`),q.push(`data-stx-exact-active-class="${V1(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(z.has(U))continue;if(typeof W==="boolean"){if(W)q.push(V1(U))}else q.push(`${V1(U)}="${V1(W)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function _0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function D0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function X6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function l2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=lU[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function J6($,Z,Y,X){return Z.map((J)=>`${n5($,J,void 0,Y,X)} ${J}w`).join(", ")}function pU($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${n5($,G,void 0,X,J)} ${Q}x`}).join(", ")}function n5($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function cU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var lU,Y6,Q6;var G6=y(()=>{lU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Y6=[320,640,768,1024,1280,1536,1920];Q6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=D0($,"src")||"",J=D0($,"alt")||"",Q=D0($,"width"),G=D0($,"height"),K=D0($,"sizes"),q=D0($,"srcset"),z=D0($,"densities"),U=D0($,"format"),W=D0($,"placeholder"),_=D0($,"placeholderColor")||"#e5e7eb",B=D0($,"provider"),j=D0($,"class")||D0($,"className")||"",H=D0($,"style")||"",L=D0($,"quality"),F=X6($,"lazy",!0),O=X6($,"preload",!1),V=X6($,"picture",!1)||!!U,A=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,R=q||"",N="";if(!R&&K)R=J6(X,Y6,B,U),N=l2(K);else if(!R&&z){let S=z.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=pU(X,S,A,B,U)}else if(K)N=l2(K);let M=[];if(H)M.push(H);if(A&&w)M.push(`aspect-ratio:${A}/${w}`);if(W==="blur"||W==="color"||W==="thumbhash"){let S=cU(A||16,w||9,_);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")M.push(`background-image:url(${_0(W)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=n5(X,A,w,B,U),I=[];if(I.push(`src="${_0(T)}"`),I.push(`alt="${_0(J)}"`),Q)I.push(`width="${_0(Q)}"`);if(G)I.push(`height="${_0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${_0(j)}"`);if(M.length>0)I.push(`style="${_0(M.join(";"))}"`);if(R)I.push(`srcset="${_0(R)}"`);if(N)I.push(`sizes="${_0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(D.has(S))continue;if(typeof b==="boolean"){if(b)I.push(_0(S))}else I.push(`${_0(S)}="${_0(b)}"`)}let E=`<img ${I.join(" ")} />`,k="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";k=`<link rel="preload" as="image" href="${_0(T)}"${b?` type="${b}"`:""}${R?` imagesrcset="${_0(R)}"`:""}${N?` imagesizes="${_0(N)}"`:""} />
|
|
4024
4024
|
`}if(V){let S=[];if(U==="avif"||U==="auto"){let b=n5(X,A,w,B,"avif"),C=R?J6(X,Y6,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${_0(C)}"${N?` sizes="${_0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=n5(X,A,w,B,"webp"),C=R?J6(X,Y6,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${_0(C)}"${N?` sizes="${_0(N)}"`:""} />`)}return`${k}<picture>
|
|
4025
4025
|
${S.join(`
|
|
4026
4026
|
`)}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var{defineProperty:Z,getOwnPropertyNames:U,getOwnPropertyDescriptor:V}=Object,v=Object.prototype.hasOwnProperty;function x(j){return this[j]}var y=(j)=>{var q=(B??=new WeakMap).get(j),z;if(q)return q;if(q=Z({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var F of U(j))if(!v.call(q,F))Z(q,F,{get:x.bind(j,F),enumerable:!(z=V(j,F))||z.enumerable})}return B.set(j,q),q},B;var D=(j)=>j;function G(j,q){this[j]=D.bind(null,q)}var I=(j,q)=>{for(var z in q)Z(j,z,{get:q[z],enumerable:!0,configurable:!0,set:G.bind(q,z)})};var A=(j,q)=>()=>(j&&(q=j(j=0)),q);var O=import.meta.require;var T={};I(T,{warnUnbalancedTags:()=>_,findUnbalancedTags:()=>N});function Q(j){return j.replace(/[^\n]/g," ")}function N(j){let q=j.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Q).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Q).replace(/<!--[\s\S]*?-->/g,Q).replace(/\{\{\{[\s\S]*?\}\}\}/g,Q).replace(/\{\{[\s\S]*?\}\}/g,Q).replace(/\{!![\s\S]*?!!\}/g,Q).replace(/"[^"]*"/g,Q).replace(/'[^']*'/g,Q),z=new Map,F=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,M;while((M=Y.exec(q))!==null){let H=M[1]==="/",J=M[2],X=M[3]==="/";if(C.has(J.toLowerCase()))continue;if(X)continue;if(H)F.set(J,(F.get(J)??0)+1);else{let $=z.get(J);if($)$.count++;else{let R=q.slice(0,M.index).split(`
|
|
3
|
-
`).length;z.set(J,{count:1,firstLine:R})}}}let W=[];for(let H of new Set([...z.keys(),...F.keys()])){if(S.has(H.toLowerCase()))continue;let J=z.get(H)?.count??0,X=F.get(H)??0;if(J!==X)W.push({tag:H,opened:J,closed:X,firstOpenLine:z.get(H)?.firstLine??0})}return W}function _(j,q){let z;try{z=N(j)}catch{return}if(z.length===0)return;let F=`${q}:${j.length}`;if(E.has(F))return;E.add(F);let Y=q?q.split(/[/\\]/).pop()||q:"template";for(let{tag:M,opened:W,closed:H,firstOpenLine:J}of z)if(W>H){let X=J?` (first opened at line ${J})`:"";console.warn(`[stx] ${Y}: <${M}> ${W} opened, ${H} closed \u2014 an unclosed <${M}>${X}
|
|
3
|
+
`).length;z.set(J,{count:1,firstLine:R})}}}let W=[];for(let H of new Set([...z.keys(),...F.keys()])){if(S.has(H.toLowerCase()))continue;let J=z.get(H)?.count??0,X=F.get(H)??0;if(J!==X)W.push({tag:H,opened:J,closed:X,firstOpenLine:z.get(H)?.firstLine??0})}return W}function _(j,q){let z;try{z=N(j)}catch{return}if(z.length===0)return;let F=`${q}:${j.length}`;if(E.has(F))return;E.add(F);let Y=q?q.split(/[/\\]/).pop()||q:"template";for(let{tag:M,opened:W,closed:H,firstOpenLine:J}of z)if(W>H){let X=J?` (first opened at line ${J})`:"";console.warn(`[stx] ${Y}: <${M}> ${W} opened, ${H} closed \u2014 an unclosed <${M}>${X} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${M}> ${W} opened, ${H} closed \u2014 ${H-W} stray </${M}>.`)}var C,S,E;var w=A(()=>{C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);E=new Set});w();export{_ as warnUnbalancedTags,N as findUnbalancedTags};
|
package/dist/testing.js
CHANGED
|
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)z.push(`
|
|
|
1783
1783
|
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function lK($,Z,Y){let X=$.split(`
|
|
1784
1784
|
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${X[K]}`)}return G.join(`
|
|
1785
1785
|
`)}function iK($,Z,Y){let X=$.split(`
|
|
1786
|
-
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}
|
|
1786
|
+
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;z.push(`${B}\x1B[90m${W}\x1B[0m | ${j}`)}return z.join(`
|
|
1787
1787
|
`)}function KZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function qZ($,Z){let X=$.substring(0,Z).split(`
|
|
1788
1788
|
`);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return Z3({type:$,message:Z,code:Y,format:"html"}).formatted}function nK($,Z,Y,X,J){return Z3({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function oK($,Z,Y){let X=Y.template.split(`
|
|
1789
1789
|
`),J=qZ(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
|
|
@@ -4020,7 +4020,7 @@ else {
|
|
|
4020
4020
|
${q?`{${q}}`:"{}"}
|
|
4021
4021
|
</script>
|
|
4022
4022
|
</div>`}}});var h2={};p(h2,{warnUnbalancedTags:()=>o3,findUnbalancedTags:()=>g2});function w1($){return $.replace(/[^\n]/g," ")}function g2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,w1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,w1).replace(/<!--[\s\S]*?-->/g,w1).replace(/\{\{\{[\s\S]*?\}\}\}/g,w1).replace(/\{\{[\s\S]*?\}\}/g,w1).replace(/\{!![\s\S]*?!!\}/g,w1).replace(/"[^"]*"/g,w1).replace(/'[^']*'/g,w1),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],z=Q[3]==="/";if(hU.has(q.toLowerCase()))continue;if(z)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let W=Z.slice(0,Q.index).split(`
|
|
4023
|
-
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(dU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function o3($,Z){let Y;try{Y=g2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(f2.has(X))return;f2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z}
|
|
4023
|
+
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(dU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function o3($,Z){let Y;try{Y=g2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(f2.has(X))return;f2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var hU,dU,f2;var s3=C(()=>{hU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),dU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);f2=new Set});import d0 from"path";import r3 from"fs";function d2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function m2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class u2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let B=[J,J.toLowerCase(),d2(J),m2(J)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${d2(J)}.stx`,`${m2(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=d0.resolve(d0.dirname(Z),`${J}.stx`);if(await i(B))return B;return null}let K=[],q=Y.componentsDir||"",z=X?.__originalFilePath;if(z)K.push(d0.join(d0.dirname(z),"components"));if(q)K.push(q);let U=d0.join(d0.dirname(Z),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),_=[d0.resolve(W,"src/components"),d0.resolve(W,"components"),d0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let O=d0.join(B,j);if(await i(O))return O}try{if(!r3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let O=r3.readdirSync(B,{withFileTypes:!0});for(let L of O)if(L.isDirectory()){let F=d0.join(B,L.name);for(let H of G){let V=d0.join(F,H);if(await i(V))return V}}}catch{}}return null}}var b0;var a3=C(()=>{w0();b0=new u2});function A1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var t3;var e3=C(()=>{t3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=mU($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${A1(X.value)}"`);else q.push(`href="${A1(X.value)}"`);if(J)q.push(`class="${A1(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${A1(Q)}"`),q.push(`data-stx-exact-active-class="${A1(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(z.has(U))continue;if(typeof W==="boolean"){if(W)q.push(A1(U))}else q.push(`${A1(U)}="${A1(W)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Z6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function p2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=uU[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function Y6($,Z,Y,X){return Z.map((J)=>`${o5($,J,void 0,Y,X)} ${J}w`).join(", ")}function pU($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${o5($,G,void 0,X,J)} ${Q}x`}).join(", ")}function o5($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function cU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var uU,$6,X6;var J6=C(()=>{uU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$6=[320,640,768,1024,1280,1536,1920];X6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=I0($,"src")||"",J=I0($,"alt")||"",Q=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),z=I0($,"densities"),U=I0($,"format"),W=I0($,"placeholder"),_=I0($,"placeholderColor")||"#e5e7eb",B=I0($,"provider"),j=I0($,"class")||I0($,"className")||"",O=I0($,"style")||"",L=I0($,"quality"),F=Z6($,"lazy",!0),H=Z6($,"preload",!1),V=Z6($,"picture",!1)||!!U,A=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,R=q||"",N="";if(!R&&K)R=Y6(X,$6,B,U),N=p2(K);else if(!R&&z){let S=z.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=pU(X,S,A,B,U)}else if(K)N=p2(K);let M=[];if(O)M.push(O);if(A&&w)M.push(`aspect-ratio:${A}/${w}`);if(W==="blur"||W==="color"||W==="thumbhash"){let S=cU(A||16,w||9,_);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")M.push(`background-image:url(${B0(W)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=o5(X,A,w,B,U),I=[];if(I.push(`src="${B0(T)}"`),I.push(`alt="${B0(J)}"`),Q)I.push(`width="${B0(Q)}"`);if(G)I.push(`height="${B0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${B0(j)}"`);if(M.length>0)I.push(`style="${B0(M.join(";"))}"`);if(R)I.push(`srcset="${B0(R)}"`);if(N)I.push(`sizes="${B0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(D.has(S))continue;if(typeof b==="boolean"){if(b)I.push(B0(S))}else I.push(`${B0(S)}="${B0(b)}"`)}let E=`<img ${I.join(" ")} />`,k="";if(H){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";k=`<link rel="preload" as="image" href="${B0(T)}"${b?` type="${b}"`:""}${R?` imagesrcset="${B0(R)}"`:""}${N?` imagesizes="${B0(N)}"`:""} />
|
|
4024
4024
|
`}if(V){let S=[];if(U==="avif"||U==="auto"){let b=o5(X,A,w,B,"avif"),y=R?Y6(X,$6,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${B0(y)}"${N?` sizes="${B0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=o5(X,A,w,B,"webp"),y=R?Y6(X,$6,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${B0(y)}"${N?` sizes="${B0(N)}"`:""} />`)}return`${k}<picture>
|
|
4025
4025
|
${S.join(`
|
|
4026
4026
|
`)}
|
package/dist/web-components.js
CHANGED
|
@@ -1783,7 +1783,7 @@ ${W}`)}if($.suggestion)z.push(`
|
|
|
1783
1783
|
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function uK($,Z,Y){let X=$.split(`
|
|
1784
1784
|
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${X[K]}`)}return G.join(`
|
|
1785
1785
|
`)}function lK($,Z,Y){let X=$.split(`
|
|
1786
|
-
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}
|
|
1786
|
+
`),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let U=J;U<=Q;U++){let W=(U+1).toString().padStart(4),_=U===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}`;z.push(`${B}${W}\x1B[0m | ${j}`)}return z.join(`
|
|
1787
1787
|
`)}function QZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function GZ($,Z){let X=$.substring(0,Z).split(`
|
|
1788
1788
|
`);return{line:X.length,column:X[X.length-1].length}}function r($,Z,Y){return t7({type:$,message:Z,code:Y,format:"html"}).formatted}function pK($,Z,Y,X,J){return t7({type:$,message:Z,code:J,filePath:Y,line:X,format:"console"}).formatted}function cK($,Z,Y){let X=Y.template.split(`
|
|
1789
1789
|
`),J=GZ(Y.template,Y.offset),Q=`[${$} Error at line ${J.line} in ${Y.filePath}]: ${Z}
|
|
@@ -4020,7 +4020,7 @@ else {
|
|
|
4020
4020
|
${q?`{${q}}`:"{}"}
|
|
4021
4021
|
</script>
|
|
4022
4022
|
</div>`}}});var f2={};l(f2,{warnUnbalancedTags:()=>i3,findUnbalancedTags:()=>x2});function L1($){return $.replace(/[^\n]/g," ")}function x2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,L1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,L1).replace(/<!--[\s\S]*?-->/g,L1).replace(/\{\{\{[\s\S]*?\}\}\}/g,L1).replace(/\{\{[\s\S]*?\}\}/g,L1).replace(/\{!![\s\S]*?!!\}/g,L1).replace(/"[^"]*"/g,L1).replace(/'[^']*'/g,L1),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],z=Q[3]==="/";if(xU.has(q.toLowerCase()))continue;if(z)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let W=Z.slice(0,Q.index).split(`
|
|
4023
|
-
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(fU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function i3($,Z){let Y;try{Y=x2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(v2.has(X))return;v2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z}
|
|
4023
|
+
`).length;Y.set(q,{count:1,firstLine:W})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(fU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=X.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function i3($,Z){let Y;try{Y=x2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(v2.has(X))return;v2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var xU,fU,v2;var n3=C(()=>{xU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);v2=new Set});import h0 from"path";import o3 from"fs";function g2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function h2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class d2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let B=[J,J.toLowerCase(),g2(J),h2(J)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${g2(J)}.stx`,`${h2(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=h0.resolve(h0.dirname(Z),`${J}.stx`);if(await i(B))return B;return null}let K=[],q=Y.componentsDir||"",z=X?.__originalFilePath;if(z)K.push(h0.join(h0.dirname(z),"components"));if(q)K.push(q);let U=h0.join(h0.dirname(Z),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),_=[h0.resolve(W,"src/components"),h0.resolve(W,"components"),h0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=h0.join(B,j);if(await i(H))return H}try{if(!o3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=o3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=h0.join(B,L.name);for(let O of G){let V=h0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var S0;var s3=C(()=>{V0();S0=new d2});function F1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function gU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var r3;var a3=C(()=>{r3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=gU($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${F1(X.value)}"`);else q.push(`href="${F1(X.value)}"`);if(J)q.push(`class="${F1(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${F1(Q)}"`),q.push(`data-stx-exact-active-class="${F1(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(z.has(U))continue;if(typeof W==="boolean"){if(W)q.push(F1(U))}else q.push(`${F1(U)}="${F1(W)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function _0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function e3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function m2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=hU[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function $6($,Z,Y,X){return Z.map((J)=>`${c5($,J,void 0,Y,X)} ${J}w`).join(", ")}function dU($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${c5($,G,void 0,X,J)} ${Q}x`}).join(", ")}function c5($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function mU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var hU,t3,Z6;var Y6=C(()=>{hU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},t3=[320,640,768,1024,1280,1536,1920];Z6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=I0($,"src")||"",J=I0($,"alt")||"",Q=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),z=I0($,"densities"),U=I0($,"format"),W=I0($,"placeholder"),_=I0($,"placeholderColor")||"#e5e7eb",B=I0($,"provider"),j=I0($,"class")||I0($,"className")||"",H=I0($,"style")||"",L=I0($,"quality"),F=e3($,"lazy",!0),O=e3($,"preload",!1),V=e3($,"picture",!1)||!!U,A=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,R=q||"",N="";if(!R&&K)R=$6(X,t3,B,U),N=m2(K);else if(!R&&z){let S=z.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=dU(X,S,A,B,U)}else if(K)N=m2(K);let M=[];if(H)M.push(H);if(A&&w)M.push(`aspect-ratio:${A}/${w}`);if(W==="blur"||W==="color"||W==="thumbhash"){let S=mU(A||16,w||9,_);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")M.push(`background-image:url(${_0(W)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=c5(X,A,w,B,U),I=[];if(I.push(`src="${_0(T)}"`),I.push(`alt="${_0(J)}"`),Q)I.push(`width="${_0(Q)}"`);if(G)I.push(`height="${_0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${_0(j)}"`);if(M.length>0)I.push(`style="${_0(M.join(";"))}"`);if(R)I.push(`srcset="${_0(R)}"`);if(N)I.push(`sizes="${_0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(D.has(S))continue;if(typeof b==="boolean"){if(b)I.push(_0(S))}else I.push(`${_0(S)}="${_0(b)}"`)}let E=`<img ${I.join(" ")} />`,k="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";k=`<link rel="preload" as="image" href="${_0(T)}"${b?` type="${b}"`:""}${R?` imagesrcset="${_0(R)}"`:""}${N?` imagesizes="${_0(N)}"`:""} />
|
|
4024
4024
|
`}if(V){let S=[];if(U==="avif"||U==="auto"){let b=c5(X,A,w,B,"avif"),y=R?$6(X,t3,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${_0(y)}"${N?` sizes="${_0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=c5(X,A,w,B,"webp"),y=R?$6(X,t3,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${_0(y)}"${N?` sizes="${_0(N)}"`:""} />`)}return`${k}<picture>
|
|
4025
4025
|
${S.join(`
|
|
4026
4026
|
`)}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.82",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,13 +117,13 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.6",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.82",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.82",
|
|
122
122
|
"@stacksjs/ts-craft": "^0.0.2",
|
|
123
123
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
124
|
-
"bun-plugin-stx": "0.2.
|
|
124
|
+
"bun-plugin-stx": "0.2.82",
|
|
125
125
|
"bunfig": "^0.15.6",
|
|
126
|
-
"stx-router": "0.2.
|
|
126
|
+
"stx-router": "0.2.82",
|
|
127
127
|
"ts-broadcasting": "^0.0.4",
|
|
128
128
|
"ts-images": "^0.1.8",
|
|
129
129
|
"ts-syntax-highlighter": "^0.2.1"
|