@stacksjs/stx 0.2.432 → 0.2.434
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/{chunk-wy873fy8.js → chunk-0n28xm1q.js} +1 -1
- package/dist/{chunk-b7973zvk.js → chunk-114zdbnd.js} +2 -2
- package/dist/chunk-11h97cn9.js +2 -0
- package/dist/{chunk-w715g0wp.js → chunk-1j2z24r5.js} +5 -5
- package/dist/{chunk-2y936zb0.js → chunk-1njrhrmw.js} +11 -11
- package/dist/{chunk-w3j0ppg4.js → chunk-1yj3p63h.js} +2 -2
- package/dist/{chunk-aen2baze.js → chunk-3rbz496d.js} +1 -1
- package/dist/{chunk-cznsm2n3.js → chunk-489z8wry.js} +2 -2
- package/dist/chunk-4x884b3c.js +2 -0
- package/dist/chunk-4xqtfka6.js +2 -0
- package/dist/{chunk-zjet6r6p.js → chunk-5dh5cdmv.js} +1 -1
- package/dist/chunk-60j147cj.js +2 -0
- package/dist/chunk-60pc7151.js +2 -0
- package/dist/{chunk-mjgqhhap.js → chunk-721yq8qx.js} +3 -3
- package/dist/{chunk-0hhq9hbq.js → chunk-74j5jbs6.js} +3 -3
- package/dist/chunk-7envdam0.js +2 -0
- package/dist/chunk-7jw2zhb9.js +2 -0
- package/dist/{chunk-0bmc75w6.js → chunk-7x8qwshk.js} +2 -2
- package/dist/chunk-80q2becc.js +2 -0
- package/dist/chunk-88ey0pdm.js +2 -0
- package/dist/{chunk-be01xyb8.js → chunk-8bew5svs.js} +2 -2
- package/dist/chunk-8bpf8d7n.js +2 -0
- package/dist/{chunk-ktedzx9e.js → chunk-8wkja2z2.js} +2 -2
- package/dist/{chunk-3ry9ca1s.js → chunk-8x47zcfa.js} +2 -2
- package/dist/{chunk-rnbgn7xn.js → chunk-93e1nf1y.js} +1 -1
- package/dist/{chunk-dsxgv6g2.js → chunk-9jr7jbgv.js} +191 -191
- package/dist/{chunk-7a9h7ycs.js → chunk-9w5nse46.js} +3 -3
- package/dist/chunk-9xmdj73x.js +2 -0
- package/dist/{chunk-eej89wkt.js → chunk-9yy4fyq6.js} +1 -1
- package/dist/chunk-9zf2xmj5.js +2 -0
- package/dist/{chunk-knmj9ynm.js → chunk-a0v1fxzj.js} +1 -1
- package/dist/{chunk-vz86nx8y.js → chunk-a5qzw9te.js} +1 -1
- package/dist/{chunk-tpnfcb83.js → chunk-a88mq2k6.js} +1 -1
- package/dist/{chunk-stxmwytg.js → chunk-b8dbq51z.js} +2 -2
- package/dist/{chunk-5f0r0g18.js → chunk-b9wpgn7b.js} +3 -3
- package/dist/{chunk-4gs26aa4.js → chunk-basztgd4.js} +1 -1
- package/dist/chunk-begfdc6a.js +17 -0
- package/dist/{chunk-myfm3415.js → chunk-bqjty9dx.js} +1 -1
- package/dist/{chunk-c1dmr865.js → chunk-ccq35xp7.js} +3 -3
- package/dist/chunk-cnmz9543.js +2 -0
- package/dist/chunk-cv56m171.js +2 -0
- package/dist/{chunk-19mnptan.js → chunk-d2z6tmzw.js} +2 -2
- package/dist/{chunk-vz821mjg.js → chunk-d35y8thn.js} +1 -1
- package/dist/chunk-d7stgehg.js +2 -0
- package/dist/chunk-dpxj1gez.js +2 -0
- package/dist/{chunk-4hd5wb8x.js → chunk-dtvwes4f.js} +1 -1
- package/dist/{chunk-djdf6agj.js → chunk-ed7p2a5q.js} +1 -1
- package/dist/chunk-et2kt16p.js +2 -0
- package/dist/{chunk-tgq0vprh.js → chunk-f6cz5n4m.js} +1 -1
- package/dist/chunk-fg8kmyz8.js +2 -0
- package/dist/{chunk-pmpc9fd5.js → chunk-hb3epf4b.js} +1 -1
- package/dist/{chunk-ex0tq6x2.js → chunk-hc9242wm.js} +1 -1
- package/dist/chunk-j4kqw34b.js +2 -0
- package/dist/chunk-jtysg2ss.js +2 -0
- package/dist/chunk-k5tcanyq.js +2 -0
- package/dist/{chunk-dhqwg62x.js → chunk-k6kvgdd0.js} +1 -1
- package/dist/{chunk-03n23sh6.js → chunk-kcwz3kvn.js} +1 -1
- package/dist/{chunk-sbdzqqr1.js → chunk-m607bd3m.js} +1 -1
- package/dist/chunk-m73mswbe.js +2 -0
- package/dist/chunk-mq75bc92.js +2 -0
- package/dist/{chunk-fb7bfyjz.js → chunk-my3jkpv7.js} +3 -3
- package/dist/{chunk-2112wffa.js → chunk-nhg3r4ae.js} +4 -4
- package/dist/{chunk-wr9ac0cv.js → chunk-nvht5259.js} +2 -2
- package/dist/{chunk-zywwzf6t.js → chunk-nvr0ph6b.js} +4 -4
- package/dist/{chunk-02n071n7.js → chunk-p4wvc7wx.js} +4 -4
- package/dist/{chunk-y438dzvn.js → chunk-ptjqacjd.js} +2 -2
- package/dist/{chunk-12pvnn1e.js → chunk-pxqs3psa.js} +4 -4
- package/dist/{chunk-hnx1jgfp.js → chunk-q5433grh.js} +1 -1
- package/dist/{chunk-4dvb6crf.js → chunk-qrzhpzdw.js} +1 -1
- package/dist/chunk-r089d1s4.js +2 -0
- package/dist/{chunk-3b61yd4r.js → chunk-r2ahyhj0.js} +1 -1
- package/dist/chunk-sbs74y50.js +2 -0
- package/dist/chunk-st6exqqv.js +2 -0
- package/dist/{chunk-k8sqs7j2.js → chunk-t7x753ga.js} +2 -2
- package/dist/{chunk-2gxe5pj7.js → chunk-tf11gc47.js} +1 -1
- package/dist/{chunk-c0ants8t.js → chunk-thx147nq.js} +3 -3
- package/dist/chunk-tmj5b3r0.js +2 -0
- package/dist/{chunk-6t7mxb0b.js → chunk-tywmtk33.js} +2 -2
- package/dist/chunk-v190nt4m.js +2 -0
- package/dist/{chunk-rqfhknzj.js → chunk-veqzjwty.js} +1 -1
- package/dist/chunk-vn8qdcxp.js +2 -0
- package/dist/{chunk-cf6htz63.js → chunk-vzek2z1v.js} +1 -1
- package/dist/{chunk-jp602m75.js → chunk-w6gyrqjp.js} +18 -19
- package/dist/chunk-w7zh2avv.js +2 -0
- package/dist/chunk-w926gc13.js +2 -0
- package/dist/chunk-weegyd19.js +2 -0
- package/dist/{chunk-k0v70ttf.js → chunk-x3vv7hhh.js} +1 -1
- package/dist/{chunk-hpjtjd0c.js → chunk-x6cyhkk6.js} +1 -1
- package/dist/{chunk-wrj5fcvb.js → chunk-x819gynv.js} +4 -4
- package/dist/{chunk-e7n9gzf4.js → chunk-xc6x218s.js} +4 -4
- package/dist/chunk-ynrnx1tp.js +2 -0
- package/dist/{chunk-tz3v9sdj.js → chunk-z0t6509y.js} +8 -8
- package/dist/chunk-zc6k6164.js +2 -0
- package/dist/chunk-zgj9fsrd.js +2 -0
- package/dist/cli.js +16 -16
- package/dist/client-parameter-bindings.d.ts +4 -0
- package/dist/client-parameter-bindings.js +131 -0
- package/dist/client-script-bundler.js +27 -1
- package/dist/client-script.js +8 -2
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/compiler/html-to-ir.js +2 -0
- package/dist/native/runtime/native-host.js +1 -0
- package/dist/pwa.js +3 -3
- package/dist/runtime-globals.d.ts +2 -1
- package/dist/runtime-globals.js +1 -1
- package/dist/signals.js +17 -18
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-18rtxwty.js +0 -2
- package/dist/chunk-2xdqkskn.js +0 -2
- package/dist/chunk-5egy805h.js +0 -2
- package/dist/chunk-61gkb7kj.js +0 -2
- package/dist/chunk-66acqgyj.js +0 -2
- package/dist/chunk-7534j756.js +0 -2
- package/dist/chunk-9d53d0t6.js +0 -2
- package/dist/chunk-a1wag3ds.js +0 -2
- package/dist/chunk-ahgrkva8.js +0 -2
- package/dist/chunk-akbb6j7s.js +0 -2
- package/dist/chunk-bfk9vd0v.js +0 -2
- package/dist/chunk-d20xsth5.js +0 -2
- package/dist/chunk-d9hwqs78.js +0 -2
- package/dist/chunk-dx2nvsb9.js +0 -2
- package/dist/chunk-dxvh9qea.js +0 -2
- package/dist/chunk-e1yags7g.js +0 -2
- package/dist/chunk-f29rsb4g.js +0 -2
- package/dist/chunk-fdz00v9y.js +0 -2
- package/dist/chunk-fk1qnh5n.js +0 -2
- package/dist/chunk-ga18rt5h.js +0 -2
- package/dist/chunk-hr0b9xec.js +0 -2
- package/dist/chunk-j67ns7p6.js +0 -17
- package/dist/chunk-k1pjb22z.js +0 -2
- package/dist/chunk-mkzxhfae.js +0 -2
- package/dist/chunk-mqbknfvt.js +0 -2
- package/dist/chunk-nswshvzg.js +0 -2
- package/dist/chunk-rhkx17d9.js +0 -2
- package/dist/chunk-rwrbcam0.js +0 -2
- package/dist/chunk-s6dfjx5d.js +0 -2
- package/dist/chunk-tznejj9h.js +0 -2
- package/dist/chunk-vkhrkt58.js +0 -2
- package/dist/chunk-whdw6dhb.js +0 -2
- package/dist/chunk-wx7kfet5.js +0 -2
- package/dist/chunk-x38d7mvy.js +0 -2
- package/dist/chunk-xtmfcav4.js +0 -2
- package/dist/chunk-yjgbxf26.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,o,dn,
|
|
3
|
-
`:u==="t"?"\t":u;continue}if(i===r)return null;if(r==="`"&&i==="$"&&n[a+1]==="{")return null;s+=i}return s}var R=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Je(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=dn(r);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=
|
|
2
|
+
import{t,o,dn,Rs,ve,l}from"./chunk-b9wpgn7b.js";function w(e,n,r,s=0){let a=0,i=s,u=null,c=0,p=!1;while(i<e.length){let h=e[i];if(u&&p){p=!1,i++;continue}if(u&&h==="\\"){p=!0,i++;continue}if(p=!1,(h==='"'||h==="'"||h==="`")&&!u){u=h,i++;continue}if(h===u&&u!=="`"){u=null,i++;continue}if(u==="`"&&h==="$"&&e[i+1]==="{"){c++,i+=2;continue}if(c>0&&h==="}"){c--,i++;continue}if(h==="`"&&u==="`"&&c===0){u=null,i++;continue}if(u){i++;continue}if(h===n)a++;else if(h===r){if(a--,a===0)return i}i++}return-1}import v from"path";function $s(e,n){let r=[];n.lastIndex=0;let s;while((s=n.exec(e))!==null){let a=s.index,i=a+s[0].length-1,u=w(e,"(",")",i);if(u===-1){r.push({start:a,end:-1,args:"",call:e.slice(a,Math.min(e.length,a+80))}),n.lastIndex=i+1;continue}r.push({start:a,end:u+1,args:e.slice(i+1,u),call:e.slice(a,u+1)}),n.lastIndex=u+1}return r}function Xe(e,n,r,s){let a="",i=0;for(let u of $s(e,n)){if(a+=e.slice(i,u.start),u.end===-1){a+=s(u.call),i=u.start;continue}a+=r(u.args,u.call),i=u.end}return a+e.slice(i)}function Ge(e){let n=[],r=0,s=null,a="";for(let i=0;i<e.length;i++){let u=e[i];if(s){if(a+=u,u==="\\"&&i+1<e.length){a+=e[++i];continue}if(u===s)s=null;continue}if(u==="'"||u==='"'||u==="`")s=u;else if(u==="("||u==="["||u==="{")r++;else if(u===")"||u==="]"||u==="}")r--;else if(u===","&&r===0){n.push(a.trim()),a="";continue}a+=u}if(a.trim())n.push(a.trim());return n}function y(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let s="";for(let a=1;a<n.length-1;a++){let i=n[a];if(i==="\\"&&a+1<n.length-1){let u=n[++a];s+=u==="n"?`
|
|
3
|
+
`:u==="t"?"\t":u;continue}if(i===r)return null;if(r==="`"&&i==="$"&&n[a+1]==="{")return null;s+=i}return s}var R=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Je(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=dn(r);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=Rs(n),i;try{i=l(r,Object.keys(a))(...Object.values(a))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(i!==void 0&&i!==null)return{ok:!0,value:i};let u=[...new Set(ve(r))].filter((c)=>!R.has(c)&&!(c in a)&&!(c in globalThis));if(u.length>0)return{ok:!1,message:`${u.map((p)=>`"${p}"`).join(", ")} ${u.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(i===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:i}}function ue(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function we(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function b(e){if(!e)return"";return v.isAbsolute(e)?v.relative(process.cwd(),e)||e:e}function f(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function k(e,n,r,s,a=t.EVALUATION_ERROR){let i=s?` in ${b(s)}`:"";return console.warn(`[stx] ${f(n)}${i}: ${r}`),o(e,`${f(n)}: ${r}`,a)}function Zn(e,n,r){let s=r?` in ${b(r)}`:"";console.warn(`[stx] ${f(e)}${s}: ${n}`)}var x=["og:","article:","book:","profile:","fb:","music:","video:"],I=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function cn(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=_(e[0],n);if(typeof r!=="string")return r;let s;if(e.length===2){let i=C(e[1],n);if(typeof i!=="string")return i;s=i}else{let i=r.includes(":")?r.slice(r.indexOf(":")+1):r,u=n.openGraph,c=n[i]??(we(u)?u[i]:void 0);s=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!s)return{kind:"empty"};return{kind:"tag",tag:x.some((i)=>r.startsWith(i))?{property:r,content:s}:{name:r,content:s}}}function _(e,n){let r=y(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(I.test(e.trim()))return e.trim();let s=Je(e,n);if(!s.ok)return{kind:"error",message:`meta name: ${s.message}`,code:s.code};if(typeof s.value!=="string"||!s.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${ue(s.value)}`,code:t.TYPE_ERROR};return s.value}function C(e,n){let r=y(e);if(r!==null)return r;let s=Je(e,n);if(!s.ok)return{kind:"error",message:s.message,code:s.code};let a=s.value;if(a===void 0||a===null||a===!1)return"";if(Array.isArray(a))return a.filter((i)=>i!==void 0&&i!==null&&i!=="").map(String).join(", ");if(typeof a==="object"&&!(a instanceof Date))return{kind:"error",message:`the content must be text, got ${ue(a)}`,code:t.TYPE_ERROR};return String(a)}var ln=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Qn=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],S={links:"link",metas:"meta",scripts:"script",styles:"style"},A=new Set,E=new WeakMap;function T(e){if(A.has(e))return;A.add(e),console.warn(e)}function N(e,n){let r=Array.from({length:n.length+1},(s,a)=>a);for(let s=1;s<=e.length;s++){let a=r[0];r[0]=s;for(let i=1;i<=n.length;i++){let u=r[i];r[i]=Math.min(r[i]+1,r[i-1]+1,a+(e[s-1]===n[i-1]?0:1)),a=u}}return r[n.length]}function M(e,n){let r=e.toLowerCase(),s=n.find((p)=>p.toLowerCase()===r);if(s)return s;let a=S[r];if(a&&n.includes(a))return a;let i,u=1/0;for(let p of n){let h=N(r,p.toLowerCase());if(h<u)i=p,u=h}let c=Math.min(e.length,i?.length??0)<=4?1:2;return u<=c?i:void 0}function de(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=E.get(e);if(r)return r;let{known:s,source:a}=n,i=e;for(let u of Object.keys(e)){if(s.includes(u))continue;let c=S[u];if(c&&s.includes(c)&&Array.isArray(e[u])){if(i===e)i={...e};let h=Array.isArray(i[c])?i[c]:[];i[c]=[...h,...e[u]],delete i[u],T(`[stx] ${a}.${u} is not a head key; reading it as ${a}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(u)&&!s.includes("style")){T(`[stx] ${a}.${u} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=M(u,s);T(p?`[stx] ${a}.${u} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${a}.${u} is not a head key and is ignored. Known keys: ${s.join(", ")}.`)}return E.set(e,i),i}var d={},D=[],g={};function Es(){return d}function Wu(){return g}function qu(){d={},D.length=0,g={}}function bo(e){d=pe(d,de(e,{known:Qn,source:"useHead()"}))}function pe(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:[...e.meta||[],...n.meta||[]],link:[...e.link||[],...n.link||[]],script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function $c(e){bo(er(e))}function er(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,s=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(s)n.push({property:"og:description",content:s});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let a=e.twitterTitle??e.title,i=e.twitterDescription??e.description,u=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(a)n.push({name:"twitter:title",content:a});if(i)n.push({name:"twitter:description",content:i});if(u){n.push({name:"twitter:image",content:u});let p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let p of e.articleTags)n.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function Ku(e){if(g={...g,...e},e.title||e.description)$c({title:e.title,description:e.description})}function Xu(e){let n=typeof e==="function"?e():e;bo({title:n})}function Gu(e=d){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${m(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([s,a])=>`${s}="${m(a)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let s=Object.entries(r).filter(([a,i])=>i!==void 0).map(([a,i])=>`${a==="httpEquiv"?"http-equiv":a}="${m(String(i))}"`).join(" ");n.push(`<meta ${s}>`)}for(let r of e.link||[]){let s=Object.entries(r).filter(([a,i])=>i!==void 0).map(([a,i])=>`${a}="${m(String(i))}"`).join(" ");n.push(`<link ${s}>`)}for(let r of e.script||[]){let{content:s,...a}=r,i=Object.entries(a).filter(([u,c])=>c!==void 0).map(([u,c])=>{if(typeof c==="boolean")return c?u:"";return`${u}="${m(String(c))}"`}).filter(Boolean).join(" ");if(s)n.push(`<script ${i}>${s}</script>`);else n.push(`<script ${i}></script>`)}for(let r of e.style||[]){let s=r.type?` type="${r.type}"`:"";n.push(`<style${s}>${r.content}</style>`)}return n.join(`
|
|
4
4
|
`)}function Ju(e=d){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${m(r)}"`).join(" ")}function Yu(e=d){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${m(r)}"`).join(" ")}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Zu(e=d){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let s=document.querySelector(r);if(!s){if(s=document.createElement("meta"),n.name)s.setAttribute("name",n.name);if(n.property)s.setAttribute("property",n.property);document.head.appendChild(s)}s.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,s=document.querySelector(r);if(!s)s=document.createElement("link"),document.head.appendChild(s);for(let[a,i]of Object.entries(n))if(i!==void 0)s.setAttribute(a,String(i))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let s of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(s);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function Qu(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(s,a)=>(n+=a.trim()+`
|
|
5
|
-
`,"")),headContent:n.trim()}}function ed(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,s,a,i)=>{let u=s?a:n[(i||"").trim()]??i,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=pe(c,{title:u}),""})}function td(e,n,r=""){if(!e.includes("@meta"))return e;return Xe(e,/(?<![\w$@])@meta\s*\(/g,(s,a)=>{let i=cn(Ge(s),n);if(i.kind==="error")return k("Meta",a,i.message,r,i.code);if(i.kind==="tag"){let u=n.__stx_runtime_head??{};n.__stx_runtime_head=pe(u,{meta:[i.tag]})}return""},(s)=>k("Meta",s,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{w,
|
|
5
|
+
`,"")),headContent:n.trim()}}function ed(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,s,a,i)=>{let u=s?a:n[(i||"").trim()]??i,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=pe(c,{title:u}),""})}function td(e,n,r=""){if(!e.includes("@meta"))return e;return Xe(e,/(?<![\w$@])@meta\s*\(/g,(s,a)=>{let i=cn(Ge(s),n);if(i.kind==="error")return k("Meta",a,i.message,r,i.code);if(i.kind==="tag"){let u=n.__stx_runtime_head??{};n.__stx_runtime_head=pe(u,{meta:[i.tag]})}return""},(s)=>k("Meta",s,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{w,$s,Xe,Ge,Je,ue,we,k,Zn,cn,ln,Qn,de,Es,Wu,qu,bo,pe,$c,er,Ku,Xu,Gu,Ju,Yu,Zu,Qu,ed,td};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var Lr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function xi(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Lr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
2
|
+
var Lr=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function Si(e,t={}){let r=performance.now(),n={target:t.target||"universal",format:t.format||"zig",optimize:t.optimize??!0,treeShake:t.treeShake??!0,hotReload:t.hotReload??!1,debug:t.debug??!1,sourceMaps:t.sourceMaps??!1,bundle:t.bundle??!0,minify:t.minify??!1,components:t.components||Lr},i=typeof e==="string"?w(e):e,o=I(i.tree,n),s=L(o),a=n.treeShake?O(o,s):o,l=new Map;if(n.target==="universal"){let c=["macos","windows","linux","ios","android"];for(let g of c){let q=u(a,{...n,target:g});l.set(g,q)}}else{let c=u(a,n);l.set(n.target,c)}let p=H(a,n,l),S=_(i,a,n),k={compilationTime:performance.now()-r,totalComponents:f(i.tree),nativeComponents:d(a),webComponents:f(i.tree)-d(a),bundleSize:p.length,treeShakenSize:n.treeShake?W(o,a):p.length,warnings:[],errors:[]},m;if(n.sourceMaps)m=B(i,a);return{code:p,platformCode:l,dependencies:s,manifest:S,sourceMaps:m,stats:k}}function w(e){let t={type:"fragment",children:[]},r=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i),n=r?r[1]:e;return b(n,t),{id:T(),hash:x(e),tree:t,scripts:U(e),styles:Z(e),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:e.includes("{{"),hasEventHandlers:e.includes("onclick")||e.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:e.length}}}function b(e,t){let r=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,n;while((n=r.exec(e))!==null){let[,i,o,s]=n,a=i.startsWith("@craft-"),l={type:a?"component":"element",tag:a?i.slice(1):i,props:z(o),children:[],componentName:a?i.slice(1):void 0};if(s){let p=s.replace(/<[^>]+>/g,"").trim();if(p)l.children=l.children??[],l.children.push({type:"text",text:p});b(s,l)}t.children=t.children??[],t.children.push(l)}}function z(e){let t={},r=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,n;while((n=r.exec(e))!==null){let[,i,o]=n;t[i]=o??!0}return t}function I(e,t){return h(e,t)}function h(e,t){let r=e.componentName?t.components?.get(e.componentName):void 0,n="craft.View";if(r)n=r.zigType;else if(e.type==="text")n="craft.Text";else if(e.tag)n=R(e.tag);let i={};if(e.props)for(let[l,p]of Object.entries(e.props))i[l]=M(p);let o=[];if(e.children)for(let l of e.children)o.push(h(l,t));let s=new Map;if(e.props){for(let[l,p]of Object.entries(e.props))if(l.startsWith("on")&&typeof p==="string")s.set(l.slice(2).toLowerCase(),p)}let a=V(e);return{type:A(e,r),zigType:n,props:i,children:o,events:s,styles:a,id:e.hydrationKey,key:e.props?.key}}function R(e){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[e.toLowerCase()]||"craft.View"}function M(e){if(typeof e==="string"){if(e.startsWith("{{")&&e.endsWith("}}"))return{type:"binding",path:e.slice(2,-2).trim()};if(e.includes("(")&&e.includes(")"))return{type:"callback",handler:e};return{type:"literal",value:e}}if(typeof e==="number"||typeof e==="boolean")return{type:"literal",value:e};return{type:"literal",value:String(e)}}function A(e,t){if(t){let n=t.name.toLowerCase();if(n.includes("button"))return"button";if(n.includes("input")||n.includes("text"))return"input";if(n.includes("image")||n.includes("avatar"))return"image";if(n.includes("list")||n.includes("table"))return"list";if(n.includes("scroll"))return"scroll";return"custom"}if(e.type==="text")return"text";let r=e.tag?.toLowerCase();if(r==="button")return"button";if(r==="input"||r==="textarea")return"input";if(r==="img")return"image";if(r==="ul"||r==="ol")return"list";return"view"}function V(e){let t=e.props?.style,r={},n={};if(t){let i=t.split(";").filter(Boolean);for(let o of i){let[s,a]=o.split(":").map((l)=>l.trim());if(!s||!a)continue;switch(s){case"display":r.display=a;break;case"flex-direction":r.flexDirection=a;break;case"justify-content":r.justifyContent=j(a);break;case"align-items":r.alignItems=D(a);break;case"gap":r.gap=Number.parseInt(a,10);break;case"padding":r.padding=Number.parseInt(a,10);break;case"margin":r.margin=Number.parseInt(a,10);break;case"width":r.width=a==="auto"?"auto":Number.parseInt(a,10);break;case"height":r.height=a==="auto"?"auto":Number.parseInt(a,10);break;case"background-color":case"background":n.backgroundColor=a;break;case"border-color":n.borderColor=a;break;case"border-width":n.borderWidth=Number.parseInt(a,10);break;case"border-radius":n.borderRadius=Number.parseInt(a,10);break;case"opacity":n.opacity=Number.parseFloat(a);break}}}return{layout:r,appearance:n}}function j(e){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[e]||"start"}function D(e){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[e]||"start"}function L(e){let t=[],r=new Set;function n(i,o){let s=i.id||T();if(r.has(s))return;r.add(s);let a={id:s,type:"component",path:i.zigType,dependencies:o?[o]:[],size:C(i),isStatic:P(i)};t.push(a);for(let l of i.children)n(l,s)}return n(e),t}function C(e){let t=100;return t+=Object.keys(e.props).length*20,t+=e.events.size*50,t}function P(e){for(let t of Object.values(e.props))if(t.type!=="literal")return!1;return e.events.size===0}function O(e,t){return e}function W(e,t){let r=0;function n(i){r+=C(i);for(let o of i.children)n(o)}return n(t),r}function u(e,t){switch(t.format){case"zig":return y(e,t);case"typescript":return E(e,t);case"json":return JSON.stringify(e,null,t.minify?0:2);default:return y(e,t)}}function y(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('const std = @import("std");'),r.push('const craft = @import("craft");'),r.push(""),r.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),r.push(" return try build(allocator);"),r.push("}"),r.push(""),N(e,r,0),r.join(`
|
|
3
3
|
`)}function N(e,t,r){let n=" ".repeat(r);if(r===0)t.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let i=`node_${r}`;t.push(`${n} var ${i} = try ${e.zigType}.init(allocator);`);for(let[o,s]of Object.entries(e.props))if(s.type==="literal"){let a=typeof s.value==="string"?`"${s.value}"`:String(s.value);t.push(`${n} ${i}.set${J(o)}(${a});`)}for(let o=0;o<e.children.length;o++){let s=e.children[o];if(s.type==="text"){let a=s.props.text?.type==="literal"?String(s.props.text.value):"";t.push(`${n} try ${i}.addChild(try craft.Text.init(allocator, "${a}"));`)}else N(s,t,r+1),t.push(`${n} try ${i}.addChild(node_${r+1});`)}if(r===0)t.push(` return ${i}.element();`),t.push("}")}function E(e,t){let r=[];return r.push("// Auto-generated by stx compiler"),r.push("// Target: "+t.target),r.push(""),r.push('import { Craft } from "@stacksjs/craft";'),r.push(""),r.push("export function render(): Craft.Element {"),r.push(" return "+v(e,1)+";"),r.push("}"),r.join(`
|
|
4
4
|
`)}function v(e,t){let r=" ".repeat(t),n=[];for(let[a,l]of Object.entries(e.props))if(l.type==="literal"){let p=typeof l.value==="string"?`"${l.value}"`:String(l.value);n.push(`${a}: ${p}`)}let i=n.length>0?`{ ${n.join(", ")} }`:"{}",o=e.children.map((a)=>a.type==="text"?`"${a.props.text?.type==="literal"?a.props.text.value:""}"`:v(a,t+1)),s=o.length>0?`,
|
|
5
5
|
${r} [${o.join(`,
|
|
6
6
|
${r} `)}]`:"";return`Craft.create("${e.zigType}", ${i}${s})`}function H(e,t,r){if(t.target==="universal"){let n=[];n.push("// Universal entry point"),n.push("");for(let[i,o]of r)n.push(`// --- ${i.toUpperCase()} ---`),n.push(`#if ${i.toUpperCase()}`),n.push(o),n.push("#endif"),n.push("");return n.join(`
|
|
7
|
-
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function
|
|
8
|
-
export{Lr,
|
|
7
|
+
`)}return r.get(t.target)||u(e,t)}function _(e,t,r){let n=[];function i(o){n.push({name:o.zigType,hash:x(JSON.stringify(o.props)),props:Object.keys(o.props),events:Array.from(o.events.keys()),slots:[],isNative:o.zigType.startsWith("craft.")});for(let s of o.children)i(s)}return i(t),{version:"1.0.0",components:n,entry:e.id,assets:[],styles:e.styles}}function B(e,t){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var F=0;function T(){return`id_${++F}`}function x(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return Math.abs(t).toString(36)}function J(e){return e.charAt(0).toUpperCase()+e.slice(1)}function U(e){let t=[],r=/<script[^>]*>([\s\S]*?)<\/script>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function Z(e){let t=[],r=/<style[^>]*>([\s\S]*?)<\/style>/gi,n;while((n=r.exec(e))!==null)t.push(n[1]);return t}function f(e){let t=e.type==="component"?1:0;if(e.children)for(let r of e.children)t+=f(r);return t}function d(e){let t=e.zigType.startsWith("craft.")?1:0;for(let r of e.children)t+=d(r);return t}function ki(e){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(t)=>{console.log(`[craft-compiler] File changed: ${t}`)}}}var K={compileToNative:Si,createHotReloadServer:ki,NATIVE_COMPONENTS:Lr},fu=K;
|
|
8
|
+
export{Lr,Si,ki,fu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{oe,Oa,Ii,ft,gt,gu,Di,mt,Jt,Ma,Na,La,ja,ht,Ba}from"./chunk-begfdc6a.js";import"./chunk-d2z6tmzw.js";import"./chunk-9jr7jbgv.js";import"./chunk-8wkja2z2.js";import"./chunk-8x47zcfa.js";import"./chunk-t7x753ga.js";import"./chunk-8bew5svs.js";import"./chunk-ptjqacjd.js";import"./chunk-my3jkpv7.js";import"./chunk-721yq8qx.js";import"./chunk-b9wpgn7b.js";import"./chunk-axydabse.js";import"./chunk-1yj3p63h.js";import"./chunk-pxqs3psa.js";import"./chunk-114zdbnd.js";export{Jt as MODULE_SPECIFIER_PREFIX,ht as bundleClientScript,gt as clearBundleFailures,oe as clientBundleDependencies,ft as getBundleFailures,mt as hasUserImports,Na as normalizeRegistrySpecifiers,ja as queueClientBundleBuild,Ii as recordBundleFailure,Ma as registryIdForPath,Di as resolveBundlerFallback,La as rewriteRegistryImports,gu as setBundlerFallbackMode,Oa as shouldLogBundlerDiagnostics,Ba as tempBuildName};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{A,kc,i,T,ju,Bu}from"./chunk-9jr7jbgv.js";import"./chunk-8wkja2z2.js";import"./chunk-8x47zcfa.js";import"./chunk-t7x753ga.js";import"./chunk-8bew5svs.js";import"./chunk-ptjqacjd.js";import"./chunk-my3jkpv7.js";import"./chunk-721yq8qx.js";import"./chunk-b9wpgn7b.js";import"./chunk-axydabse.js";import"./chunk-1yj3p63h.js";import"./chunk-pxqs3psa.js";import"./chunk-114zdbnd.js";export{T as config,A as defaultConfig,ju as defineStxConfig,i as loadStxConfig,kc as resolveStxDirectories,Bu as validateConfig};
|
|
@@ -825,5 +825,5 @@ self.addEventListener('message', (event) => {
|
|
|
825
825
|
event.waitUntil(registerFormSync(event.data.payload));
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
`}function Ie(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function
|
|
829
|
-
export{An,Ie,
|
|
828
|
+
`}function Ie(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}function Pi(e){return e.pwa?.enabled===!0&&e.pwa?.serviceWorker?.useWorkbox===!0}function Da(e,a){if(!e.pwa?.enabled)return"";if(Pi(e)){let{generateWorkboxServiceWorker:t}=import.meta.require("./chunk-ydz7w2mt.js");return t(e,a)}return An(e,a)}
|
|
829
|
+
export{An,Ie,Pi,Da};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jl,gi,$a,Yl,Zl,Ql,eu,tu,Ea,Ta,nu,ru,su,iu}from"./chunk-nvr0ph6b.js";import"./chunk-9jr7jbgv.js";import"./chunk-8wkja2z2.js";import"./chunk-8x47zcfa.js";import"./chunk-t7x753ga.js";import"./chunk-8bew5svs.js";import"./chunk-ptjqacjd.js";import"./chunk-my3jkpv7.js";import"./chunk-721yq8qx.js";import"./chunk-b9wpgn7b.js";import"./chunk-axydabse.js";import"./chunk-1yj3p63h.js";import"./chunk-pxqs3psa.js";import"./chunk-114zdbnd.js";export{$a as SUSPENSE_RESOLVER_RUNTIME,gi as buildSuspenseResolveScript,tu as createStreamRenderer,Ql as extractStreamBoundaries,iu as generateHydrationRuntime,Ta as islandDirective,ru as processSectionDirectives,Zl as processStreamDirectives,nu as registerStreamingDirectives,Yl as renderStreamingPage,Jl as streamTemplate,eu as streamTemplateSimple,su as streamToResponse,Ea as streamingSuspenseDirective};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$t,S}from"./chunk-
|
|
2
|
+
import{$t,S}from"./chunk-ptjqacjd.js";import m from"fs";import e from"path";async function an(r,o,i){if(r.__stx_runtime_config)return;let n=$t();if(n||i){r.__stx_runtime_config=n??S(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-7jw2zhb9.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=S(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function ws(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|
|
6
6
|
`)}
|
|
7
|
-
export{an,
|
|
7
|
+
export{an,ws};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ru,Fi,Au,zi,Ja,Ya,vt,en,Pu,Za,Qa,ec,f}from"./chunk-9jr7jbgv.js";import"./chunk-8wkja2z2.js";import"./chunk-8x47zcfa.js";import"./chunk-t7x753ga.js";import"./chunk-8bew5svs.js";import"./chunk-ptjqacjd.js";import"./chunk-my3jkpv7.js";import"./chunk-721yq8qx.js";import"./chunk-b9wpgn7b.js";import"./chunk-axydabse.js";import"./chunk-1yj3p63h.js";import"./chunk-pxqs3psa.js";import"./chunk-114zdbnd.js";export{vt as buildCss,Za as extractClassNames,Ya as fingerprintConfig,Qa as generateCss,Pu as getCachedCSS,Ru as getCssServeAsset,f as injectCss,Fi as loadCssEngine,zi as loadCssEngineConfig,en as rebuildCss,Au as resetCssCache,Ja as resolveUserCssConfig,ec as withLinkedModuleBundles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,o,P}from"./chunk-
|
|
3
|
-
`),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,a=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,f]=a,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ne(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=se(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function ie(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function se(e,s){let i=ae(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return oe(r,i.slice(2).join(","),s);case"select":return ce(r,i.slice(2).join(","));case"selectordinal":return ue(r,i.slice(2).join(","));case"number":return ge(r,i[2]?.trim());case"date":return pe(r,i[2]?.trim());case"time":return fe(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function oe(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return k(r[l],n,i);let c=le(n);if(r[c])return k(r[c],n,i);if(r.other)return k(r.other,n,i);return String(n)}function k(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function le(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ce(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function ue(e,s){let i=Number(e)||0,n=I(s),r=de(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function de(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function ge(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function pe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=re(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function ao(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(f,p,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}return O(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return o("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let f=[...r.matchAll(a)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return O(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return o("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((a)=>({match:l,replacement:a}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,s){if(!e||_(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function co(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let f={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:l})}}function xe(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Ae=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let p=e.match(/<html\b([^>]*)>/i);if(p&&q(U(p[1],"lang"),U(p[1],"dir")))i.push({type:"missing-dir",element:p[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function we(e,s){let{protectedSource:i}=ye(e);if(!he())return xe(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of l){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&q(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),p=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function lo(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await hs(l,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let f=await we(g,a);if(u.push(a),f.length>0)i[a]=f}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var uo={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},po={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
2
|
+
import{t,o,P}from"./chunk-b9wpgn7b.js";import{ys}from"./chunk-8x47zcfa.js";import R from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var T={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},E={},L={},v={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...T,...s.i18n}.cache&&E[e]){let r=E[e],l=s.i18n?.cacheMaxAge??0;if(!J(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;v[e]="loading";let n=C(e,s).then((r)=>(v[e]="loaded",delete L[e],r)).catch((r)=>{throw v[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function C(e,s){let i={...T,...s.i18n},n=R.isAbsolute(i.translationsDir)?i.translationsDir:R.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:ee(i.format)}):await Y(e,i,n);if(l===void 0){if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}let c=l;if(i.cache)E[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return C(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=R.join(i,`${e}${Z(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return Q(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Z(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Q(e){let s={},i=e.split(`
|
|
3
|
+
`),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,a=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,f]=a,p=g.trim(),m=f.trim();if(m==="")u[p]={},n.push({obj:u[p],indent:c});else u[p]=X(m)}}return s}function X(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function ee(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function te(e,s){return G(e,s)}function re(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ne(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=ie(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=se(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function ie(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function se(e,s){let i=ae(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return oe(r,i.slice(2).join(","),s);case"select":return ce(r,i.slice(2).join(","));case"selectordinal":return ue(r,i.slice(2).join(","));case"number":return ge(r,i[2]?.trim());case"date":return pe(r,i[2]?.trim());case"time":return fe(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function ae(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function oe(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return k(r[l],n,i);let c=le(n);if(r[c])return k(r[c],n,i);if(r.other)return k(r.other,n,i);return String(n)}function k(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function le(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ce(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function ue(e,s){let i=Number(e)||0,n=I(s),r=de(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function de(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function ge(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function pe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function me(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(me(c))return ne(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=re(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),be=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function _(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return be.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function ao(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...T,...n.i18n},u=await te(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(f,p,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>P(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}return O(p,u,c.fallbackToKey,b)||w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return o("Translate",`Error in @translate('${p}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let f=[...r.matchAll(a)];console.warn(`Found ${f.length} @translate matches`),f.forEach((p,m)=>console.warn(`Match ${m}: ${p[0]}, Key: ${p[1]}, Params: ${p[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(f,p,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>P(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return O(p,u,c.fallbackToKey,h)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return o("Translate",`Error in @translate('${p}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((a)=>({match:l,replacement:a}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,u),e)}function q(e,s){if(!e||_(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function co(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let f={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||f} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function he(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function ye(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:l})}}function xe(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Ae=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let f=0;for(let d of g){if(f>0&&d>f+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${f} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});f=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let p=e.match(/<html\b([^>]*)>/i);if(p&&q(U(p[1],"lang"),U(p[1],"dir")))i.push({type:"missing-dir",element:p[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function we(e,s){let{protectedSource:i}=ye(e);if(!he())return xe(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),f=g&&r.querySelector(`label[for="${g}"]`),p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!f&&!p&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of l){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&q(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),p=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!f&&!p&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function lo(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await ys(l,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let f=await we(g,a);if(u.push(a),f.length>0)i[a]=f}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var uo={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},po={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{ao,co,lo,uo,po};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Cc(o){return w.test(o)}async function
|
|
3
|
-
export{Cc,
|
|
2
|
+
import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Cc(o){return w.test(o)}async function ys(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Cc(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
|
|
3
|
+
export{Cc,ys};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-b9wpgn7b.js";import"./chunk-8x47zcfa.js";import"./chunk-8wkja2z2.js";import{a}from"./chunk-wtms9jhs.js";import f from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},o=t.snapshotDir||a(e.root,"story","snapshots");await f.promises.mkdir(o,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((i)=>t.filter.some((p)=>i.fileName.toLowerCase().includes(p.toLowerCase())));for(let i of r)await h(i,o,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let o=e.story;if(!o)return;for(let r of o.variants){n.total++;let i=l.join(t,`${e.id}-${r.id}.snap`),p=g(r.source||""),c=await w(i);if(s.update||!c){let u={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:p};if(await f.promises.writeFile(i,JSON.stringify(u,null,2)),!c)n.new++;n.passed++}else try{let u=await f.promises.readFile(i,"utf-8"),m=JSON.parse(u);if(m.hash===p)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,p)})}catch(u){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${u}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await f.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\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\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"),t.push(" STX Story Visual Regression Tests"),t.push("\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\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"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\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\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"),t.push(""),t.join(`
|
|
3
3
|
`)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
|