@stacksjs/stx 0.2.770 → 0.2.774

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 (253) hide show
  1. package/dist/app-shell.d.ts +10 -0
  2. package/dist/app-shell.js +3 -0
  3. package/dist/{chunk-7wwfaj6b.js → chunk-06wqf3t8.js} +3 -3
  4. package/dist/chunk-08c2c9ee.js +2 -0
  5. package/dist/chunk-0jvrzpfs.js +2 -0
  6. package/dist/chunk-0perf9at.js +2 -0
  7. package/dist/{chunk-s8p958da.js → chunk-1frxaa7e.js} +59 -59
  8. package/dist/{chunk-zsfr4dv9.js → chunk-1hdhfc4w.js} +6 -6
  9. package/dist/chunk-1msebzht.js +2 -0
  10. package/dist/chunk-1tvb2stj.js +2 -0
  11. package/dist/{chunk-edetp97r.js → chunk-200z6ew1.js} +5 -5
  12. package/dist/{chunk-krdc3c87.js → chunk-20afyff6.js} +3 -3
  13. package/dist/{chunk-p1mbbdwj.js → chunk-27rzdq3n.js} +2 -2
  14. package/dist/{chunk-xaqtk05e.js → chunk-2gqhfge6.js} +2 -2
  15. package/dist/chunk-2vnhyter.js +2 -0
  16. package/dist/{chunk-4833k99b.js → chunk-2yxva96k.js} +2 -2
  17. package/dist/{chunk-477gjb2b.js → chunk-416jy1m5.js} +2 -2
  18. package/dist/chunk-47qestfz.js +2 -0
  19. package/dist/chunk-4kx7pw6x.js +2 -0
  20. package/dist/{chunk-x148cxrj.js → chunk-4wc5pc19.js} +4 -4
  21. package/dist/{chunk-3csfmhg0.js → chunk-5emrarpf.js} +2 -2
  22. package/dist/{chunk-erjp2w63.js → chunk-5mng4x26.js} +5 -5
  23. package/dist/{chunk-bwzjjxnj.js → chunk-605b93pe.js} +4 -4
  24. package/dist/{chunk-y6hyndrt.js → chunk-6smzs5vp.js} +10 -10
  25. package/dist/chunk-6xapz9dx.js +2 -0
  26. package/dist/chunk-713az4kg.js +2 -0
  27. package/dist/{chunk-0h3sf5tp.js → chunk-79b3sbft.js} +6 -6
  28. package/dist/chunk-7fhw11qd.js +2 -0
  29. package/dist/{chunk-6sa5adg6.js → chunk-7gdwvnwc.js} +2 -2
  30. package/dist/{chunk-g4k0svq6.js → chunk-7qk4exw1.js} +2 -2
  31. package/dist/{chunk-wmnzapn8.js → chunk-7sh9fa3q.js} +2 -2
  32. package/dist/chunk-7y2h7nfd.js +2 -0
  33. package/dist/chunk-7y6ad89y.js +2 -0
  34. package/dist/chunk-8dby49s0.js +2 -0
  35. package/dist/chunk-8ds59ttd.js +2 -0
  36. package/dist/{chunk-6cd5dyje.js → chunk-8k4j2xv8.js} +68 -68
  37. package/dist/{chunk-4qng287p.js → chunk-8nb8b0nf.js} +2 -2
  38. package/dist/chunk-8pyyqev1.js +2 -0
  39. package/dist/chunk-8qhznykd.js +177 -0
  40. package/dist/{chunk-83fh7j8g.js → chunk-985afhhy.js} +2 -2
  41. package/dist/chunk-9896204h.js +2 -0
  42. package/dist/{chunk-2vbgm9t4.js → chunk-9ct3gbyv.js} +6 -6
  43. package/dist/{chunk-yzbdm457.js → chunk-9f6qx8b9.js} +2 -2
  44. package/dist/{chunk-yjzczm2s.js → chunk-9jfva11p.js} +17 -17
  45. package/dist/chunk-9qwkyt81.js +2 -0
  46. package/dist/{chunk-tahdfsp4.js → chunk-9tec9eap.js} +2 -2
  47. package/dist/{chunk-7t1medmh.js → chunk-9z6331xs.js} +2 -2
  48. package/dist/{chunk-prxe37hj.js → chunk-a10y92qp.js} +30 -30
  49. package/dist/{chunk-6k4tbms6.js → chunk-a7f2xqsh.js} +9 -9
  50. package/dist/{chunk-gzxjayvp.js → chunk-abfphkss.js} +9 -9
  51. package/dist/{chunk-vht2rhrj.js → chunk-ady8cnpb.js} +5 -5
  52. package/dist/chunk-aj5b9dm3.js +2 -0
  53. package/dist/chunk-ajj56vrw.js +2 -0
  54. package/dist/{chunk-amnydj3d.js → chunk-ajmexj79.js} +1 -1
  55. package/dist/chunk-b3b9tfpx.js +2 -0
  56. package/dist/{chunk-ytjhb81r.js → chunk-bengxr5p.js} +3 -3
  57. package/dist/{chunk-efr9dgt6.js → chunk-bgc2fm73.js} +2 -2
  58. package/dist/{chunk-wabahwkj.js → chunk-bmfk3b29.js} +2 -2
  59. package/dist/{chunk-5s2dwh5z.js → chunk-bq9xf8nq.js} +16 -16
  60. package/dist/{chunk-392rrp28.js → chunk-br91e06f.js} +2 -2
  61. package/dist/{chunk-hgm6f2t2.js → chunk-c0ejyxfj.js} +3 -3
  62. package/dist/{chunk-9ewhnwcg.js → chunk-c85dv6tv.js} +5 -5
  63. package/dist/chunk-c91y14ae.js +2 -0
  64. package/dist/{chunk-dmj9gk6d.js → chunk-cfpw4c6b.js} +2 -2
  65. package/dist/chunk-cgamtmxv.js +2 -0
  66. package/dist/chunk-cpq9b0fx.js +2 -0
  67. package/dist/{chunk-m207mdpy.js → chunk-cz8mka1b.js} +2 -2
  68. package/dist/{chunk-rkz3k2td.js → chunk-d18xd9x5.js} +3 -3
  69. package/dist/chunk-defwzg9q.js +2 -0
  70. package/dist/chunk-drwa5hjd.js +2 -0
  71. package/dist/{chunk-3png7zhs.js → chunk-dvcfhx4y.js} +6 -6
  72. package/dist/chunk-dxp022r0.js +2 -0
  73. package/dist/{chunk-xr28hjkp.js → chunk-e1gxykm8.js} +7 -7
  74. package/dist/{chunk-rjh7ptw5.js → chunk-e7477r0v.js} +1 -1
  75. package/dist/{chunk-7h0mjwkq.js → chunk-eapt899m.js} +5 -5
  76. package/dist/{chunk-qtja7fpr.js → chunk-et1vz3wd.js} +2 -2
  77. package/dist/{chunk-s3m1ggsn.js → chunk-evb5y7sm.js} +6 -6
  78. package/dist/chunk-fbv7byxx.js +2 -0
  79. package/dist/chunk-fgstg93m.js +2 -0
  80. package/dist/chunk-fmzfmh9n.js +2 -0
  81. package/dist/{chunk-ssd9g1wz.js → chunk-fpn4dren.js} +1 -1
  82. package/dist/chunk-ft994mav.js +2 -0
  83. package/dist/chunk-gbgbhpms.js +2 -0
  84. package/dist/{chunk-cn7zpm1x.js → chunk-gbx5vw81.js} +5 -5
  85. package/dist/chunk-gdkcskm7.js +2 -0
  86. package/dist/chunk-gxp9ms4w.js +2 -0
  87. package/dist/chunk-hc0c0p0r.js +2 -0
  88. package/dist/{chunk-w07n2ddj.js → chunk-he85ksa7.js} +2 -2
  89. package/dist/chunk-hr8rzzcn.js +2 -0
  90. package/dist/{chunk-z846tgfe.js → chunk-j576e8tm.js} +3 -3
  91. package/dist/chunk-jdj1358b.js +3 -0
  92. package/dist/chunk-jpnptbtm.js +2 -0
  93. package/dist/{chunk-mcct58gb.js → chunk-k003phkg.js} +7 -7
  94. package/dist/{chunk-z5vkzbct.js → chunk-k0aejzg9.js} +4 -4
  95. package/dist/{chunk-0wj31pqy.js → chunk-k3rcpnzm.js} +2 -2
  96. package/dist/{chunk-nnzmbfjq.js → chunk-k4bdf0dw.js} +3 -3
  97. package/dist/chunk-k9dg3nyy.js +2 -0
  98. package/dist/{chunk-ddhazq2g.js → chunk-kf8hzvb7.js} +3 -3
  99. package/dist/{chunk-rc4zsymn.js → chunk-kr8qdg0r.js} +2 -2
  100. package/dist/chunk-m1rdq29w.js +2 -0
  101. package/dist/chunk-m3qmj9ec.js +2 -0
  102. package/dist/{chunk-2bm97z09.js → chunk-m4mpyq3d.js} +3 -3
  103. package/dist/{chunk-gzcg563a.js → chunk-m6nkaxcc.js} +3 -3
  104. package/dist/chunk-m90wyzhd.js +2 -0
  105. package/dist/chunk-mcevnfnx.js +2 -0
  106. package/dist/{chunk-am4wadh7.js → chunk-mv3yhspn.js} +2 -2
  107. package/dist/chunk-ndjmt3vg.js +3 -0
  108. package/dist/chunk-nmtwqvq2.js +3 -0
  109. package/dist/chunk-nthzdhsf.js +2 -0
  110. package/dist/chunk-nx20kccb.js +2 -0
  111. package/dist/chunk-p43hw6ef.js +2 -0
  112. package/dist/{chunk-pkyb284z.js → chunk-p45mzeek.js} +2 -2
  113. package/dist/{chunk-mdw5sbbt.js → chunk-p7p3b4s1.js} +2 -2
  114. package/dist/{chunk-3y26rjq6.js → chunk-pebsj489.js} +10 -10
  115. package/dist/chunk-q71qqjy7.js +2 -0
  116. package/dist/{chunk-70nwqsf6.js → chunk-qa6r6mj6.js} +4 -4
  117. package/dist/{chunk-6b32wt31.js → chunk-qby3e5nm.js} +30 -30
  118. package/dist/chunk-qezg1070.js +2 -0
  119. package/dist/{chunk-ngzdcvry.js → chunk-qfcn4btf.js} +1 -1
  120. package/dist/{chunk-7g29avcd.js → chunk-qmj7g7s8.js} +6 -6
  121. package/dist/chunk-qtcxy3y3.js +2 -0
  122. package/dist/{chunk-618d3ng3.js → chunk-r1jzbqr3.js} +6 -6
  123. package/dist/chunk-r5qfxd9s.js +2 -0
  124. package/dist/{chunk-qk61pv1v.js → chunk-ra8f8sm2.js} +15 -10
  125. package/dist/chunk-rgsb3f0j.js +2 -0
  126. package/dist/{chunk-6nf4xhv0.js → chunk-rr58ynsn.js} +6 -6
  127. package/dist/chunk-s53psb1j.js +2 -0
  128. package/dist/{chunk-ddjkt87h.js → chunk-sxwgq49z.js} +1 -1
  129. package/dist/chunk-t482tgm6.js +2 -0
  130. package/dist/{chunk-91q55gjp.js → chunk-td3qp5my.js} +3 -3
  131. package/dist/chunk-tsvnhc0c.js +4 -0
  132. package/dist/{chunk-qr5ddqbf.js → chunk-tyjzye2d.js} +2 -2
  133. package/dist/{chunk-eb8dv03t.js → chunk-vadbp45n.js} +3 -3
  134. package/dist/{chunk-nj2q40p8.js → chunk-vct6dec8.js} +2 -2
  135. package/dist/{chunk-cqfyby1t.js → chunk-vgd3r8g7.js} +2 -2
  136. package/dist/{chunk-1925kbjc.js → chunk-w9d18r1t.js} +1 -1
  137. package/dist/{chunk-5t33zwwg.js → chunk-wj78td69.js} +1 -1
  138. package/dist/{chunk-q3c130w6.js → chunk-wm65y47g.js} +14 -14
  139. package/dist/chunk-wm8wz183.js +2 -0
  140. package/dist/chunk-wn7wmjcr.js +2 -0
  141. package/dist/chunk-x0e0pcn0.js +2 -0
  142. package/dist/chunk-x756yzrc.js +2 -0
  143. package/dist/{chunk-07thf07b.js → chunk-x8anspa5.js} +2 -2
  144. package/dist/{chunk-cak9fp9b.js → chunk-x8js27hd.js} +7 -7
  145. package/dist/chunk-xad5fg2a.js +2 -0
  146. package/dist/chunk-xj5v9rnx.js +2 -0
  147. package/dist/chunk-xq2tfg4v.js +2 -0
  148. package/dist/{chunk-vke28xq8.js → chunk-y38swh5t.js} +2 -2
  149. package/dist/{chunk-pgkcbm6g.js → chunk-y5f04xtb.js} +2 -2
  150. package/dist/{chunk-z1br7qeb.js → chunk-yewd8836.js} +4 -4
  151. package/dist/chunk-ypmx0jhd.js +2 -0
  152. package/dist/chunk-yrdxvphr.js +2 -0
  153. package/dist/chunk-yx563gzr.js +2 -0
  154. package/dist/{chunk-x0qtgyqr.js → chunk-yzs2afn7.js} +9 -9
  155. package/dist/{chunk-nwhv1889.js → chunk-z2m9p8xe.js} +3 -3
  156. package/dist/{chunk-qsc5nse5.js → chunk-zbgh573z.js} +2 -2
  157. package/dist/chunk-zccysq9p.js +3 -0
  158. package/dist/chunk-zh8w0nb6.js +2 -0
  159. package/dist/{chunk-79x0812m.js → chunk-zxfptbac.js} +2 -2
  160. package/dist/cli.js +20 -20
  161. package/dist/client/signals-dom-ready-runtime.js +6 -1
  162. package/dist/craft-entry.js +2 -2
  163. package/dist/craft.js +2 -2
  164. package/dist/dev-server/serve-app.js +2 -2
  165. package/dist/native/bridge/protocol.d.ts +1 -1
  166. package/dist/native/compiler/component-mapping.js +1 -0
  167. package/dist/native/compiler/headwind-to-style.d.ts +2 -10
  168. package/dist/native/compiler/headwind-to-style.js +31 -2
  169. package/dist/native/compiler/html-to-ir.js +15 -4
  170. package/dist/native/compiler/ir.d.ts +5 -0
  171. package/dist/native/event-names.js +14 -1
  172. package/dist/native/primitives/WebView.stx +7 -0
  173. package/dist/native/prop-names.js +8 -1
  174. package/dist/native/runtime/browser-renderer.js +1 -1
  175. package/dist/native/runtime/craft-bridge.js +31 -1
  176. package/dist/native/runtime/craft.d.ts +67 -1
  177. package/dist/native/runtime/native-host.d.ts +1 -0
  178. package/dist/native/runtime/native-host.js +8 -2
  179. package/dist/native/runtime/shared-screen.js +1 -0
  180. package/dist/native/testing.d.ts +1 -1
  181. package/dist/production-server.js +5 -5
  182. package/dist/pwa.js +3 -3
  183. package/dist/ssg.js +10 -10
  184. package/package.json +5 -5
  185. package/dist/chunk-0cvpkj9g.js +0 -2
  186. package/dist/chunk-0qgdex7z.js +0 -2
  187. package/dist/chunk-1hb8q271.js +0 -2
  188. package/dist/chunk-1se5y83a.js +0 -2
  189. package/dist/chunk-2p301rsb.js +0 -2
  190. package/dist/chunk-2zg3jmy7.js +0 -2
  191. package/dist/chunk-33gccrx0.js +0 -2
  192. package/dist/chunk-3754her2.js +0 -2
  193. package/dist/chunk-3jkbs3fc.js +0 -2
  194. package/dist/chunk-3vankrf5.js +0 -2
  195. package/dist/chunk-4jzyd8k0.js +0 -2
  196. package/dist/chunk-4tvty67c.js +0 -2
  197. package/dist/chunk-4xaz5jbs.js +0 -2
  198. package/dist/chunk-4xzk9529.js +0 -3
  199. package/dist/chunk-53md2scd.js +0 -2
  200. package/dist/chunk-56sek7x7.js +0 -2
  201. package/dist/chunk-5g5v7yns.js +0 -2
  202. package/dist/chunk-5gg5jc76.js +0 -2
  203. package/dist/chunk-68j6zb7n.js +0 -2
  204. package/dist/chunk-6wf0ter4.js +0 -2
  205. package/dist/chunk-75st1ttq.js +0 -2
  206. package/dist/chunk-7ctvfad1.js +0 -2
  207. package/dist/chunk-7y0v5dry.js +0 -3
  208. package/dist/chunk-83aq0n9s.js +0 -2
  209. package/dist/chunk-9vgkp3nj.js +0 -2
  210. package/dist/chunk-9vqj5jzp.js +0 -2
  211. package/dist/chunk-a50kn0hn.js +0 -2
  212. package/dist/chunk-bpbhjn4w.js +0 -2
  213. package/dist/chunk-bqyj88qr.js +0 -2
  214. package/dist/chunk-cgv3r6q9.js +0 -2
  215. package/dist/chunk-e645nk33.js +0 -4
  216. package/dist/chunk-e6zv6p3x.js +0 -2
  217. package/dist/chunk-e96jbmkj.js +0 -3
  218. package/dist/chunk-ej4wf9m5.js +0 -2
  219. package/dist/chunk-exfgfjf6.js +0 -2
  220. package/dist/chunk-fvg2p9z0.js +0 -2
  221. package/dist/chunk-fxvhkz72.js +0 -2
  222. package/dist/chunk-g6m3q9n4.js +0 -2
  223. package/dist/chunk-gn5v004x.js +0 -177
  224. package/dist/chunk-h2ymq7fa.js +0 -2
  225. package/dist/chunk-hnen9b45.js +0 -2
  226. package/dist/chunk-j1nyasyk.js +0 -2
  227. package/dist/chunk-j46nvncc.js +0 -2
  228. package/dist/chunk-jjvrm2j8.js +0 -2
  229. package/dist/chunk-kh0szwf3.js +0 -2
  230. package/dist/chunk-krw4m6j1.js +0 -2
  231. package/dist/chunk-mvfj17fr.js +0 -2
  232. package/dist/chunk-nmjgcw4g.js +0 -2
  233. package/dist/chunk-p454tj1h.js +0 -2
  234. package/dist/chunk-q245q8z1.js +0 -2
  235. package/dist/chunk-q4m5p4wx.js +0 -2
  236. package/dist/chunk-q85s8ne0.js +0 -2
  237. package/dist/chunk-qe3hrbge.js +0 -2
  238. package/dist/chunk-qq4ee7px.js +0 -2
  239. package/dist/chunk-rfp5f55f.js +0 -2
  240. package/dist/chunk-th7amyq4.js +0 -2
  241. package/dist/chunk-v95kersm.js +0 -2
  242. package/dist/chunk-w1sjp421.js +0 -2
  243. package/dist/chunk-w5d936jr.js +0 -2
  244. package/dist/chunk-wwnqbv9j.js +0 -3
  245. package/dist/chunk-x3xtyr95.js +0 -2
  246. package/dist/chunk-xb16yy2x.js +0 -2
  247. package/dist/chunk-yavspk55.js +0 -2
  248. package/dist/chunk-yrh9yfnv.js +0 -2
  249. package/dist/chunk-ysm6gaq9.js +0 -2
  250. package/dist/chunk-z515xymr.js +0 -2
  251. package/dist/chunk-z6xfmrtc.js +0 -2
  252. package/dist/chunk-za7v4w04.js +0 -2
  253. package/dist/chunk-zb8wv7sc.js +0 -2
@@ -1331,8 +1331,18 @@ function expandShortcuts(token, seen = new Set) {
1331
1331
  const prefix = parts.slice(0, -1).map((part) => `${part}:`).join(""), inner = new Set(seen).add(utility);
1332
1332
  return shortcut.split(/\s+/).filter(Boolean).flatMap((name) => expandShortcuts(`${prefix}${name}`, inner));
1333
1333
  }
1334
+ function transitionMilliseconds(utility) {
1335
+ if (/^transition(?:-(?:all|colors|opacity|shadow|transform))?$/.test(utility))
1336
+ return 150;
1337
+ if (utility === "transition-none")
1338
+ return 0;
1339
+ const duration = /^duration-(\d+)$/.exec(utility);
1340
+ return duration ? Number(duration[1]) : void 0;
1341
+ }
1334
1342
  export function compileClassStyles(classes, variables, options = {}) {
1335
- const groups = new Map, group = (key, init) => {
1343
+ const groups = new Map;
1344
+ let transition, duration;
1345
+ const group = (key, init) => {
1336
1346
  if (!groups.has(key))
1337
1347
  groups.set(key, { ...init, classes: [], authored: new Map });
1338
1348
  return groups.get(key);
@@ -1355,6 +1365,21 @@ export function compileClassStyles(classes, variables, options = {}) {
1355
1365
  const parts = splitVariants(token), utility = parts.pop(), focusing = parts.some((variant) => variant.startsWith("focus"));
1356
1366
  if (parts.some((variant) => /^(?:group-|peer-)?focus(?:-visible|-within)?$/.test(variant)) && /^(?:ring|outline)(?:-|$)/.test(utility))
1357
1367
  continue;
1368
+ if (options.pointer && parts.length === 0 && transitionMilliseconds(utility) !== void 0) {
1369
+ if (utility.startsWith("duration-"))
1370
+ duration = transitionMilliseconds(utility);
1371
+ else
1372
+ transition = transitionMilliseconds(utility);
1373
+ continue;
1374
+ }
1375
+ const pointerVariants = parts.filter((variant) => variant !== "dark"), pointerState = options.pointer && pointerVariants.length === 1 && parts.length - pointerVariants.length <= 1 && (pointerVariants[0] === "hover" || pointerVariants[0] === "active") ? pointerVariants[0] : void 0;
1376
+ if (pointerState && !WEB_ONLY_UTILITY.test(utility)) {
1377
+ const layer = group(`pointer:${pointerState}`, { pointerState }), kept = parts.includes("dark") ? `dark:${utility}` : utility;
1378
+ layer.classes.push(kept);
1379
+ if (!layer.authored.has(kept))
1380
+ layer.authored.set(kept, authored === token ? token : `${authored} (${token})`);
1381
+ continue;
1382
+ }
1358
1383
  if (WEB_ONLY_UTILITY.test(utility) || !focusing && parts.some((variant) => POINTER_ONLY_VARIANTS.has(variant)))
1359
1384
  continue;
1360
1385
  let min, max, disabled = !1, state;
@@ -1411,7 +1436,9 @@ export function compileClassStyles(classes, variables, options = {}) {
1411
1436
  const compiled = compileLayer(layer.classes.join(" "), variables, { appearance: options.appearance });
1412
1437
  result.unknown = [...new Set([...result.unknown, ...authoredNames(layer, compiled.unknown)])];
1413
1438
  const entry = { style: compiled.style, ...compiled.dark ? { dark: compiled.dark } : {} };
1414
- if (layer.disabled)
1439
+ if (layer.pointerState)
1440
+ (result.pointer ??= {})[layer.pointerState] = entry;
1441
+ else if (layer.disabled)
1415
1442
  result.disabled = entry;
1416
1443
  else if (layer.state)
1417
1444
  (result.states ??= {})[layer.state] = entry;
@@ -1429,6 +1456,8 @@ export function compileClassStyles(classes, variables, options = {}) {
1429
1456
  }
1430
1457
  if (responsive.length)
1431
1458
  result.responsive = responsive.sort((a, b) => a.min - b.min || (a.max ?? 1 / 0) - (b.max ?? 1 / 0));
1459
+ if (transition !== void 0 && transition > 0)
1460
+ result.style = { ...result.style, transitionDuration: duration ?? transition };
1432
1461
  return result;
1433
1462
  }
1434
1463
  function compileLayer(classes, variables, options = {}) {
@@ -34,6 +34,13 @@ export const NATIVE_EVENTS = new Set([
34
34
  "onPictureInPictureStart",
35
35
  "onPictureInPictureStop",
36
36
  "onPlay",
37
+ "onDragEnd",
38
+ "onDragLeave",
39
+ "onDragOver",
40
+ "onDragStart",
41
+ "onDrop",
42
+ "onHoverChange",
43
+ "onKeyPress",
37
44
  "onPress",
38
45
  "onPressIn",
39
46
  "onPressOut",
@@ -67,6 +74,7 @@ const NATIVE_TYPES = new Set([
67
74
  "Image",
68
75
  "ImageBackground",
69
76
  "Video",
77
+ "WebView",
70
78
  "Map",
71
79
  "MapPolyline",
72
80
  "MapPolygon",
@@ -155,8 +163,8 @@ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
155
163
  if (name === "x-cloak")
156
164
  continue;
157
165
  if (name.startsWith("@") || name.startsWith("v-on:")) {
158
- const spelling = name.startsWith("@") ? name.slice(1) : name.slice(5), [base] = spelling.split("."), native = EVENT_NAMES[base] ?? (base.startsWith("on") ? base : "");
159
- if (!native || !NATIVE_EVENTS.has(native)) {
166
+ const spelling = name.startsWith("@") ? name.slice(1) : name.slice(5), [base] = spelling.split("."), native = EVENT_NAMES[base] ?? (base.startsWith("on") ? base : ""), filteredKey = native === "onKeyPress" && spelling !== base;
167
+ if (!native || !NATIVE_EVENTS.has(native) || filteredKey) {
160
168
  if (BROWSER_ONLY_EVENTS.test(base) || /\./.test(spelling))
161
169
  diagnostics.push({ kind: "unread-event", tag, name: rawName });
162
170
  continue;
@@ -511,15 +519,18 @@ export async function translateHtmlToIR(html, options = {}) {
511
519
  boundScrollingViewports(root);
512
520
  return { root, diagnostics };
513
521
  }
514
- function boundScrollingViewports(node) {
522
+ function boundScrollingViewports(node, inRow = !1) {
515
523
  if (["ScrollView", "FlatList", "SectionList"].includes(node.type))
516
524
  return !node.props.horizontal && (Number(node.style.flex) > 0 || Number(node.style.flexGrow) > 0);
517
- if (!node.children.map((child) => typeof child === "string" ? !1 : boundScrollingViewports(child)).some(Boolean) || !["View", "SafeAreaView", "KeyboardAvoidingView"].includes(node.type))
525
+ const row = node.style.flexDirection === "row" || node.style.display === "flex" && node.style.flexDirection == null;
526
+ if (!node.children.map((child) => typeof child === "string" ? !1 : boundScrollingViewports(child, row)).some(Boolean) || !["View", "SafeAreaView", "KeyboardAvoidingView"].includes(node.type))
518
527
  return !1;
519
528
  if (node.style.height !== void 0 || node.style.maxHeight !== void 0)
520
529
  return !1;
521
530
  if (node.style.flex === 0 || node.style.flexGrow === 0 || node.style.flexShrink === 0)
522
531
  return !1;
532
+ if (inRow)
533
+ return !0;
523
534
  if (node.style.flex === void 0 && node.style.flexGrow === void 0) {
524
535
  node._layoutDefaults = { flex: 1, flexGrow: 1, flexShrink: 1, flexBasis: 0 };
525
536
  node.style = { ...node._layoutDefaults, ...node.style };
@@ -113,6 +113,9 @@ export declare interface STXStyle {
113
113
  backgroundColor?: string
114
114
  backgroundImage?: string
115
115
  gradientDirection?: string
116
+ transitionDuration?: number
117
+ hoverStyle?: STXStyle
118
+ pressStyle?: STXStyle
116
119
  gradientFrom?: string
117
120
  gradientVia?: string
118
121
  gradientTo?: string
@@ -235,6 +238,8 @@ export type STXComponentType = | 'Sidebar'
235
238
  | 'Image'
236
239
  | 'ImageBackground'
237
240
  | 'Video'
241
+ /** A web page: a tab the host owns (`craft.web`), shown where the screen puts it. */
242
+ | 'WebView'
238
243
  | 'Map'
239
244
  | 'MapPolyline'
240
245
  | 'MapPolygon'
@@ -64,5 +64,18 @@ export const NATIVE_EVENT_NAMES = {
64
64
  progress: "onProgress",
65
65
  loadedmetadata: "onLoad",
66
66
  enterpictureinpicture: "onPictureInPictureStart",
67
- leavepictureinpicture: "onPictureInPictureStop"
67
+ leavepictureinpicture: "onPictureInPictureStop",
68
+ dragstart: "onDragStart",
69
+ "drag-start": "onDragStart",
70
+ dragover: "onDragOver",
71
+ "drag-over": "onDragOver",
72
+ dragleave: "onDragLeave",
73
+ "drag-leave": "onDragLeave",
74
+ drop: "onDrop",
75
+ dragend: "onDragEnd",
76
+ "drag-end": "onDragEnd",
77
+ "hover-change": "onHoverChange",
78
+ hoverchange: "onHoverChange",
79
+ keydown: "onKeyPress",
80
+ keypress: "onKeyPress"
68
81
  };
@@ -0,0 +1,7 @@
1
+ {{-- WebView: a web page beside native controls (WKWebView in Craft's AppKit host, built with
2
+ `webkit: true`). `tab` names a tab created through `craft.web`; the host owns the tab, so its
3
+ page survives re-renders and moves when another WebView names it. --}}
4
+ <script server>
5
+ const classes = $props.class ?? $props.className ?? ''
6
+ </script>
7
+ <iframe data-native="WebView" class="{{ classes }}"></iframe>
@@ -103,7 +103,12 @@ const NATIVE_PROP_NAMES = [
103
103
  "rowHeight",
104
104
  "labelFontSize",
105
105
  "pictureInPicture",
106
- "transitionID"
106
+ "transitionID",
107
+ "dragData",
108
+ "dragURL",
109
+ "dropTypes",
110
+ "dropInside",
111
+ "selectTextOnFocus"
107
112
  ];
108
113
  export const NATIVE_BOOLEAN_PROPS = new Set([
109
114
  "alwaysBounceHorizontal",
@@ -116,6 +121,8 @@ export const NATIVE_BOOLEAN_PROPS = new Set([
116
121
  "bounces",
117
122
  "controls",
118
123
  "disabled",
124
+ "draggable",
125
+ "dropInside",
119
126
  "editable",
120
127
  "hidesWhenStopped",
121
128
  "horizontal",
@@ -4,7 +4,7 @@ const SYMBOL_TO_ICON = {};
4
4
  for (const [name, symbol] of Object.entries(LUCIDE_TO_SF))
5
5
  if (!(symbol in SYMBOL_TO_ICON) || name === symbol)
6
6
  SYMBOL_TO_ICON[symbol] = name;
7
- const SVG_NS = "http://www.w3.org/2000/svg", SVG = { Svg: "svg", G: "g", Path: "path", Line: "line", Rect: "rect", Circle: "circle", Ellipse: "ellipse", Polyline: "polyline", Polygon: "polygon", SvgText: "text", Animate: "animate" }, TAGS = { View: "div", SafeAreaView: "div", ScrollView: "div", KeyboardAvoidingView: "div", Text: "span", TextInput: "input", Button: "button", Link: "a", TouchableOpacity: "button", TouchableHighlight: "button", Pressable: "button", Icon: "span", Image: "img", ImageBackground: "div", Video: "video", FlatList: "div", SectionList: "div", Switch: "input", Checkbox: "input", Slider: "input", Picker: "select", SegmentedControl: "div", DatePicker: "input", Modal: "dialog", ActivityIndicator: "progress", StatusBar: "div", RefreshControl: "progress", Sidebar: "aside", SplitView: "div" }, CONTAINERS = new Set(["View", "SafeAreaView", "ScrollView", "KeyboardAvoidingView", "FlatList", "SectionList", "Sidebar", "SplitView", "ImageBackground"]), UNITLESS = new Set(["opacity", "flex", "flexGrow", "flexShrink", "fontWeight", "zIndex", "aspectRatio", "order"]), SVG_PROPS = { viewBox: "viewBox", fillRule: "fill-rule", clipRule: "clip-rule", strokeWidth: "stroke-width", strokeLinecap: "stroke-linecap", strokeLinejoin: "stroke-linejoin", strokeDasharray: "stroke-dasharray", strokeDashoffset: "stroke-dashoffset", fillOpacity: "fill-opacity", strokeOpacity: "stroke-opacity", textAnchor: "text-anchor" };
7
+ const SVG_NS = "http://www.w3.org/2000/svg", SVG = { Svg: "svg", G: "g", Path: "path", Line: "line", Rect: "rect", Circle: "circle", Ellipse: "ellipse", Polyline: "polyline", Polygon: "polygon", SvgText: "text", Animate: "animate" }, TAGS = { View: "div", SafeAreaView: "div", ScrollView: "div", KeyboardAvoidingView: "div", Text: "span", TextInput: "input", Button: "button", Link: "a", TouchableOpacity: "button", TouchableHighlight: "button", Pressable: "button", Icon: "span", Image: "img", ImageBackground: "div", Video: "video", WebView: "iframe", FlatList: "div", SectionList: "div", Switch: "input", Checkbox: "input", Slider: "input", Picker: "select", SegmentedControl: "div", DatePicker: "input", Modal: "dialog", ActivityIndicator: "progress", StatusBar: "div", RefreshControl: "progress", Sidebar: "aside", SplitView: "div" }, CONTAINERS = new Set(["View", "SafeAreaView", "ScrollView", "KeyboardAvoidingView", "FlatList", "SectionList", "Sidebar", "SplitView", "ImageBackground"]), UNITLESS = new Set(["opacity", "flex", "flexGrow", "flexShrink", "fontWeight", "zIndex", "aspectRatio", "order"]), SVG_PROPS = { viewBox: "viewBox", fillRule: "fill-rule", clipRule: "clip-rule", strokeWidth: "stroke-width", strokeLinecap: "stroke-linecap", strokeLinejoin: "stroke-linejoin", strokeDasharray: "stroke-dasharray", strokeDashoffset: "stroke-dashoffset", fillOpacity: "fill-opacity", strokeOpacity: "stroke-opacity", textAnchor: "text-anchor" };
8
8
 
9
9
  export class BrowserScreenRenderer {
10
10
  container;
@@ -58,6 +58,7 @@ function capabilityFlags(capabilities) {
58
58
  health: capabilities.has("health"),
59
59
  dialogs: capabilities.has("dialog"),
60
60
  browser: capabilities.has("browser"),
61
+ web: capabilities.has("web"),
61
62
  appleSignIn: capabilities.has("appleSignIn"),
62
63
  background: capabilities.has("background"),
63
64
  crashReporter: capabilities.has("crashReporter"),
@@ -131,7 +132,13 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
131
132
  target.__stxNativeParams = params;
132
133
  paramsHandlers.forEach((handler) => handler(params, previous));
133
134
  });
134
- craft.appearance = { colorScheme: () => nativeBridge.colorScheme === "dark" ? "dark" : "light" };
135
+ craft.appearance = {
136
+ colorScheme: () => nativeBridge.colorScheme === "dark" ? "dark" : "light",
137
+ onChange: (callback) => protocol.on("APPEARANCE", ({ payload }) => {
138
+ if (payload?.colorScheme === "light" || payload?.colorScheme === "dark")
139
+ callback(payload.colorScheme);
140
+ })
141
+ };
135
142
  craft.device = { getInfo: () => request("Device", "getInfo", []) };
136
143
  craft.clipboard = {
137
144
  write: (value) => request("Clipboard", "write", [value]),
@@ -299,6 +306,29 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
299
306
  callback(payload.detail.id);
300
307
  })
301
308
  };
309
+ if (capabilities.has("web")) {
310
+ const call = (method, args) => request("Web", method, args), web = {
311
+ create: (options = {}) => call("create", [options]),
312
+ list: () => call("list", []),
313
+ on: (type, callback) => protocol.on("CRAFT_EVENT", ({ payload }) => {
314
+ if (payload?.event === "craftWebView" && payload.detail && (type === "*" || payload.detail.type === type))
315
+ callback(payload.detail);
316
+ })
317
+ };
318
+ for (const method of ["navigate", "back", "forward", "reload", "stop", "close", "state", "focus", "setZoom", "setInspectable", "evaluate", "find", "snapshot"])
319
+ web[method] = (id, ...args) => call(method, [String(id), ...args]);
320
+ web.tab = (id) => {
321
+ const tab = { id: String(id) };
322
+ for (const method of ["navigate", "back", "forward", "reload", "stop", "close", "state", "focus", "setZoom", "setInspectable", "evaluate", "find", "snapshot"])
323
+ tab[method] = (...args) => web[method](id, ...args);
324
+ tab.on = (type, callback) => web.on(type, (event) => {
325
+ if (event.tab === tab.id)
326
+ callback(event);
327
+ });
328
+ return tab;
329
+ };
330
+ craft.web = web;
331
+ }
302
332
  if (capabilities.has("background"))
303
333
  craft.background = { complete: (ok = !0, id) => request("Background", "complete", [ok !== !1, typeof id === "string" ? id : null]).then(() => !0, () => !1) };
304
334
  if (capabilities.has("appleSignIn"))
@@ -151,6 +151,7 @@ export declare interface NativeFile {
151
151
  export declare interface NativeCraft {
152
152
  liveActivity?: NativeLiveActivities
153
153
  desktop?: NativeDesktop
154
+ web?: NativeWeb
154
155
  platform: string
155
156
  capabilityProtocolVersion: number
156
157
  route: NativeRoute
@@ -160,7 +161,7 @@ export declare interface NativeCraft {
160
161
  storage: NativeStorage
161
162
  secureStorage: NativeSecureStorage
162
163
  snapshots: NativeSnapshots
163
- appearance: { colorScheme: () => 'light' | 'dark' }
164
+ appearance: { colorScheme: () => 'light' | 'dark', onChange: (callback: (scheme: 'light' | 'dark') => void) => () => void }
164
165
  haptics: {
165
166
  impact: (style?: 'light' | 'medium' | 'heavy' | 'soft' | 'rigid' | (string & {})) => Promise<void>
166
167
  notification: (type?: 'success' | 'warning' | 'error') => Promise<void>
@@ -319,4 +320,69 @@ export declare interface NativeDesktop {
319
320
  setBadge: (count: number) => Promise<boolean>
320
321
  onCommand: (callback: (id: string) => void) => () => void
321
322
  }
323
+ /** What a tab reports: in `create`, `state` and `list` answers and in every `state` event. */
324
+ export declare interface NativeWebTabState {
325
+ tab: string
326
+ profile: string
327
+ private: boolean
328
+ title: string
329
+ url: string
330
+ progress: number
331
+ loading: boolean
332
+ canGoBack: boolean
333
+ canGoForward: boolean
334
+ secure: boolean
335
+ zoom: number
336
+ themeColor?: string
337
+ camera: boolean
338
+ microphone: boolean
339
+ }
340
+ export declare interface NativeWebTab {
341
+ readonly id: string
342
+ navigate: (url: string) => Promise<boolean>
343
+ back: () => Promise<boolean>
344
+ forward: () => Promise<boolean>
345
+ reload: (options?: { ignoreCache?: boolean }) => Promise<boolean>
346
+ stop: () => Promise<boolean>
347
+ close: () => Promise<boolean>
348
+ state: () => Promise<NativeWebTabState>
349
+ focus: () => Promise<boolean>
350
+ setZoom: (zoom: number) => Promise<number>
351
+ setInspectable: (inspectable: boolean) => Promise<boolean>
352
+ evaluate: <T = unknown>(script: string, options?: { isolated?: boolean }) => Promise<T>
353
+ find: (text: string, options?: { backwards?: boolean, caseSensitive?: boolean, wraps?: boolean }) => Promise<{ found: boolean }>
354
+ snapshot: (options?: { width?: number }) => Promise<string>
355
+ on: <K extends NativeWebEvent['type']>(type: K | '*', callback: (event: Extract<NativeWebEvent, { type: K }>) => void) => () => void
356
+ }
357
+ /**
358
+ * Tabs the host owns, shown by `<WebView tab="id">`. A tab outlives the view
359
+ * showing it, so a page survives re-renders and moves between panes.
360
+ */
361
+ export declare interface NativeWeb {
362
+ create: (options?: { id?: string, url?: string, profile?: string, private?: boolean, inspectable?: boolean }) => Promise<NativeWebTabState>
363
+ list: () => Promise<NativeWebTabState[]>
364
+ tab: (id: string) => NativeWebTab
365
+ on: <K extends NativeWebEvent['type']>(type: K | '*', callback: (event: Extract<NativeWebEvent, { type: K }>) => void) => () => void
366
+ navigate: (id: string, url: string) => Promise<boolean>
367
+ back: (id: string) => Promise<boolean>
368
+ forward: (id: string) => Promise<boolean>
369
+ reload: (id: string, options?: { ignoreCache?: boolean }) => Promise<boolean>
370
+ stop: (id: string) => Promise<boolean>
371
+ close: (id: string) => Promise<boolean>
372
+ state: (id: string) => Promise<NativeWebTabState>
373
+ focus: (id: string) => Promise<boolean>
374
+ setZoom: (id: string, zoom: number) => Promise<number>
375
+ setInspectable: (id: string, inspectable: boolean) => Promise<boolean>
376
+ evaluate: <T = unknown>(id: string, script: string, options?: { isolated?: boolean }) => Promise<T>
377
+ find: (id: string, text: string, options?: { backwards?: boolean, caseSensitive?: boolean, wraps?: boolean }) => Promise<{ found: boolean }>
378
+ snapshot: (id: string, options?: { width?: number }) => Promise<string>
379
+ }
322
380
  export type NativePermissionStatus = 'granted' | 'denied' | 'undetermined';
381
+ export type NativeWebEvent = | ({ type: 'state' } & NativeWebTabState)
382
+ | { type: 'navigationStart' | 'navigationFinish', tab: string, url: string }
383
+ | { type: 'navigationError', tab: string, url: string, code: number, domain: string, message: string }
384
+ | { type: 'favicon', tab: string, url: string }
385
+ /** `target=_blank` and `window.open` bring a ready `child` tab; a modifier click brings only the `url`. */
386
+ | { type: 'open', tab: string, url: string, child?: string, popup?: boolean, width?: number, height?: number, background?: boolean, reason: 'script' | 'modifier' }
387
+ | { type: 'close' | 'crashed', tab: string, url?: string }
388
+ | { type: 'download', tab: string, id: string, state: 'started' | 'progress' | 'finished' | 'failed', path: string, name: string, url: string, received: number, total: number, fraction: number, message?: string }
@@ -20,6 +20,7 @@ export declare interface NativeHostOptions {
20
20
  viewportWidth?: number
21
21
  stylesheetTheme?: NativeStylesheetTheme
22
22
  stylesheetRules?: NativeStylesheetRules
23
+ pointer?: boolean
23
24
  send: (operations: NativeMutationOperation[]) => void
24
25
  schedule?: (flush: () => void) => void
25
26
  followLink?: (href: string) => void
@@ -367,7 +367,7 @@ export function createNativeHost(options) {
367
367
  inherited = parseNativeStyleLayers([source], inherited, report).variables;
368
368
  const resolved = parseNativeStyleLayers([record.styleSource, record.boundStyle, record.forwardedStyle], inherited, report);
369
369
  record.variables = resolved.variables;
370
- const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme }), classStyle = { ...classes.style }, responsive = (classes.responsive ?? []).filter((layer) => viewportWidth >= layer.min && (layer.max === void 0 || viewportWidth <= layer.max));
370
+ const classes = compileClassStyles(`${record.classes} ${record.forwardedClasses ?? ""}`, record.variables, { focus: record.type === "TextInput", focusWithin: !0, rules: options.stylesheetRules, appearance: colorScheme, pointer: options.pointer === !0 }), classStyle = { ...classes.style }, responsive = (classes.responsive ?? []).filter((layer) => viewportWidth >= layer.min && (layer.max === void 0 || viewportWidth <= layer.max));
371
371
  for (const layer of responsive)
372
372
  Object.assign(classStyle, layer.style);
373
373
  if (colorScheme === "dark") {
@@ -390,7 +390,13 @@ export function createNativeHost(options) {
390
390
  }
391
391
  Object.assign(classStyle, focused);
392
392
  }
393
- return { ...applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), ...record.visible && !isHiddenInput(record) ? {} : { display: "none" } };
393
+ const style = applyNativeLayoutDefaults({ ...record.layoutDefaults, ...classStyle, ...record.dividerStyle, ...resolved.styles[0], ...record.baseStyle, ...resolved.styles[1], ...resolved.styles[2] }), pointer = {};
394
+ for (const [state, key] of [["hover", "hoverStyle"], ["active", "pressStyle"]]) {
395
+ const layer = classes.pointer?.[state];
396
+ if (layer)
397
+ pointer[key] = { ...layer.style, ...colorScheme === "dark" ? layer.dark : {} };
398
+ }
399
+ return { ...style, ...pointer, ...record.visible && !isHiddenInput(record) ? {} : { display: "none" } };
394
400
  }
395
401
  function refreshFocusChain(node) {
396
402
  for (let current = node;current; current = current.__stxOwner) {
@@ -25,6 +25,7 @@ export function prepareSharedNativeScreen(document, manifest, bridge, options =
25
25
  viewportWidth: Number(bridge.viewportWidth) || 0,
26
26
  stylesheetTheme: document.root._stylesheetTheme,
27
27
  stylesheetRules: document.root._stylesheetRules,
28
+ pointer: bridge.platform === "macos",
28
29
  ...followLink ? { followLink, linkState: (href, match) => nativeLinkState(href, String(globalThis.location?.href ?? ""), match) } : {},
29
30
  send(operations) {
30
31
  const baseRevision = revision;
@@ -50,7 +50,7 @@ export declare interface NativeScreenOptions {
50
50
  shareStorage?: Record<string, string>
51
51
  capabilities?: string[]
52
52
  capabilityTimeoutMs?: number
53
- platform?: 'ios' | 'android' | 'web'
53
+ platform?: 'ios' | 'android' | 'web' | 'macos'
54
54
  native?: (module: string, method: string, args: unknown[]) => unknown
55
55
  audioRecording?: { start: (owner: string, options?: { maxSeconds?: number }) => Promise<boolean>, stop: (owner: string) => Promise<{ path: string, name: string, type: string, size: number, durationSeconds: number }>, cancel: (owner: string) => Promise<boolean> }
56
56
  files?: { pickImage: { path: string, name: string, type: string, size: number } | null }
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import { serve } from "bun";
4
4
  import { loadManifest } from "./manifest.js";
5
5
  import { hydrateTemplateStream } from "./template-hydrator.js";
6
- import { extractContainerContent, extractLayoutMetadata } from "./app-shell.js";
6
+ import { extractContainerContent, extractLayoutMetadata, hasContainerRegion } from "./app-shell.js";
7
7
  import { pageShipsSignalsRuntime } from "./runtime-injection.js";
8
8
  import { isFileRequestPath, patternToRegex } from "stx-router";
9
9
  import { compressResponse } from "./compression.js";
@@ -59,7 +59,7 @@ export async function startProductionServer(options = {}) {
59
59
  layoutMetadataCache.set(route.pattern, extractLayoutMetadata(compiled.html));
60
60
  runtimeCache.set(route.pattern, pageShipsSignalsRuntime(compiled.html));
61
61
  const fragmentPath = path.join(outputDir, route.fragmentPath);
62
- if (await Bun.file(fragmentPath).exists()) {
62
+ if (hasContainerRegion(compiled.html, manifest.routerContainer || "main") && await Bun.file(fragmentPath).exists()) {
63
63
  const fragment = await Bun.file(fragmentPath).text();
64
64
  fragmentCache.set(route.pattern, runtimeConfig ? injectRuntimeConfig(fragment, runtimeConfig) : fragment);
65
65
  }
@@ -204,14 +204,14 @@ export async function startProductionServer(options = {}) {
204
204
  const { renderStreamingPage, streamToResponse } = await import("./streaming.js"), headers = new Headers({ ...spaNavVaryHeaders(), ...pageHeaders, "Cache-Control": "private, no-store" });
205
205
  for (const cookie of cookies ?? [])
206
206
  headers.append("Set-Cookie", cookie);
207
- if (isSpaNav && !isMutating) {
207
+ if (isSpaNav && !isMutating && hasContainerRegion(html, manifest.routerContainer || "main")) {
208
208
  const layout = extractLayoutMetadata(html);
209
209
  headers.set("X-STX-Fragment", "true");
210
210
  headers.set("X-STX-Runtime", pageShipsSignalsRuntime(html) ? "true" : "false");
211
211
  headers.set("X-STX-Layout", layout.layout);
212
212
  headers.set("X-STX-Layout-Group", layout.group);
213
213
  }
214
- return streamToResponse(renderStreamingPage(isSpaNav && !isMutating ? extractContainerContent(html, manifest.routerContainer || "main", !0) : html, boundaries, { timeoutMs: 30000 }), {
214
+ return streamToResponse(renderStreamingPage(isSpaNav && !isMutating && hasContainerRegion(html, manifest.routerContainer || "main") ? extractContainerContent(html, manifest.routerContainer || "main", !0) : html, boundaries, { timeoutMs: 30000 }), {
215
215
  status: status ?? compiled.status ?? 200,
216
216
  headers
217
217
  });
@@ -226,7 +226,7 @@ export async function startProductionServer(options = {}) {
226
226
  for (const [name, value] of Object.entries(pageHeaders ?? {}))
227
227
  headers.set(name, value);
228
228
  headers.set("Vary", spaNavVaryHeaders(headers.get("Vary")).Vary);
229
- if (isSpaNav && !isMutating) {
229
+ if (isSpaNav && !isMutating && hasContainerRegion(html, manifest.routerContainer || "main")) {
230
230
  const layout = extractLayoutMetadata(html);
231
231
  headers.set("X-STX-Fragment", "true");
232
232
  headers.set("X-STX-Runtime", pageShipsSignalsRuntime(html) ? "true" : "false");
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Ys,zt,bl,xg}from"./chunk-x148cxrj.js";import{Js,Ri,bg,wg,vg}from"./chunk-xr28hjkp.js";import{ml,hl,yl,hg,yg}from"./chunk-vke28xq8.js";import{Ue,En,Ai}from"./chunk-nnzmbfjq.js";import{Sg,kg,_g,Cg,Zs,ay}from"./chunk-qtja7fpr.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-krw4m6j1.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
2
+ import{Zs,Ht,wl,Sg}from"./chunk-4wc5pc19.js";import{Ys,Ai,wg,vg,xg}from"./chunk-e1gxykm8.js";import{hl,yl,bl,yg,bg}from"./chunk-y38swh5t.js";import{Ue,Tn,Pi}from"./chunk-k4bdf0dw.js";import{kg,_g,Cg,Eg,Qs,cy}from"./chunk-et1vz3wd.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-8dby49s0.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Ys(n,t);if(a){let s=zt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Ri(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,hl as auditBuildOutput,ml as auditConfig,re as buildPwaAssets,yl as calculateAuditResult,yg as formatAuditResult,Ai as formatSize,j as generateManifest,_ as generateManifestJson,wg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,En as generatePrecacheManifestJs,M as generatePwaIcons,Js as generatePwaTags,Ys as generateServiceWorker,xg as generateServiceWorkerAuto,bg as generateSwRegistrationScript,vg as generateThemeColorMeta,N as getExpectedIconPaths,zt as getServiceWorkerFileName,Ri as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,bl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Zs as pwaDirectives,Sg as pwaInstallDirective,_g as pwaOfflineDirective,Cg as pwaPushDirective,kg as pwaUpdateDirective,ay as registerPwaDirectives,hg as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Ue(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Zs(n,t);if(a){let s=Ht(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Ai(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,yl as auditBuildOutput,hl as auditConfig,re as buildPwaAssets,bl as calculateAuditResult,bg as formatAuditResult,Pi as formatSize,j as generateManifest,_ as generateManifestJson,vg as generateManifestLink,F as generateOfflinePage,Ue as generatePrecacheManifest,Tn as generatePrecacheManifestJs,M as generatePwaIcons,Ys as generatePwaTags,Zs as generateServiceWorker,Sg as generateServiceWorkerAuto,wg as generateSwRegistrationScript,xg as generateThemeColorMeta,N as getExpectedIconPaths,Ht as getServiceWorkerFileName,Ai as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,wl as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Qs as pwaDirectives,kg as pwaInstallDirective,Cg as pwaOfflineDirective,Eg as pwaPushDirective,_g as pwaUpdateDirective,cy as registerPwaDirectives,yg as runPwaAudit,D as validateManifest};