@stacksjs/stx 0.2.343 → 0.2.345

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.
Files changed (169) hide show
  1. package/dist/binding-manifest.d.ts +32 -0
  2. package/dist/binding-manifest.js +64 -0
  3. package/dist/{chunk-zr1x54bt.js → chunk-05zfez2g.js} +1 -1
  4. package/dist/{chunk-jagf7h9y.js → chunk-0k1mtwby.js} +1 -1
  5. package/dist/{chunk-jh6f1a9y.js → chunk-1c9453w0.js} +1 -1
  6. package/dist/chunk-1qyg1q6d.js +2 -0
  7. package/dist/chunk-1t4ece3v.js +2 -0
  8. package/dist/{chunk-7zxv2631.js → chunk-1vt1h19d.js} +1 -1
  9. package/dist/chunk-1vtdege3.js +2 -0
  10. package/dist/{chunk-stqm4brp.js → chunk-1vv9g6cj.js} +1 -1
  11. package/dist/{chunk-p3awq80d.js → chunk-1yh6pq6b.js} +1 -1
  12. package/dist/{chunk-57dxdvjh.js → chunk-223makqc.js} +1 -1
  13. package/dist/chunk-2fhk4e68.js +2 -0
  14. package/dist/{chunk-wyhb3nb0.js → chunk-34f8c48f.js} +1 -1
  15. package/dist/chunk-3zm4hgcf.js +2 -0
  16. package/dist/{chunk-xgw269cf.js → chunk-4spaszfn.js} +286 -286
  17. package/dist/chunk-57t402mn.js +2 -0
  18. package/dist/{chunk-wdaf98ya.js → chunk-59906baj.js} +1 -1
  19. package/dist/{chunk-z9hb80mk.js → chunk-64n10kpa.js} +1 -1
  20. package/dist/chunk-66tgkvqw.js +2 -0
  21. package/dist/{chunk-daxr6p6q.js → chunk-6fwp7gee.js} +1 -1
  22. package/dist/{chunk-1bfvdjpy.js → chunk-6h3r8v55.js} +1 -1
  23. package/dist/{chunk-safmgrq5.js → chunk-6wmjwbq9.js} +1 -1
  24. package/dist/{chunk-53sjbp3z.js → chunk-72x62kch.js} +2 -2
  25. package/dist/{chunk-amfq5rnz.js → chunk-72yrrggn.js} +2 -2
  26. package/dist/{chunk-2853ye06.js → chunk-77p1kjg2.js} +2 -2
  27. package/dist/chunk-7g5vk4c3.js +2 -0
  28. package/dist/{chunk-7mc1k1tq.js → chunk-7h9fajgs.js} +1 -1
  29. package/dist/{chunk-gvfgrve8.js → chunk-7m9qk7da.js} +1 -1
  30. package/dist/{chunk-3d3x7dwy.js → chunk-7qp3zphs.js} +1 -1
  31. package/dist/{chunk-grnmr3y1.js → chunk-86c461ca.js} +1 -1
  32. package/dist/chunk-86q2h34b.js +2 -0
  33. package/dist/{chunk-7r79j1hs.js → chunk-89mqnh67.js} +1 -1
  34. package/dist/{chunk-5hq25yky.js → chunk-8cc4vdkh.js} +1 -1
  35. package/dist/chunk-8rhjt6fh.js +2 -0
  36. package/dist/{chunk-45ydb29q.js → chunk-8v2k21n4.js} +1 -1
  37. package/dist/{chunk-aqxwwq6w.js → chunk-8y1ve8tc.js} +2 -2
  38. package/dist/{chunk-ag8gdk51.js → chunk-99b5tfxc.js} +1 -1
  39. package/dist/{chunk-4vd0rqfs.js → chunk-9jbssgem.js} +197 -88
  40. package/dist/{chunk-s60eccqk.js → chunk-9nrgjtah.js} +1 -1
  41. package/dist/{chunk-y5sxa2sq.js → chunk-9qtf2b1p.js} +1 -1
  42. package/dist/chunk-aapqf6bj.js +2 -0
  43. package/dist/{chunk-k8skvm0d.js → chunk-at622hg0.js} +1 -1
  44. package/dist/{chunk-1qtd4ex2.js → chunk-avwywzsj.js} +2 -2
  45. package/dist/{chunk-a0ajg9z5.js → chunk-b5hank5e.js} +1 -1
  46. package/dist/chunk-b5mnam29.js +2 -0
  47. package/dist/{chunk-4fafxr8d.js → chunk-bk1zb1xp.js} +1 -1
  48. package/dist/{chunk-hrdd26r4.js → chunk-bqdfbwdf.js} +1 -1
  49. package/dist/{chunk-c7qdnc5d.js → chunk-c30qnb6z.js} +1 -1
  50. package/dist/chunk-c4tf1vpy.js +2 -0
  51. package/dist/{chunk-g0dbtyk7.js → chunk-c8e2deyp.js} +1 -1
  52. package/dist/chunk-cypg8qwn.js +2 -0
  53. package/dist/{chunk-fbmjw0bh.js → chunk-d86q27j8.js} +1 -1
  54. package/dist/{chunk-dj5mqnp1.js → chunk-dgv43ccd.js} +1 -1
  55. package/dist/{chunk-em8cr7wy.js → chunk-dsztk2kp.js} +1 -1
  56. package/dist/{chunk-mwvxhv0r.js → chunk-dxkjvajv.js} +1 -1
  57. package/dist/{chunk-4pg6wbt6.js → chunk-e631svvs.js} +1 -1
  58. package/dist/chunk-e7gs18rc.js +2 -0
  59. package/dist/{chunk-h6y99nak.js → chunk-e7np0h2q.js} +1 -1
  60. package/dist/{chunk-0s3ry262.js → chunk-ejqpq0wc.js} +1 -1
  61. package/dist/chunk-ek2m0kkw.js +2 -0
  62. package/dist/chunk-eqzc88et.js +2 -0
  63. package/dist/chunk-erb294sv.js +2 -0
  64. package/dist/{chunk-36j9qset.js → chunk-esjcyxa9.js} +2 -2
  65. package/dist/{chunk-5azeswj2.js → chunk-evfr2zgg.js} +1 -1
  66. package/dist/{chunk-e53pwshq.js → chunk-fp868yhg.js} +1 -1
  67. package/dist/{chunk-5zemhhwe.js → chunk-gsc2vds7.js} +1 -1
  68. package/dist/{chunk-q6825wwz.js → chunk-gvemapw4.js} +1 -1
  69. package/dist/chunk-h1vax4wg.js +2 -0
  70. package/dist/chunk-hke0k33t.js +2 -0
  71. package/dist/{chunk-zcytk5w9.js → chunk-jekrtm2j.js} +1 -1
  72. package/dist/{chunk-pwhf5kte.js → chunk-jnbg3e4r.js} +1 -1
  73. package/dist/{chunk-brjfzbq9.js → chunk-kfkf9v2d.js} +1 -1
  74. package/dist/chunk-kq30wqp6.js +2 -0
  75. package/dist/{chunk-s7qbba8r.js → chunk-kqzpmwx2.js} +10 -10
  76. package/dist/{chunk-0dpgh7a6.js → chunk-kw9cgyfc.js} +1 -1
  77. package/dist/{chunk-0fp16c1x.js → chunk-m2j5skez.js} +1 -1
  78. package/dist/{chunk-vj3nx26v.js → chunk-mph46gkj.js} +1 -1
  79. package/dist/chunk-mr8ccsnm.js +2 -0
  80. package/dist/{chunk-1h1c2048.js → chunk-msywnv5n.js} +1 -1
  81. package/dist/{chunk-649dfqqz.js → chunk-n5657hm3.js} +1 -1
  82. package/dist/{chunk-t00ga194.js → chunk-njx93b4z.js} +1 -1
  83. package/dist/{chunk-m0xaw0qw.js → chunk-nm60wh6r.js} +1 -1
  84. package/dist/{chunk-8ah5mhst.js → chunk-nqz501eq.js} +2 -2
  85. package/dist/{chunk-hq3phk1a.js → chunk-nrt99ptw.js} +1 -1
  86. package/dist/{chunk-62vng8g8.js → chunk-pajk5680.js} +2 -2
  87. package/dist/{chunk-ey1tsk22.js → chunk-ppzz953j.js} +1 -1
  88. package/dist/{chunk-7yfk9393.js → chunk-qkdcbeaw.js} +1 -1
  89. package/dist/chunk-qr3zcm87.js +2 -0
  90. package/dist/chunk-r38xq7fp.js +33 -0
  91. package/dist/{chunk-tqw1yean.js → chunk-rwwfzkz4.js} +1 -1
  92. package/dist/{chunk-rns7wjy9.js → chunk-rzda6bd6.js} +1 -1
  93. package/dist/{chunk-rzg9pars.js → chunk-san1eq0r.js} +2 -2
  94. package/dist/{chunk-eh3meyd3.js → chunk-tc4pj651.js} +2 -2
  95. package/dist/{chunk-6g8rvnhc.js → chunk-v6e35j4g.js} +1 -1
  96. package/dist/{chunk-wnmegbw0.js → chunk-v7aa7v85.js} +1 -1
  97. package/dist/{chunk-e6rxvz3p.js → chunk-vhg91hnw.js} +1 -1
  98. package/dist/{chunk-k3dtvay1.js → chunk-vhta1be7.js} +1 -1
  99. package/dist/{chunk-tz68qv47.js → chunk-w5j9tbsk.js} +1 -1
  100. package/dist/{chunk-ec18ftcg.js → chunk-wj21f1e0.js} +1 -1
  101. package/dist/{chunk-12qteqk8.js → chunk-ws0282jr.js} +1 -1
  102. package/dist/chunk-x054qzma.js +2 -0
  103. package/dist/{chunk-q9ckfwhh.js → chunk-xj6bcwqa.js} +1 -1
  104. package/dist/chunk-xq0e2y4x.js +2 -0
  105. package/dist/chunk-xrjx7b2v.js +2 -0
  106. package/dist/{chunk-ay336sqb.js → chunk-xvh1k1a4.js} +1 -1
  107. package/dist/{chunk-vaggjvsm.js → chunk-y2f41kaq.js} +1 -1
  108. package/dist/{chunk-1zav2sf1.js → chunk-y6xzr30x.js} +1 -1
  109. package/dist/chunk-ybx8n794.js +2 -0
  110. package/dist/{chunk-yefnrr5z.js → chunk-yca761bm.js} +1 -1
  111. package/dist/{chunk-kgbz86sa.js → chunk-yg5r7bnm.js} +2 -2
  112. package/dist/{chunk-kbah2k8e.js → chunk-z8wb7kbj.js} +2 -2
  113. package/dist/chunk-zkxnarrh.js +2 -0
  114. package/dist/{chunk-hzbty7hz.js → chunk-zmazqcb8.js} +1 -1
  115. package/dist/chunk-zp14ksx1.js +2 -0
  116. package/dist/chunk-zwr4bn6a.js +2 -0
  117. package/dist/cli.js +14 -14
  118. package/dist/craft-entry.js +1 -1
  119. package/dist/craft.js +1 -1
  120. package/dist/database.js +1 -1
  121. package/dist/expressions.d.ts +1 -1
  122. package/dist/expressions.js +15 -3
  123. package/dist/includes.js +2 -2
  124. package/dist/pwa.js +2 -2
  125. package/dist/runtime-globals.d.ts +22 -0
  126. package/dist/runtime-globals.js +46 -0
  127. package/dist/signals.js +193 -84
  128. package/dist/slots.js +3 -3
  129. package/dist/ssg.js +2 -2
  130. package/dist/theme-tokens.d.ts +59 -0
  131. package/dist/theme-tokens.js +83 -17
  132. package/dist/ts-css-config.js +4 -2
  133. package/dist/utils.d.ts +10 -0
  134. package/dist/utils.js +77 -12
  135. package/dist/variable-extractor.d.ts +1 -1
  136. package/dist/variable-extractor.js +23 -3
  137. package/dist/visual-testing.js +1 -1
  138. package/package.json +5 -5
  139. package/dist/chunk-160g7ynw.js +0 -2
  140. package/dist/chunk-16hr5y08.js +0 -2
  141. package/dist/chunk-3h97y3n3.js +0 -2
  142. package/dist/chunk-3j915h2d.js +0 -2
  143. package/dist/chunk-4hkg6kx4.js +0 -2
  144. package/dist/chunk-57494khk.js +0 -2
  145. package/dist/chunk-5xavmr4t.js +0 -2
  146. package/dist/chunk-6rsfkms1.js +0 -2
  147. package/dist/chunk-6xs80tka.js +0 -32
  148. package/dist/chunk-905j49fe.js +0 -2
  149. package/dist/chunk-9czj483k.js +0 -2
  150. package/dist/chunk-9kv0qavn.js +0 -2
  151. package/dist/chunk-bcz8yp2g.js +0 -2
  152. package/dist/chunk-bxefsc7k.js +0 -2
  153. package/dist/chunk-c4kv3r8t.js +0 -2
  154. package/dist/chunk-fytemc96.js +0 -2
  155. package/dist/chunk-g7gc0ten.js +0 -2
  156. package/dist/chunk-gqsxxd81.js +0 -2
  157. package/dist/chunk-gx9z0wmm.js +0 -2
  158. package/dist/chunk-jnxzzzm4.js +0 -2
  159. package/dist/chunk-jy6jwxhs.js +0 -2
  160. package/dist/chunk-khqn40gv.js +0 -2
  161. package/dist/chunk-mhbzrh5y.js +0 -2
  162. package/dist/chunk-p8anntjb.js +0 -2
  163. package/dist/chunk-pwe51myj.js +0 -2
  164. package/dist/chunk-rqqdvnp5.js +0 -2
  165. package/dist/chunk-w1mbrq1g.js +0 -2
  166. package/dist/chunk-w84qe2m6.js +0 -2
  167. package/dist/chunk-wjm7hv5e.js +0 -2
  168. package/dist/chunk-yr7s02f7.js +0 -2
  169. package/dist/chunk-zq3tm2c2.js +0 -2
@@ -371,13 +371,25 @@ function expressionReadsServerBinding(expr, context) {
371
371
  return !0;
372
372
  return !1;
373
373
  }
374
- export function interpolateScriptExpressions(scriptBody, context) {
374
+ const reportedUnresolvedScriptExpressions = new Set;
375
+ function looksLikeServerValue(expression) {
376
+ return /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(expression.trim());
377
+ }
378
+ function unresolvedServerValue(expression, filePath) {
379
+ const key = `${filePath ?? "<unknown>"}\x00${expression}`;
380
+ if (process.env.STX_DEBUG || !reportedUnresolvedScriptExpressions.has(key)) {
381
+ reportedUnresolvedScriptExpressions.add(key);
382
+ console.warn(`[stx] {{ ${expression} }} in a <script> in ${filePath ?? "<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);
383
+ }
384
+ return "undefined";
385
+ }
386
+ export function interpolateScriptExpressions(scriptBody, context, filePath) {
375
387
  let output = scriptBody;
376
388
  output = output.replace(/\{!!([\s\S]*?)!!\}/g, (match, expr) => {
377
389
  try {
378
390
  const value = evaluateExpression(expr, context);
379
391
  if (value === void 0)
380
- return match;
392
+ return looksLikeServerValue(expr) ? unresolvedServerValue(expr.trim(), filePath) : match;
381
393
  return value === null ? "" : String(value);
382
394
  } catch {
383
395
  return match;
@@ -390,7 +402,7 @@ export function interpolateScriptExpressions(scriptBody, context) {
390
402
  try {
391
403
  const value = evaluateExpression(expr, context);
392
404
  if (value === void 0)
393
- return match;
405
+ return looksLikeServerValue(trimmed) ? unresolvedServerValue(trimmed, filePath) : match;
394
406
  return JSON.stringify(value).replace(/</g, "\\u003c");
395
407
  } catch {
396
408
  return match;
package/dist/includes.js CHANGED
@@ -623,7 +623,7 @@ export async function processIncludes(template, context, filePath, options, depe
623
623
  const isServerScript = scriptAttrs.includes("server"), shouldTranspile = shouldTranspileTypeScript(scriptAttrs);
624
624
  if (!isServerScript && scriptContent.trim()) {
625
625
  const { interpolateScriptExpressions } = await import("./expressions.js");
626
- scriptContent = interpolateScriptExpressions(scriptContent, includeContext);
626
+ scriptContent = interpolateScriptExpressions(scriptContent, includeContext, includePath);
627
627
  }
628
628
  let vendorStyleTags = "";
629
629
  try {
@@ -684,7 +684,7 @@ export async function processIncludes(template, context, filePath, options, depe
684
684
  const { interpolateScriptExpressions } = await import("./expressions.js");
685
685
  workingContent = workingContent.replace(/__STX_DATA_BLOCK_(\d+)__/g, (_token, index) => {
686
686
  const block = dataBlocks[Number(index)];
687
- return `<script${block.attrs}>${interpolateScriptExpressions(block.body, includeContext)}</script>`;
687
+ return `<script${block.attrs}>${interpolateScriptExpressions(block.body, includeContext, includePath)}</script>`;
688
688
  });
689
689
  }
690
690
  if (signalScopeId) {
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Fk as wq,Gk as dq,Hk as Cq,Ik as mq,Jk as gq}from"./chunk-wvc7t11n.js";import{Kk as S,Lk as Tq,Mk as _q,Nk as z,Ok as D,Pk as P,Qk as kq,Rk as vq,Sk as w,Tk as Iq,Uk as d,Vk as Hq,Wk as Oq,Xk as Mq}from"./chunk-c7qdnc5d.js";import{Aw as Sq,Bw as zq,Cw as Dq,Dw as Pq,yw as Aq,zw as bq}from"./chunk-s60eccqk.js";import{Hw as N}from"./chunk-0s3ry262.js";import p from"fs";import E from"path";import C from"fs";import L from"path";var k=[72,96,128,144,152,192,384,512],v=[120,152,167,180],I=[16,32];async function H(G,B){let q={success:!0,generatedFiles:[],errors:[],warnings:[]},K=G.pwa?.icons;if(!K?.src)return q.errors.push("No source icon specified in pwa.icons.src"),q.success=!1,q;let Y=L.isAbsolute(K.src)?K.src:L.resolve(process.cwd(),K.src);if(!await Bun.file(Y).exists())return q.errors.push(`Source icon not found: ${Y}`),q.success=!1,q;let Q=L.resolve(B,K.outputDir||"pwa-icons");try{C.mkdirSync(Q,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${Q}`),q.success=!1,q}let X=K.sizes||k,j=K.generateWebP??!0,J=K.generateAppleIcons??!0;try{let y;try{y=await import("sharp")}catch{return q.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-fytemc96.js"),Y=await Bun.file(q).text();return await K(Y,{},q,G,new Set)}catch(K){console.warn(`[PWA] Failed to process custom offline page: ${K}`)}else console.warn(`[PWA] Custom offline page not found: ${q}`)}return f(G)}function f(G){let B=G.pwa?.offline,q=G.pwa?.manifest,K=B?.fallbackTitle||"You are offline",Y=B?.fallbackMessage||"Please check your internet connection and try again.",Q=q?.themeColor||"#4f46e5",X=q?.shortName||q?.name||"App";return`<!DOCTYPE html>
2
+ import{Fk as wq,Gk as dq,Hk as Cq,Ik as mq,Jk as gq}from"./chunk-wvc7t11n.js";import{Kk as S,Lk as Tq,Mk as _q,Nk as z,Ok as D,Pk as P,Qk as kq,Rk as vq,Sk as w,Tk as Iq,Uk as d,Vk as Hq,Wk as Oq,Xk as Mq}from"./chunk-c30qnb6z.js";import{Ew as Aq,Fw as bq,Gw as Sq,Hw as zq,Iw as Dq,Jw as Pq}from"./chunk-9nrgjtah.js";import{Nw as N}from"./chunk-ejqpq0wc.js";import p from"fs";import E from"path";import C from"fs";import L from"path";var k=[72,96,128,144,152,192,384,512],v=[120,152,167,180],I=[16,32];async function H(G,B){let q={success:!0,generatedFiles:[],errors:[],warnings:[]},K=G.pwa?.icons;if(!K?.src)return q.errors.push("No source icon specified in pwa.icons.src"),q.success=!1,q;let Y=L.isAbsolute(K.src)?K.src:L.resolve(process.cwd(),K.src);if(!await Bun.file(Y).exists())return q.errors.push(`Source icon not found: ${Y}`),q.success=!1,q;let Q=L.resolve(B,K.outputDir||"pwa-icons");try{C.mkdirSync(Q,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${Q}`),q.success=!1,q}let X=K.sizes||k,j=K.generateWebP??!0,J=K.generateAppleIcons??!0;try{let y;try{y=await import("sharp")}catch{return q.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-2fhk4e68.js"),Y=await Bun.file(q).text();return await K(Y,{},q,G,new Set)}catch(K){console.warn(`[PWA] Failed to process custom offline page: ${K}`)}else console.warn(`[PWA] Custom offline page not found: ${q}`)}return f(G)}function f(G){let B=G.pwa?.offline,q=G.pwa?.manifest,K=B?.fallbackTitle||"You are offline",Y=B?.fallbackMessage||"Please check your internet connection and try again.",Q=q?.themeColor||"#4f46e5",X=q?.shortName||q?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -224,6 +224,28 @@ export declare const ALPINE_BRIDGE_X_ATTRS: readonly string[];
224
224
  export declare const COMPONENT_PASSTHROUGH_X_ATTRS: readonly string[];
225
225
  /** The `X_HANDLED` lookup the generated runtime embeds, as JS source. */
226
226
  export declare function runtimeHandledXAttrsLiteral(): string;
227
+ /**
228
+ * The colon names that route to their own binder rather than to the generic
229
+ * attribute binding: `:text` is a text binding, `:title` is an attribute.
230
+ *
231
+ * Shared for the same reason the `x-` table is. Anything that has to decide
232
+ * what an attribute *means* -- the runtime's dispatch, and the compile-time
233
+ * binding manifest that has to find every binding the runtime would -- needs
234
+ * this list, and two copies of it disagree eventually.
235
+ */
236
+ export declare const RUNTIME_DIRECTIVE_NAMES: readonly string[];
237
+ /** The `DIRECTIVE_NAMES` lookup the generated runtime embeds, as JS source. */
238
+ export declare function runtimeDirectiveNamesLiteral(): string;
239
+ /**
240
+ * Event names a bare `:name` or `@name` is read as a listener for.
241
+ *
242
+ * Prefix-matched, so `click` also covers `click.stop` and `click.prevent`.
243
+ */
244
+ export declare const RUNTIME_EVENT_NAMES: readonly string[];
245
+ /** The `EVENT_RE` the generated runtime embeds, as JS source. */
246
+ export declare function runtimeEventRegexLiteral(): string;
247
+ /** Does this name begin with an event the runtime binds as a listener? */
248
+ export declare function isRuntimeEventName(name: string): boolean;
227
249
  /**
228
250
  * Drop cached blanked documents.
229
251
  *
@@ -205,6 +205,52 @@ export const RUNTIME_HANDLED_X_ATTRS = [
205
205
  export function runtimeHandledXAttrsLiteral() {
206
206
  return `{${RUNTIME_HANDLED_X_ATTRS.map((n) => `'${n}':1`).join(",")}}`;
207
207
  }
208
+ export const RUNTIME_DIRECTIVE_NAMES = [
209
+ "class",
210
+ "style",
211
+ "text",
212
+ "html",
213
+ "show",
214
+ "model",
215
+ "if",
216
+ "ref"
217
+ ];
218
+ export function runtimeDirectiveNamesLiteral() {
219
+ return `{${RUNTIME_DIRECTIVE_NAMES.map((n) => n === "if" ? "'if':1" : `${n}:1`).join(",")}}`;
220
+ }
221
+ export const RUNTIME_EVENT_NAMES = [
222
+ "click",
223
+ "dblclick",
224
+ "mousedown",
225
+ "mouseup",
226
+ "mousemove",
227
+ "mouseenter",
228
+ "mouseleave",
229
+ "keydown",
230
+ "keyup",
231
+ "keypress",
232
+ "input",
233
+ "change",
234
+ "submit",
235
+ "focus",
236
+ "blur",
237
+ "scroll",
238
+ "resize",
239
+ "touchstart",
240
+ "touchend",
241
+ "touchmove",
242
+ "contextmenu",
243
+ "wheel",
244
+ "pointerdown",
245
+ "pointerup",
246
+ "pointermove"
247
+ ];
248
+ export function runtimeEventRegexLiteral() {
249
+ return `/^(${RUNTIME_EVENT_NAMES.join("|")})/`;
250
+ }
251
+ export function isRuntimeEventName(name) {
252
+ return RUNTIME_EVENT_NAMES.some((event) => name === event || name.startsWith(`${event}.`));
253
+ }
208
254
  const BLANK_CACHE_MIN_BYTES = 65536, BLANK_CACHE_MAX_ENTRIES = 4, blankCache = new Map;
209
255
  export function clearBlankCache() {
210
256
  blankCache.clear();