@stacksjs/stx 0.2.657 → 0.2.662

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 (111) hide show
  1. package/dist/{chunk-mgkrnwjk.js → chunk-1hny5z72.js} +1 -1
  2. package/dist/{chunk-q68rssa6.js → chunk-3ay916gv.js} +1 -1
  3. package/dist/chunk-4f4agvd0.js +129 -0
  4. package/dist/{chunk-xmb4ttnf.js → chunk-4jyehvz3.js} +2 -2
  5. package/dist/{chunk-tnqbck1r.js → chunk-4xdpeky6.js} +1 -1
  6. package/dist/chunk-4xfpq9yp.js +2 -0
  7. package/dist/{chunk-s3t9tmsz.js → chunk-51n5rfsk.js} +1 -1
  8. package/dist/{chunk-kt3nk905.js → chunk-5m8j11b0.js} +1 -1
  9. package/dist/{chunk-g3tk83ea.js → chunk-61pvye5k.js} +1 -1
  10. package/dist/{chunk-m0gd0264.js → chunk-6dz6tpkp.js} +1 -1
  11. package/dist/chunk-6fbxh1we.js +2 -0
  12. package/dist/chunk-721ba72m.js +2 -0
  13. package/dist/{chunk-zvj935ma.js → chunk-7m5sqtq5.js} +1 -1
  14. package/dist/{chunk-nm1ggj8d.js → chunk-8n78w5kh.js} +1 -1
  15. package/dist/{chunk-vpmfm04j.js → chunk-9jcxrc6t.js} +1 -1
  16. package/dist/{chunk-zd23z1j8.js → chunk-a3mmhzpa.js} +1 -1
  17. package/dist/{chunk-a8aqch0j.js → chunk-adxt8qcy.js} +38 -38
  18. package/dist/{chunk-f9xed7c1.js → chunk-adzrhca1.js} +1 -1
  19. package/dist/chunk-ap1sydzw.js +2 -0
  20. package/dist/{chunk-47qc69v1.js → chunk-creeaceg.js} +1 -1
  21. package/dist/{chunk-ddtmrma9.js → chunk-d419kwfp.js} +1 -1
  22. package/dist/{chunk-7nx74hdr.js → chunk-d8kfbhhw.js} +1 -1
  23. package/dist/{chunk-6w8sjav5.js → chunk-dw5bsya8.js} +1 -1
  24. package/dist/{chunk-fzxx3rad.js → chunk-e3crw545.js} +3 -3
  25. package/dist/{chunk-vmwdt8fr.js → chunk-een2wqah.js} +6 -6
  26. package/dist/chunk-eqrkhc18.js +12 -0
  27. package/dist/chunk-fdfnk654.js +2 -0
  28. package/dist/{chunk-7gpxz94n.js → chunk-fr4hs814.js} +1 -1
  29. package/dist/{chunk-h8h2n247.js → chunk-ftskxb7f.js} +5 -5
  30. package/dist/{chunk-x29qw59w.js → chunk-h2a40417.js} +1 -1
  31. package/dist/{chunk-gjwyy7kh.js → chunk-h6633jna.js} +86 -86
  32. package/dist/{chunk-gg3wbfxa.js → chunk-j0dsavn2.js} +1 -1
  33. package/dist/{chunk-3zbrmm40.js → chunk-k6fyn9gk.js} +1 -1
  34. package/dist/{chunk-j8g1v38x.js → chunk-ky5kmg7t.js} +1 -1
  35. package/dist/{chunk-ndn0rmhs.js → chunk-m2h91ccn.js} +1 -1
  36. package/dist/{chunk-2mppsbt3.js → chunk-m7wb991z.js} +1 -1
  37. package/dist/{chunk-pcscq080.js → chunk-m89yndgc.js} +1 -1
  38. package/dist/{chunk-py28zkeh.js → chunk-mayr8s0x.js} +11 -11
  39. package/dist/{chunk-pbxq1rwd.js → chunk-msvpb1ax.js} +4 -4
  40. package/dist/chunk-mxdm8sw0.js +2 -0
  41. package/dist/{chunk-w6kdpx52.js → chunk-n48cshgz.js} +5 -5
  42. package/dist/{chunk-zn7ncwb8.js → chunk-pm76dy07.js} +1 -1
  43. package/dist/{chunk-nr9z0zeq.js → chunk-ptx6n9hd.js} +1 -1
  44. package/dist/{chunk-3ey8888k.js → chunk-pwjre3b2.js} +1 -1
  45. package/dist/{chunk-0h3gpwyv.js → chunk-q341v4gv.js} +56 -56
  46. package/dist/{chunk-aqk9e27b.js → chunk-q5h1reph.js} +1 -1
  47. package/dist/{chunk-jp4ef6dc.js → chunk-qvdx99py.js} +1 -1
  48. package/dist/chunk-r1hg1yc4.js +2 -0
  49. package/dist/{chunk-51kzs978.js → chunk-r6kbpwzd.js} +2 -2
  50. package/dist/{chunk-3r5rk2rz.js → chunk-rxqv3p90.js} +2 -2
  51. package/dist/{chunk-h39efd30.js → chunk-sknazxqf.js} +1 -1
  52. package/dist/{chunk-64ny75zz.js → chunk-smyeg8cr.js} +1 -1
  53. package/dist/chunk-tr4hseng.js +2 -0
  54. package/dist/chunk-tywr9wc5.js +2 -0
  55. package/dist/{chunk-shbabvaz.js → chunk-v0byvxty.js} +1 -1
  56. package/dist/{chunk-3areak0p.js → chunk-vc2xzscw.js} +2 -2
  57. package/dist/{chunk-28jtt8hn.js → chunk-vp9hse5k.js} +48 -48
  58. package/dist/chunk-vpa06pyx.js +2 -0
  59. package/dist/{chunk-v5981jwt.js → chunk-vsxws200.js} +1 -1
  60. package/dist/{chunk-sng45f0b.js → chunk-vzk09hvw.js} +8 -8
  61. package/dist/{chunk-y463z9qf.js → chunk-xz261gkh.js} +39 -39
  62. package/dist/{chunk-mj3fghaq.js → chunk-z248e3gj.js} +1 -1
  63. package/dist/{chunk-gb6229zj.js → chunk-zxbw2gr0.js} +2 -2
  64. package/dist/{chunk-n9dbjget.js → chunk-zzk3a426.js} +1 -1
  65. package/dist/cli.js +8 -8
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/expressions.js +9 -0
  69. package/dist/native/bridge/protocol.d.ts +1 -0
  70. package/dist/native/compiler/bundle.d.ts +1 -0
  71. package/dist/native/compiler/bundle.js +3 -2
  72. package/dist/native/compiler/headwind-to-style.d.ts +4 -0
  73. package/dist/native/compiler/headwind-to-style.js +33 -3
  74. package/dist/native/compiler/html-to-ir.d.ts +12 -0
  75. package/dist/native/compiler/html-to-ir.js +56 -5
  76. package/dist/native/compiler/inline-style.js +13 -0
  77. package/dist/native/compiler/ir.d.ts +2 -0
  78. package/dist/native/compiler/render-screen.js +32 -6
  79. package/dist/native/runtime/binding-tree.js +2 -1
  80. package/dist/native/runtime/craft-bridge.d.ts +2 -0
  81. package/dist/native/runtime/craft-bridge.js +13 -3
  82. package/dist/native/runtime/native-host.d.ts +1 -0
  83. package/dist/native/runtime/native-host.js +82 -12
  84. package/dist/native/runtime/shared-screen.js +4 -3
  85. package/dist/native/runtime/web-navigation.d.ts +18 -0
  86. package/dist/native/runtime/web-navigation.js +59 -0
  87. package/dist/native/runtime/web-storage.d.ts +40 -1
  88. package/dist/native/runtime/web-storage.js +123 -26
  89. package/dist/native/testing.d.ts +1 -0
  90. package/dist/native/testing.js +1 -0
  91. package/dist/native/text-entry.d.ts +51 -0
  92. package/dist/native/text-entry.js +101 -0
  93. package/dist/native-build.js +3 -1
  94. package/dist/pwa.js +1 -1
  95. package/dist/ssg.js +25 -25
  96. package/dist/stx-virtual-ts.d.ts +1 -1
  97. package/dist/stx-virtual-ts.js +3 -1
  98. package/dist/utils.js +3 -1
  99. package/package.json +5 -5
  100. package/dist/chunk-0rs1j4bn.js +0 -2
  101. package/dist/chunk-1qmc6gg1.js +0 -2
  102. package/dist/chunk-2e9d0np1.js +0 -2
  103. package/dist/chunk-62x62wzy.js +0 -2
  104. package/dist/chunk-7js495j0.js +0 -2
  105. package/dist/chunk-cbsa2np9.js +0 -2
  106. package/dist/chunk-egg54kd0.js +0 -12
  107. package/dist/chunk-ez0s2kvp.js +0 -2
  108. package/dist/chunk-g884rvhy.js +0 -2
  109. package/dist/chunk-h42anr8g.js +0 -2
  110. package/dist/chunk-hz0g9xrq.js +0 -2
  111. package/dist/chunk-rhzkw6y4.js +0 -128
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import{$e,te}from"./chunk-gjwyy7kh.js";import"./chunk-2h8ea0we.js";import"./chunk-mj3fghaq.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-a8aqch0j.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-h8h2n247.js";import"./chunk-aqk9e27b.js";import"./chunk-3areak0p.js";import"./chunk-sng45f0b.js";import"./chunk-pbxq1rwd.js";import"./chunk-nr9z0zeq.js";import"./chunk-rjh2jwxx.js";import"./chunk-c1dkh0es.js";import"./chunk-0jhdrgpr.js";import"./chunk-tre98h62.js";import"./chunk-2jh21f1n.js";import"./chunk-yq021b3r.js";import"./chunk-gb6229zj.js";import"./chunk-kgfgb971.js";import"./chunk-s3t9tmsz.js";import"./chunk-pxqh758g.js";import"./chunk-jxda11cg.js";import"./chunk-dgb4z4kw.js";import"./chunk-h39efd30.js";import"./chunk-zqtbtqbq.js";import"./chunk-3ey8888k.js";import"./chunk-51kzs978.js";import"./chunk-prf164ct.js";import"./chunk-shbabvaz.js";import"./chunk-nrvwejdw.js";import"./chunk-ddtmrma9.js";import"./chunk-47qc69v1.js";import"./chunk-6w8sjav5.js";import"./chunk-aprhqxky.js";import"./chunk-r3e6x87d.js";import"./chunk-mmwedr93.js";import"./chunk-v2x9vzgw.js";import{Gt,Kt}from"./chunk-7gpxz94n.js";import"./chunk-fzxx3rad.js";import"./chunk-py28zkeh.js";import"./chunk-ym41ybz2.js";import"./chunk-n38yb274.js";import"./chunk-9p6efb17.js";import"./chunk-t2pzy3x1.js";import"./chunk-rcadtv3x.js";import"./chunk-jp4ef6dc.js";import"./chunk-f9xed7c1.js";import{di,pi,fi,gi,As,mi,hi,yi,Ps,Is,Sr,kr,_r}from"./chunk-0h3gpwyv.js";import"./chunk-xmb4ttnf.js";import"./chunk-6ajahb2x.js";import"./chunk-r7kmsq3n.js";import"./chunk-w6kdpx52.js";import"./chunk-8nryyqb5.js";import{ma}from"./chunk-zd23z1j8.js";import{p}from"./chunk-2a4szpje.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
3
+ import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import{$e,te}from"./chunk-h6633jna.js";import"./chunk-2h8ea0we.js";import"./chunk-z248e3gj.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-adxt8qcy.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-ftskxb7f.js";import"./chunk-q5h1reph.js";import"./chunk-vc2xzscw.js";import"./chunk-vzk09hvw.js";import"./chunk-msvpb1ax.js";import"./chunk-ptx6n9hd.js";import"./chunk-rjh2jwxx.js";import"./chunk-c1dkh0es.js";import"./chunk-0jhdrgpr.js";import"./chunk-tre98h62.js";import"./chunk-2jh21f1n.js";import"./chunk-yq021b3r.js";import"./chunk-zxbw2gr0.js";import"./chunk-kgfgb971.js";import"./chunk-51n5rfsk.js";import"./chunk-pxqh758g.js";import"./chunk-jxda11cg.js";import"./chunk-dgb4z4kw.js";import"./chunk-sknazxqf.js";import"./chunk-zqtbtqbq.js";import"./chunk-pwjre3b2.js";import"./chunk-r6kbpwzd.js";import"./chunk-prf164ct.js";import"./chunk-v0byvxty.js";import"./chunk-nrvwejdw.js";import"./chunk-d419kwfp.js";import"./chunk-creeaceg.js";import"./chunk-dw5bsya8.js";import"./chunk-aprhqxky.js";import"./chunk-r3e6x87d.js";import"./chunk-mmwedr93.js";import"./chunk-v2x9vzgw.js";import{Gt,Kt}from"./chunk-fr4hs814.js";import"./chunk-e3crw545.js";import"./chunk-mayr8s0x.js";import"./chunk-ym41ybz2.js";import"./chunk-n38yb274.js";import"./chunk-9p6efb17.js";import"./chunk-t2pzy3x1.js";import"./chunk-rcadtv3x.js";import"./chunk-qvdx99py.js";import"./chunk-adzrhca1.js";import{di,pi,fi,gi,As,mi,hi,yi,Ps,Is,Sr,kr,_r}from"./chunk-q341v4gv.js";import"./chunk-4jyehvz3.js";import"./chunk-6ajahb2x.js";import"./chunk-r7kmsq3n.js";import"./chunk-n48cshgz.js";import"./chunk-8nryyqb5.js";import{ma}from"./chunk-a3mmhzpa.js";import{p}from"./chunk-2a4szpje.js";import{spawn as R}from"child_process";import S from"fs";import f from"path";import n from"process";import{CLI as z}from"@stacksjs/clapp";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",y=new z("stx");function E(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(m<1024||m>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function A(h){try{if(!S.existsSync(h)){let x=f.dirname(h),t=f.basename(h);if(S.existsSync(x)){let o=S.readdirSync(x).filter((s)=>s.toLowerCase().includes(t.toLowerCase().substring(0,3))||s.endsWith(".stx")||s.endsWith(".md")),r=o.length>0?`File not found. Similar files in ${x}: ${o.slice(0,3).join(", ")}`:`File not found. Directory ${x} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${h}`,suggestion:r}}return{isValid:!1,error:`File does not exist: ${h}`,suggestion:"Check the file path and try again"}}if(S.statSync(h).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${h}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(m){return{isValid:!1,error:`Cannot access file: ${h}`,suggestion:"Check file permissions and path"}}}function I(h){let m=typeof h==="string"?Number.parseInt(h,10):h;if(Number.isNaN(m))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(m<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(m>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var O=(h)=>h.includes("*")||h.includes("?")||h.includes("{")||h.includes("["),W=(h)=>h.endsWith(".stx")||h.endsWith(".md");function F(h,m=1){if(console.error(`\u274C ${h.error}`),h.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${h.suggestion}`);n.exit(m)}function M(h){if(!h)return;let m;try{m=JSON.parse(h)}catch(x){console.error(`\u274C --info-plist is not valid JSON: ${x.message}`),n.exit(1)}if(typeof m!=="object"||m===null||Array.isArray(m))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),n.exit(1);for(let[x,t]of Object.entries(m))if(typeof t!=="string"&&typeof t!=="number"&&typeof t!=="boolean")console.error(`\u274C --info-plist value for "${x}" must be a string, number or boolean`),n.exit(1);return m}async function V(h,m){try{let x=["test"],t=[];if(h&&h.length>0)for(let c of h)if(O(c))try{let i=await Array.fromAsync(new Bun.Glob(c).scan({onlyFiles:!0,absolute:!0}));if(i.length===0)console.warn(`Warning: No files found matching pattern: ${c}`);else if(t.push(...i),m.verbose)console.log(`Found ${i.length} file(s) matching pattern: ${c}`)}catch(i){return console.error(`Error expanding glob pattern ${c}:`,i),!1}else t.push(c);if(t.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(x.push(...t),m.filter)x.push("--pattern",m.filter);if(m.timeout)x.push("--timeout",m.timeout.toString());if(m.reporter&&m.reporter!=="default")if(m.reporter==="junit"){let c=f.resolve("stx-test-report.xml");x.push("--reporter",m.reporter),x.push("--reporter-outfile",c),console.log(`JUnit report: ${c}`)}else console.warn(`Warning: Reporter '${m.reporter}' is not supported. Using default reporter.`);if(m.coverage)x.push("--coverage");if(m.watch)x.push("--watch");x.push("--preload",f.join(__dirname,"../../../test-utils/happy-dom.ts"));let e={...n.env,STX_TEST_MODE:"true",STX_TEST_UI:m.ui?"true":"false",STX_TEST_VERBOSE:m.verbose?"true":"false"},o="bun";if(m.verbose)console.log(`Running: ${o} ${x.join(" ")}`);let r=performance.now(),s=R(o,x,{stdio:"inherit",shell:!1,env:e});return new Promise((c)=>{s.on("close",(i)=>{let d=((performance.now()-r)/1000).toFixed(2);if(i===0)c(!0);else c(!1)}),n.on("SIGINT",()=>{console.log(`
4
4
  Test run interrupted`),s.kill("SIGINT"),n.exit(1)})})}catch(x){return console.error("Error running tests:",x instanceof Error?x.message:String(x)),!1}}var U=n.argv.length>=3&&(W(n.argv[2])&&S.existsSync(n.argv[2])||O(n.argv[2]));if(U){let h=n.argv[2],m={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let x=3;x<n.argv.length;x++){let t=n.argv[x];if(t==="--port"&&x+1<n.argv.length){let e=E(n.argv[++x]);if(!e.isValid)F(e);m.port=Number.parseInt(n.argv[x],10)}else if(t==="--no-watch")m.watch=!1;else if(t==="--highlight-theme"&&x+1<n.argv.length){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.defaultTheme=n.argv[++x]}else if(t==="--no-highlight"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.enabled=!1}else if(t==="--no-highlight-unknown"){if(!m.markdown)m.markdown={};if(!m.markdown.syntaxHighlighting)m.markdown.syntaxHighlighting={};m.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(t==="--no-cache")m.cache=!1;else if(t==="--native")m.native=!0}if(O(h))try{let x=await Array.fromAsync(new Bun.Glob(h).scan({onlyFiles:!0,absolute:!0})),t=h.endsWith(".stx")?x.filter((s)=>s.endsWith(".stx")):h.endsWith(".md")?x.filter((s)=>s.endsWith(".md")):x.filter((s)=>s.endsWith(".stx")||s.endsWith(".md")),e=h.split("*")[0].replace(/\/$/,"")||".",o=f.resolve(e);try{let s=new Bun.Glob("**/*.stx"),i=(await Array.fromAsync(s.scan({cwd:o,onlyFiles:!0,absolute:!0}))).filter((l)=>/\[.+\]/.test(f.basename(l)));for(let l of i)if(!t.includes(l))t.push(l)}catch{}if(t.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${h}`),n.exit(1);if(!await kr(t,m))n.exit(1)}catch(x){console.error("Failed to process files:",x),n.exit(1)}else Sr(h,m).catch((x)=>{console.error("Failed to start dev server:",x),n.exit(1)})}else{let h=function(t,e){let o=[];for(let r=0;r<=e.length;r++)o[r]=[r];for(let r=0;r<=t.length;r++)o[0][r]=r;for(let r=1;r<=e.length;r++)for(let s=1;s<=t.length;s++)if(e.charAt(r-1)===t.charAt(s-1))o[r][s]=o[r-1][s-1];else o[r][s]=Math.min(o[r-1][s-1]+1,o[r][s-1]+1,o[r-1][s]+1);return o[e.length][t.length]};y.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(t)=>{try{if(await gi(t))console.log("Documentation generated successfully."),n.exit(0);else console.error("Documentation generation failed."),n.exit(1)}catch(e){console.error("Error generating documentation:",e),n.exit(1)}}),y.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(t,e)=>{try{let{fetchCollections:o,generatePackage:r}=await import("./chunk-2qbvsvwc.js");if(t==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let s=await o(),c=Object.entries(s).sort((i,l)=>l[1].total-i[1].total);console.log(`Available collections:
7
7
  `);for(let[i,l]of c){let d=l;console.log(` ${i.padEnd(30)} ${d.name} (${d.total} icons)`)}console.log(`
8
8
  Total: ${c.length} collections`)}else if(t.startsWith("generate")){let s=t==="generate"?"":t.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!s)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),n.exit(1);let c=e.output||f.join(n.cwd(),"packages/collections"),i=e.icons?e.icons.split(",").map((l)=>l.trim()):void 0;await r(s,c,i),console.log(`
9
9
  \u2713 Package generated successfully!`),console.log(`
10
- To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-864qtx7y.js"),{loadConfig:s}=await import("./chunk-gg3wbfxa.js");console.log(`
10
+ To use the package:`),console.log(` 1. cd packages/collections/iconify-${s}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${t}`),console.error("Available commands: list, generate"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("pwa <command>","PWA tools - audit configuration and build output").option("--output <dir>","Build output directory to audit",{default:"dist"}).example("stx pwa audit").example("stx pwa audit --output build").action(async(t,e)=>{try{if(t==="audit"){let{runPwaAudit:o,formatAuditResult:r}=await import("./chunk-864qtx7y.js"),{loadConfig:s}=await import("./chunk-j0dsavn2.js");console.log(`
11
11
  \uD83D\uDD0D Running PWA audit...
12
12
  `);let c=await s(),i=e.output||"dist",l=o(c,i);if(console.log(r(l)),l.failed>0)n.exit(1)}else console.error(`Unknown pwa command: ${t}`),console.error("Available commands: audit"),n.exit(1)}catch(o){console.error("Error:",o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("dev [file]","Start a development server for an STX app or file").option("--port <port>","Port to use for the dev server",{default:3000}).option("--pages <dir>",'Directory containing page templates (default: pagesDir from stx.config.ts, else "pages")').option("--no-watch","Disable file watching and auto-reload").option("--native","Open in a native desktop window using Zyte").option("--titlebar-hidden","Hide the native titlebar but keep the traffic-light buttons (web content draws under a transparent full-size titlebar). Implies --native.").option("--highlight-theme <theme>","Syntax highlighting theme for Markdown code blocks",{default:"github-dark"}).option("--no-highlight","Disable syntax highlighting for Markdown code blocks").option("--no-highlight-unknown","Disable syntax highlighting for unknown languages in Markdown").option("--no-cache","Disable caching of parsed files").option("--no-hmr","Disable HMR / live-reload script injection (useful for clean network traces)").option("--profile","Print per-directive timing for every page render via performanceMonitor").option("--debug-directives","Log directive ordering and intermediate template state during rendering").example("stx dev").example("stx dev --port 8080").example("stx dev --pages src/pages").example("stx dev template.stx").example("stx dev components/hero.stx --port 8080").example("stx dev **/*.stx").example("stx dev docs/guide.md").example("stx dev template.stx --native").action(async(t,e)=>{try{if(e.port!==void 0){let r=E(e.port);if(!r.isValid)F(r);e.port=Number.parseInt(String(e.port),10)}if(e.timeout!==void 0){let r=I(e.timeout);if(!r.isValid)F(r)}let o={syntaxHighlighting:{enabled:e.highlight!==!1,serverSide:!0,defaultTheme:e.highlightTheme||"github-dark",highlightUnknownLanguages:e.highlightUnknown!==!1}};if(!t){if(!await _r(".",{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}if(!O(t))try{let r=await import("fs");if(r.existsSync(t)&&r.statSync(t).isDirectory()){if(!await _r(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,cache:e.cache!==!1,hotReload:e.hmr!==!1,profile:e.profile===!0,debugDirectives:e.debugDirectives===!0,...e.pages&&{pagesDir:e.pages}}))n.exit(1);return}}catch{}if(O(t)){console.log(`Expanding glob pattern: ${t}`);let r=await te.timeAsync("glob-expansion",async()=>Array.fromAsync(new Bun.Glob(t).scan({onlyFiles:!0,absolute:!0}))),s=t.endsWith(".stx")?r.filter((d)=>d.endsWith(".stx")):t.endsWith(".md")?r.filter((d)=>d.endsWith(".md")):r.filter((d)=>d.endsWith(".stx")||d.endsWith(".md"));if(s.length===0)console.error(`No STX or Markdown files found matching pattern: ${t}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),n.exit(1);let c=t.split("*")[0].replace(/\/$/,"")||".",i=f.resolve(c);try{let d=new Bun.Glob("**/*.stx"),u=(await Array.fromAsync(d.scan({cwd:i,onlyFiles:!0,absolute:!0}))).filter((g)=>/\[.+\]/.test(f.basename(g)));for(let g of u)if(!s.includes(g))s.push(g)}catch{}if(console.log(`Found ${s.length} ${s.length===1?"file":"files"} matching ${t}`),!await kr(s,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}else{if(!O(t)){let s=A(t);if(!s.isValid)F(s)}if(!await Sr(t,{port:e.port,watch:e.watch!==!1,native:e.native||e.titlebarHidden||!1,titlebarHidden:e.titlebarHidden===!0,markdown:o,cache:e.cache!==!1}))n.exit(1)}}catch(o){console.error("Error starting dev server:",o),n.exit(1)}}),y.command("a11y [target]","Scan .stx files for accessibility issues (directory, file, or glob)").option("--no-recursive","Disable recursive scanning of directories").option("--ignore <paths>","Comma-separated paths to ignore",{default:""}).option("--json","Output results as JSON").option("--output <file>","Write results to a file instead of stdout").option("--fix","Automatically fix common accessibility issues").example("stx a11y ./templates").example('stx a11y "resources/**/*.stx"').example("stx a11y resources/emails/welcome.stx").example("stx a11y --json --output a11y-report.json").action(async(t=".",e)=>{try{console.log(`Scanning ${t} for accessibility issues...`);let o=e.ignore?e.ignore.split(",").map((l)=>l.trim()):[],{results:r,scannedFiles:s}=await ma(t,{recursive:e.recursive!==!1,ignorePaths:o});if(s.length===0)console.log(`
13
13
  No .stx files matched ${t}
@@ -69,7 +69,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
69
69
  File not found: ${t}`),n.exit(1);if(!t.endsWith(".stx"))console.error(`
70
70
  File must have .stx extension: ${t}`),n.exit(1)}let r=f.resolve(e.pages),s=f.resolve(e.out);if(!t&&!S.existsSync(r))console.error(`
71
71
  Pages directory not found: ${r}`),console.log(`
72
- Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-64ny75zz.js");Kt();let i=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
72
+ Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),n.exit(1);let{buildApp:c}=await import("./chunk-smyeg8cr.js");Kt();let i=await c({root:t?f.dirname(t):void 0,debug:e.verbose,ssg:{pagesDir:e.pages,outputDir:e.out,domain:e.domain,baseUrl:e.base,sitemap:e.sitemap,rss:e.rss,minify:e.minify,cache:e.cache!==!1,cleanOutput:e.clean,concurrency:Number.parseInt(e.concurrency,10)||10,publicDir:e.public,trailingSlash:e.trailingSlash,generate404:!0,hooks:e.verbose?{onPageStart:(d)=>console.log(` Generating: ${d}`),onPageEnd:(d,a)=>console.log(` Generated: ${d} (${a.length} bytes)`),onError:(d,a)=>console.error(` Error in ${a}: ${d.message}`)}:void 0},ssr:{outputDir:e.out==="dist"?".output":e.out,debug:e.verbose}}),l=((performance.now()-o)/1000).toFixed(2);if(i.mode==="ssr"&&i.ssr)console.log(`
73
73
  Build complete! (SSR)
74
74
  `),console.log(` Pages compiled: ${i.ssr.pageCount}`),console.log(` Output: ${i.ssr.outputDir}`),console.log(` Duration: ${l}s
75
75
  `);else if(i.ssg){if(console.log(`
@@ -84,7 +84,7 @@ Total: ${i} issues in ${c} files`),e.output){let l=`
84
84
  Build completed with ${i.ssg.failedCount} error(s). Fix the issues above and try again.
85
85
  `),n.exit(1);console.log(" To preview locally:"),console.log(` cd ${e.out||"dist"} && npx serve
86
86
  `)}}catch(o){console.error(`
87
- Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-hz0g9xrq.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
87
+ Build failed:`,o instanceof Error?o.message:String(o)),n.exit(1)}}),y.command("start","Start the production server (serves pre-built .output/)").option("--port <number>","Server port",{default:"3000"}).option("--output <dir>","Output directory from stx build",{default:".output"}).example("stx start").example("stx start --port 8080").action(async(t)=>{try{let e=f.resolve(t.output);if(!S.existsSync(f.join(e,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),n.exit(1);let{startProductionServer:o}=await import("./chunk-6fbxh1we.js");await o({outputDir:e,port:Number.parseInt(t.port,10)||3000})}catch(e){console.error(`
88
88
  Failed to start production server:`,e instanceof Error?e.message:String(e)),n.exit(1)}}),y.command("deploy [directory]","Deploy built site to Netlify").option("--site-id <id>","Netlify site ID (or set NETLIFY_SITE_ID env var)").option("--token <token>","Auth token (or set NETLIFY_AUTH_TOKEN env var)").option("--production","Deploy to production (default: draft preview)").option("--message <msg>","Deploy message/title").option("--no-build","Skip build step before deploy").option("--open","Open deployed URL in browser").option("--dry-run","Preview deployment without uploading").option("--init","Initialize Netlify configuration for this project").example("stx deploy").example("stx deploy --production").example("stx deploy dist --site-id my-site-abc123").example("stx deploy --init").example("stx deploy --dry-run").action(async(t,e)=>{try{let{deploy:o,initNetlify:r,DeployError:s}=await import("./chunk-c9k40352.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${$e}\x1B[0m`),e.init){console.log(`
89
89
  \uD83D\uDCDD Initializing Netlify configuration...
90
90
  `);let i=await r({directory:t||n.cwd(),siteId:e.siteId});if(console.log(`\u2713 Created ${i.configPath}`),i.siteId)console.log("\u2713 Saved site ID to .env.local");console.log(`
@@ -124,7 +124,7 @@ To view it in the development server:`),console.log(` stx dev ${t}
124
124
  \uD83D\uDCDD ${f.relative(n.cwd(),a)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${f.basename(a)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(a,b),console.log(`\u2705 Formatted ${f.relative(n.cwd(),a)}`),l++}catch(u){console.error(`\u274C Error formatting ${f.relative(n.cwd(),a)}:`,u),d++}if(e.check&&d>0)console.log(`
125
125
  ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.check&&!e.diff)console.log(`\u2728 Formatted ${l} files successfully`)}catch(o){console.error("Error formatting files:",o),n.exit(1)}}),y.command("perf [command...]","Show performance statistics for STX operations").option("--clear","Clear performance statistics").option("--json","Output as JSON").example("stx perf").example("stx perf --clear").example("stx perf --json").action(async(t,e)=>{try{if(e.clear){te.clear(),console.log("\u2705 Performance statistics cleared");return}let o=te.getStats();if(Object.keys(o).length===0){if(e.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(e.json)console.log(JSON.stringify(o,null,2));else{console.log(`
126
126
  \uD83D\uDCCA STX Performance Statistics
127
- `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-1qmc6gg1.js"),{resolveStxTargets:s}=await import("./chunk-52gp2xxk.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
127
+ `);for(let[r,s]of Object.entries(o))console.log(`\uD83D\uDD27 ${r}:`),console.log(` Count: ${s.count}`),console.log(` Average: ${s.avgTime.toFixed(2)}ms`),console.log(` Total: ${s.totalTime.toFixed(2)}ms`),console.log(` Min: ${s.minTime.toFixed(2)}ms`),console.log(` Max: ${s.maxTime.toFixed(2)}ms`),console.log("")}}catch(o){console.error("Error showing performance stats:",o),n.exit(1)}}),y.command("typecheck [patterns...]","Type-check the TypeScript inside .stx script blocks").option("--no-client","Skip <script client> and bare <script> blocks").option("--no-server","Skip <script server> blocks").option("--no-templates","Skip {{ }} and directive expressions in the markup").option("--lib <path>","Extra ambient declaration file (repeatable)").example("stx typecheck").example('stx typecheck "resources/views/**/*.stx"').action(async(t,e)=>{let{formatTypecheckDiagnostics:o,typecheckStxFiles:r}=await import("./chunk-vpa06pyx.js"),{resolveStxTargets:s}=await import("./chunk-52gp2xxk.js"),c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx"],l=await s(i);if(l.length===0){console.log(`
128
128
  No .stx files matched ${i.join(", ")}
129
129
  `);return}let d=di(n.argv,"--lib"),a=d.length>0?d:e.lib?Array.isArray(e.lib)?e.lib:[e.lib]:[],u=await r(l,{client:e.client!==!1,server:e.server!==!1,templates:e.templates!==!1,extraLibs:a});if(u.failure)console.error(`
130
130
  Type-check did not run.
@@ -135,7 +135,7 @@ ${d} files need formatting. Run 'stx format' to fix.`),n.exit(1);else if(!e.chec
135
135
  `),n.exit(2);let g=u.diagnostics.filter((b)=>b.category==="error");if(u.diagnostics.length>0)console.error(`
136
136
  ${o(u.diagnostics)}
137
137
  `);if(console.log(` Checked ${u.blockCount} script block(s) and ${u.expressionCount} template expression(s) in ${u.checkedFiles.length} file(s) \u2014 `+`${g.length} error(s), ${u.diagnostics.length-g.length} warning(s)
138
- `),g.length>0)n.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:r}=await import("./chunk-vmwdt8fr.js"),s=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),n.exit(1);let d=new Set,a=[],u=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:n.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(f.resolve(n.cwd(),w))}catch{}for(let b of i)for await(let w of new s(b).scan({cwd:n.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||d.has(w)||g.has(w))continue;d.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),u++}if(console.error(r(a,Boolean(e.fix))),e.fix)console.error(`
138
+ `),g.length>0)n.exit(1)}),y.command("codemod [patterns...]","Find hand-rolled code that an stx primitive already covers").option("--fix","Write the safe rewrites (default is report-only)").option("--rule <rule>","Run one rule only: confirm | tooltip (rewritable) \xB7 alert | route-params | search-params | navigate | "+"fetch | polling | debounce | click-outside | focus | clipboard | watch (report-only)").example("stx codemod").example("stx codemod --rule route-params").example('stx codemod --fix "resources/views/**/*.stx"').action(async(t,e)=>{let{codemodSource:o,formatCodemodFindings:r}=await import("./chunk-een2wqah.js"),s=globalThis.Bun.Glob,c=Array.isArray(t)?t:t?[t]:[],i=c.length?c:["**/*.stx","**/*.ts"],l=e.rule?[e.rule]:void 0;if(e.rule&&e.rule!=="confirm"&&e.rule!=="tooltip")console.error(`Unknown rule "${e.rule}". Expected: confirm | tooltip`),n.exit(1);let d=new Set,a=[],u=0,g=new Set;try{let b=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:n.cwd(),stdout:"pipe",stderr:"pipe"});for(let w of new TextDecoder().decode(b.stdout).split("\x00"))if(w)g.add(f.resolve(n.cwd(),w))}catch{}for(let b of i)for await(let w of new s(b).scan({cwd:n.cwd(),absolute:!0})){if(w.includes("/node_modules/")||w.includes("/dist/")||d.has(w)||g.has(w))continue;d.add(w);let k=await Bun.file(w).text(),v=o(k,{file:w,rules:l});if(a.push(...v.findings),e.fix&&v.code!==k)await Bun.write(w,v.code),u++}if(console.error(r(a,Boolean(e.fix))),e.fix)console.error(`
139
139
  ${u} file(s) written.`)}),y.command("doctor","Diagnose the stx framework-runtime resolution + staleness chain").option("--json","Output the report as JSON").example("stx doctor").example("stx doctor --json").action(async(t)=>{try{let e;try{let r=await import("./chunk-eecgcj41.js");e=r.generateSignalsRuntime}catch{e=void 0}let o=await Ps({generateRuntime:e});if(t.json)console.log(JSON.stringify(o,null,2));else console.log(Is(o));if(!o.ok)n.exit(1)}catch(e){console.error("Error running doctor:",e),n.exit(1)}}),y.command("debug <file>","Debug STX template processing step by step").option("--step","Step through processing stages interactively").option("--verbose","Show detailed processing information").option("--context <data>","JSON string of context data to use").option("--save-report <file>","Save debug report to file").example("stx debug template.stx").example("stx debug template.stx --step").example(`stx debug template.stx --context '{"name": "John", "items": [1,2,3]}'`).action(async(t,e)=>{try{let o=A(t);if(!o.isValid)F(o);console.log(`\uD83D\uDD0D Debugging stx template: ${t}
140
140
  `);let r={};if(e.context)try{r=JSON.parse(e.context)}catch(i){console.error("\u274C Invalid JSON in --context option"),n.exit(1)}let s=await Bun.file(t).text();console.log(`\uD83D\uDCC4 Template Content (${s.length} chars):`),console.log("\u2500".repeat(50)),console.log(s.substring(0,500)+(s.length>500?`
141
141
  ...
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
160
160
  \uD83D\uDCC4 Files with issues:`),d.forEach((a)=>{let u=a.issues.filter((g)=>s[g.type]>=c).length;if(u>0)console.log(` ${f.relative(n.cwd(),a.file)} (${u} issues)`)});if(e.saveReport){let a={summary:l,results:d,generatedAt:new Date().toISOString(),commandOptions:e};await Bun.write(e.saveReport,JSON.stringify(a,null,2)),console.log(`
161
161
  \uD83D\uDCCB Analysis report saved to: ${e.saveReport}`)}console.log(`
162
162
  \u2728 Analysis complete! Use --detailed for more information.`)}catch(o){console.error("Error analyzing templates:",o),n.exit(1)}}),y.command("screenshot [input]","Capture PNG screenshot(s) of page(s) via Bun WebView \u2014 a file, URL, or dist directory").option("--out <dir>","Output directory",{default:"screenshots"}).option("--width <px>","Viewport width",{default:"1440"}).option("--height <px>","Viewport height",{default:"2200"}).option("--wait <ms>","Settle time after navigation before capture",{default:"800"}).option("--timeout <ms>","Hard cap on waiting for navigation",{default:"15000"}).option("--full-page","Capture the entire scrollable page, not just the viewport").option("--wait-selector <sel>","Wait until a CSS selector exists before capturing").option("--format <fmt>","Image format: png | jpeg | webp",{default:"png"}).option("--backend <name>","WebView backend: webkit (macOS, default) | chrome").action(async(t,e)=>{let{captureScreenshots:o}=await import("./chunk-jk41jwsc.js"),r=t||"dist";try{let s=await o(r,e.out,{width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),waitMs:Number.parseInt(e.wait,10),timeoutMs:Number.parseInt(e.timeout,10),fullPage:Boolean(e.fullPage),waitSelector:e.waitSelector,format:e.format,backend:e.backend});for(let c of s)console.log(`\uD83D\uDCF8 ${c.output} (${(c.bytes/1024).toFixed(0)} KB)`);console.log(`
163
- \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log($e)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-cbsa2np9.js"),o={};if(t.context){let r=f.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-h42anr8g.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
163
+ \u2728 Captured ${s.length} screenshot(s) to ${e.out}/ via Bun WebView`)}catch(s){console.error(`Screenshot failed: ${s.message}`),n.exit(1)}}),y.command("version","Show the version of the CLI").action(()=>{console.log($e)}),y.command("interactive","Start interactive REPL mode for template development").alias("i").option("--context <file>","Load initial context from JSON file").option("--cwd <directory>","Set working directory").option("--verbose","Show verbose output").action(async(t)=>{let{startInteractive:e}=await import("./chunk-ap1sydzw.js"),o={};if(t.context){let r=f.resolve(t.context);if(S.existsSync(r))try{let s=S.readFileSync(r,"utf-8");o=JSON.parse(s)}catch(s){console.error("Error loading context file:",s),n.exit(1)}else console.error(`Context file not found: ${r}`),n.exit(1)}await e({context:o,cwd:t.cwd?f.resolve(t.cwd):n.cwd(),verbose:t.verbose})}),y.command("build:native <input>","Build stx template into a native desktop/mobile app").option("--output <dir>","Output directory",{default:"dist/native"}).option("--target <platform>","Target platform: macos, windows, linux, ios, android").option("--format <format>","Output format: app, dmg, pkg, msi, zip, deb, rpm, appimage, ipa, apk").option("--name <name>","Application name (defaults to filename)").option("--version <version>","Application version",{default:"1.0.0"}).option("--description <desc>","Application description").option("--author <author>","Author/Maintainer name").option("--bundle-id <id>","Bundle identifier (macOS/iOS)").option("--icon <path>","Path to application icon").option("--width <width>","Window width",{default:"1200"}).option("--height <height>","Window height",{default:"800"}).option("--title <title>","Window title").option("--system-tray","Enable system tray/menubar mode").option("--menubar-only","Run without a dock icon (implied by --system-tray)").option("--category <type>","LSApplicationCategoryType (macOS)").option("--copyright <text>","NSHumanReadableCopyright (macOS)").option("--min-system-version <v>","LSMinimumSystemVersion (macOS)").option("--info-plist <json>","Extra Info.plist keys as a JSON object (macOS)").option("--dev-tools","Enable developer tools").option("--frameless","Create frameless window").option("--always-on-top","Keep window always on top").option("--craft-path <path>","Path to Craft binary").option("--verbose","Show verbose output").example("stx build:native app.stx --target macos").example("stx build:native app.stx --target macos --format dmg").example("stx build:native app.stx --target linux --format appimage").example('stx build:native app.stx --name "My App" --icon icon.png').action(async(t,e)=>{try{let{buildNative:o,getAvailableTargets:r,getAvailableFormats:s}=await import("./chunk-mxdm8sw0.js"),c=f.resolve(t);if(!S.existsSync(c))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let i=r();if(e.target&&!["macos","windows","linux","ios","android"].includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${i.join(", ")}`),n.exit(1);let l=e.target||i[0],d=s(l);if(e.format&&!d.includes(e.format))console.error(`\u274C Invalid format for ${l}: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${d.join(", ")}`),n.exit(1);console.log(`
164
164
  \uD83D\uDD28 Building native app...`),console.log(` Input: ${t}`),console.log(` Target: ${l}`),console.log(` Format: ${e.format||"default"}`),console.log(` Output: ${e.output}
165
165
  `);let a=await o({input:c,output:f.resolve(e.output),target:l,format:e.format,name:e.name,version:e.version,description:e.description,author:e.author,bundleId:e.bundleId,icon:e.icon?f.resolve(e.icon):void 0,window:{title:e.title,width:Number.parseInt(e.width,10),height:Number.parseInt(e.height,10),frameless:e.frameless,alwaysOnTop:e.alwaysOnTop},systemTray:e.systemTray,menubarOnly:e.menubarOnly,category:e.category,copyright:e.copyright,minimumSystemVersion:e.minSystemVersion,infoPlist:M(e.infoPlist),devTools:e.devTools,craftPath:e.craftPath,verbose:e.verbose});if(a.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${a.outputPath}`),a.duration)console.log(` Duration: ${(a.duration/1000).toFixed(2)}s`);if(l==="macos"&&a.format==="app")console.log(`
166
166
  \uD83D\uDCA1 To run: open "${a.outputPath}"`);else if(l==="linux"&&a.format==="appimage")console.log(`
167
- \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-3r5rk2rz.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-mrrrngzd.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-t6yjxhn8.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-j8g1v38x.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-rhzkw6y4.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-g2jmwh7p.js"),r=f.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
167
+ \uD83D\uDCA1 To run: chmod +x "${a.outputPath}" && "${a.outputPath}"`)}else console.error(`\u274C Build failed: ${a.error}`),n.exit(1)}catch(o){console.error(`\u274C Build error: ${o.message}`),n.exit(1)}}),y.command("story","Start component showcase and testing server").option("-p, --port <port>","Server port",{default:"6006"}).option("-o, --open","Open browser automatically",{default:!1}).option("--host <host>","Host to bind to",{default:"localhost"}).example("stx story").example("stx story --port 3000 --open").action(async(t)=>{try{let{devCommand:e}=await import("./chunk-rxqv3p90.js");await e({port:t.port?Number.parseInt(t.port,10):6006,open:t.open,host:t.host})}catch(e){console.error(`\u274C Story error: ${e.message}`),n.exit(1)}}),y.command("story:build","Build static story site").option("-o, --outDir <dir>","Output directory",{default:".stx/dist/story"}).example("stx story:build").example("stx story:build --outDir ./docs/components").action(async(t)=>{try{let{buildCommand:e}=await import("./chunk-mrrrngzd.js");await e({outDir:t.outDir})}catch(e){console.error(`\u274C Story build error: ${e.message}`),n.exit(1)}}),y.command("story:test","Run visual regression tests").option("-u, --update","Update snapshots",{default:!1}).option("-f, --filter <name>","Filter components by name").example("stx story:test").example("stx story:test --update").example("stx story:test --filter Button").action(async(t)=>{try{let{createContext:e}=await import("./chunk-t6yjxhn8.js"),{runVisualTests:o,updateSnapshots:r,formatTestResults:s}=await import("./chunk-ky5kmg7t.js"),c=await e({mode:"build"});if(t.update){let i=await r(c,{filter:t.filter?[t.filter]:void 0});console.log(`Updated ${i} snapshots`)}else{let i=await o(c,{filter:t.filter?[t.filter]:void 0});if(console.log(s(i)),i.failed>0)n.exit(1)}}catch(e){console.error(`\u274C Story test error: ${e.message}`),n.exit(1)}}),y.command("native <action> [file]","Compile .stx screens into the JavaScriptCore bundle Craft renders natively").option("--format <format>","bundle (the JavaScriptCore bundle) or ir (the template as JSON)",{default:"ir"}).option("--output <path>","Write to this file instead of stdout").option("--minify","Minify the bundle",{default:!1}).option("--config <file>","Screens config (default: native.config.json in the working directory)").example("stx native compile Screen.stx --format bundle --output native-screen.js").example("stx native compile --format bundle --output native-screen.js --minify").example("stx native compile Screen.stx").action(async(t,e,o)=>{if(t!=="compile")console.error(`Unknown native command: ${t}`),console.error("Usage: stx native compile [file.stx] --format bundle|ir [--output <file>] [--minify] [--config <file>]"),n.exit(1);try{let{runNativeCompile:r}=await import("./chunk-4f4agvd0.js"),s=await r(e,{format:o.format,output:o.output,minify:Boolean(o.minify),config:o.config});for(let c of s.diagnostics)console.warn(`${c.level}: ${c.message}`);if(s.written)console.log(`Compiled: ${e??"screens"} \u2192 ${f.relative(n.cwd(),s.written)||s.written}`);else console.log(s.output)}catch(r){console.error(r instanceof Error?r.message:String(r)),n.exit(1)}}),y.command("compile <input>","Compile stx template to native Craft component code").option("--target <platform>","Target platform: macos, windows, linux, ios, android, universal",{default:"universal"}).option("--format <format>","Output format: zig, typescript, json",{default:"zig"}).option("--output <path>","Output directory for compiled files",{default:"./dist"}).option("--optimize","Enable optimizations",{default:!0}).option("--tree-shake","Enable tree shaking",{default:!0}).option("--hot-reload","Enable hot reload support",{default:!1}).option("--sourcemaps","Generate source maps",{default:!1}).option("--bundle","Bundle all dependencies",{default:!0}).option("--minify","Minify output",{default:!1}).option("--verbose","Show detailed output",{default:!1}).example("stx compile app.stx").example("stx compile app.stx --target macos --format zig").example("stx compile app.stx --format typescript --output ./native").example("stx compile app.stx --optimize --tree-shake --minify").action(async(t,e)=>{try{let{compileToNative:o}=await import("./chunk-g2jmwh7p.js"),r=f.resolve(t);if(!S.existsSync(r))console.error(`\u274C Input file not found: ${t}`),n.exit(1);let s=["macos","windows","linux","ios","android","universal"];if(!s.includes(e.target))console.error(`\u274C Invalid target: ${e.target}`),console.error(`\uD83D\uDCA1 Available targets: ${s.join(", ")}`),n.exit(1);let c=["zig","typescript","json"];if(!c.includes(e.format))console.error(`\u274C Invalid format: ${e.format}`),console.error(`\uD83D\uDCA1 Available formats: ${c.join(", ")}`),n.exit(1);console.log(`
168
168
  \uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${t}`),console.log(` Target: ${e.target}`),console.log(` Format: ${e.format}`),console.log(` Output: ${e.output}
169
169
  `);let i=S.readFileSync(r,"utf-8"),l=await o(i,{target:e.target,format:e.format,optimize:e.optimize,treeShake:e.treeShake,hotReload:e.hotReload,debug:e.verbose,sourceMaps:e.sourcemaps,bundle:e.bundle,minify:e.minify}),d=f.resolve(e.output);if(!S.existsSync(d))S.mkdirSync(d,{recursive:!0});let a=f.basename(t,f.extname(t)),u=e.format==="typescript"?"ts":e.format==="json"?"json":"zig",g=f.join(d,`${a}.${u}`);S.writeFileSync(g,l.code);let b=f.join(d,`${a}.manifest.json`);if(S.writeFileSync(b,JSON.stringify(l.manifest,null,2)),e.sourcemaps&&l.sourceMaps){let w=f.join(d,`${a}.${u}.map`);S.writeFileSync(w,l.sourceMaps)}if(e.target==="universal"&&l.platformCode.size>0)for(let[w,k]of l.platformCode){let v=f.join(d,`${a}.${w}.${u}`);S.writeFileSync(v,k)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${g}`),console.log(` Manifest: ${b}`),console.log(`
170
170
  \uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${l.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${l.stats.totalComponents}`),console.log(` Native components: ${l.stats.nativeComponents}`),console.log(` Web fallback components: ${l.stats.webComponents}`),console.log(` Bundle size: ${(l.stats.bundleSize/1024).toFixed(2)}KB`),l.stats.warnings.length>0){console.log(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ws,qi,Gi}from"./chunk-120ze5ms.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-gjwyy7kh.js";import"./chunk-2h8ea0we.js";import"./chunk-mj3fghaq.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-a8aqch0j.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-aqk9e27b.js";import"./chunk-3areak0p.js";import"./chunk-h8h2n247.js";import"./chunk-sng45f0b.js";import"./chunk-pbxq1rwd.js";import"./chunk-3ey8888k.js";import"./chunk-51kzs978.js";import"./chunk-prf164ct.js";import"./chunk-c1dkh0es.js";import{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi}from"./chunk-y463z9qf.js";import"./chunk-xmb4ttnf.js";import"./chunk-r7kmsq3n.js";import"./chunk-w6kdpx52.js";import"./chunk-8nryyqb5.js";import"./chunk-zd23z1j8.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import{Ws,qi,Gi}from"./chunk-120ze5ms.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-h6633jna.js";import"./chunk-2h8ea0we.js";import"./chunk-z248e3gj.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-adxt8qcy.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-q5h1reph.js";import"./chunk-vc2xzscw.js";import"./chunk-ftskxb7f.js";import"./chunk-vzk09hvw.js";import"./chunk-msvpb1ax.js";import"./chunk-pwjre3b2.js";import"./chunk-r6kbpwzd.js";import"./chunk-prf164ct.js";import"./chunk-c1dkh0es.js";import{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi}from"./chunk-xz261gkh.js";import"./chunk-4jyehvz3.js";import"./chunk-r7kmsq3n.js";import"./chunk-n48cshgz.js";import"./chunk-8nryyqb5.js";import"./chunk-a3mmhzpa.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
package/dist/craft.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ws,qi,Gi}from"./chunk-120ze5ms.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-gjwyy7kh.js";import"./chunk-2h8ea0we.js";import"./chunk-mj3fghaq.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-a8aqch0j.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-aqk9e27b.js";import"./chunk-3areak0p.js";import"./chunk-h8h2n247.js";import"./chunk-sng45f0b.js";import"./chunk-pbxq1rwd.js";import"./chunk-3ey8888k.js";import"./chunk-51kzs978.js";import"./chunk-prf164ct.js";import"./chunk-c1dkh0es.js";import{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi}from"./chunk-y463z9qf.js";import"./chunk-xmb4ttnf.js";import"./chunk-r7kmsq3n.js";import"./chunk-w6kdpx52.js";import"./chunk-8nryyqb5.js";import"./chunk-zd23z1j8.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
2
+ import{Ws,qi,Gi}from"./chunk-120ze5ms.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-h6633jna.js";import"./chunk-2h8ea0we.js";import"./chunk-z248e3gj.js";import"./chunk-a3d0g4mr.js";import"./chunk-zaaeneq6.js";import"./chunk-adxt8qcy.js";import"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-q5h1reph.js";import"./chunk-vc2xzscw.js";import"./chunk-ftskxb7f.js";import"./chunk-vzk09hvw.js";import"./chunk-msvpb1ax.js";import"./chunk-pwjre3b2.js";import"./chunk-r6kbpwzd.js";import"./chunk-prf164ct.js";import"./chunk-c1dkh0es.js";import{Xd,ji,Jd,Yd,Bi,Us,Fi,Zd,zi,Qd,ep,Hi,Vi,Ui,Wi}from"./chunk-xz261gkh.js";import"./chunk-4jyehvz3.js";import"./chunk-r7kmsq3n.js";import"./chunk-n48cshgz.js";import"./chunk-8nryyqb5.js";import"./chunk-a3mmhzpa.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
3
3
  `),scripts:t.scripts.join(`
4
4
  `),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
5
5
  `),scripts:t.scripts.join(`
@@ -432,6 +432,13 @@ function expressionUsesOnlyContextVars(expr, context) {
432
432
  }
433
433
  return !0;
434
434
  }
435
+ function callsContextFunction(expr, context) {
436
+ const searchable = stripCommentsAndLiterals(expr);
437
+ for (const match of searchable.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))
438
+ if (typeof context[match[1]] === "function")
439
+ return !0;
440
+ return !1;
441
+ }
435
442
  function expressionReadsServerBinding(expr, context) {
436
443
  const declared = context.__stx_serverDeclared;
437
444
  if (!declared || declared.size === 0)
@@ -594,6 +601,8 @@ export function processExpressions(template, context, filePath) {
594
601
  return "";
595
602
  if (firstVarIsClientSignal)
596
603
  return match;
604
+ if (context.__stx_native_screen === !0 && callsContextFunction(trimmedExpr, context))
605
+ return match;
597
606
  let rejection;
598
607
  try {
599
608
  const value = evaluateExpression(expr, context, !1, (r) => {
@@ -251,6 +251,7 @@ export declare interface NativeBridgeInterface {
251
251
  colorScheme?: 'light' | 'dark'
252
252
  viewportWidth?: number
253
253
  sessionTokenKey?: string
254
+ shareStorage?: Record<string, string>
254
255
  appURL?: string
255
256
  appVersion?: string
256
257
  appBuild?: string
@@ -47,6 +47,7 @@ export declare interface CompileNativeBundleOptions {
47
47
  routesDir?: string
48
48
  sharedRuntime?: boolean
49
49
  messages?: NativeMessagesOptions
50
+ shareStorage?: Record<string, string>
50
51
  styleConfig?: NativeStyleConfig
51
52
  }
52
53
  export declare interface NativeMessagesOptions {
@@ -188,6 +188,7 @@ var bridge = browserBridge;
188
188
  g.__stxNativeRoute = ${JSON.stringify(initialScreen)};` : "var bridge = g.__stxNativeBridge;"}
189
189
  if (!bridge) throw new Error('Missing __stxNativeBridge');
190
190
  var routeNames = ${JSON.stringify(routed ? names : ["main"])};
191
+ var shareStorage = ${JSON.stringify(options.shareStorage ?? {})};
191
192
  ${route}
192
193
  g.__stxNativeRoute = routeName;
193
194
  var nativeDocument;
@@ -196,11 +197,11 @@ ${selections}
196
197
  var screen = null;
197
198
  var app = null;
198
199
  if (isApp) {
199
- app = prepareNativeApp(bridge, { routeName: routeName, routeNames: routeNames });
200
+ app = prepareNativeApp(bridge, { routeName: routeName, routeNames: routeNames, shareStorage: shareStorage });
200
201
  g.__stxNativeUnmount = function() { app.unmount(); };
201
202
  }
202
203
  else {
203
- screen = prepareSharedNativeScreen(nativeDocument, manifest, bridge, { routeName: routeName, routeNames: routeNames });
204
+ screen = prepareSharedNativeScreen(nativeDocument, manifest, bridge, { routeName: routeName, routeNames: routeNames, shareStorage: shareStorage });
204
205
  g.__stx_host = screen.host;
205
206
  g.__stxNativeUnmount = function() { screen.unmount(); };
206
207
  }
@@ -407,6 +407,8 @@ declare const fontSizes: Record<string, number>;
407
407
  * ```
408
408
  */
409
409
  declare const borderRadius: Record<string, number>;
410
+ /** ARIA state variants a native node can carry: its attribute is on the node, so the layer can follow it. */
411
+ export declare const NATIVE_STATE_VARIANTS: Set<any>;
410
412
  // ============================================================================
411
413
  // Main Compiler Function
412
414
  // ============================================================================
@@ -421,6 +423,8 @@ export declare interface ClassStyles {
421
423
  resizeMode?: string
422
424
  responsive?: Array<{ min: number, max?: number, style: STXStyle, dark?: STXStyle }>
423
425
  disabled?: { style: STXStyle, dark?: STXStyle }
426
+ states?: Record<string, { style: STXStyle, dark?: STXStyle }>
427
+ divide?: { style: STXStyle, dark?: STXStyle }
424
428
  }
425
429
  // ============================================================================
426
430
  // Class Parsers
@@ -1254,6 +1254,17 @@ function parseShadow(className, style) {
1254
1254
  Object.assign(style, { shadowColor: "#000000", shadowOpacity: opacity, shadowRadius: radius, shadowOffset: { width: 0, height: offset }, elevation });
1255
1255
  return !0;
1256
1256
  }
1257
+ function divideAsBorder(name) {
1258
+ const rule = /^divide-(?:(y|x)(?:-(.+))?|(.+))$/.exec(name);
1259
+ if (!rule)
1260
+ return null;
1261
+ if (rule[2] === "reverse")
1262
+ return "";
1263
+ if (rule[1])
1264
+ return `border-${rule[1] === "y" ? "t" : "l"}${rule[2] ? `-${rule[2]}` : ""}`;
1265
+ return `border-${rule[3]}`;
1266
+ }
1267
+ export const NATIVE_STATE_VARIANTS = new Set(["aria-selected", "aria-pressed", "aria-checked", "aria-expanded"]);
1257
1268
  const POINTER_ONLY_VARIANTS = new Set(["hover", "group-hover", "peer-hover", "active", "group-active", "visited", "placeholder", "selection", "print", "motion-safe"]), WEB_ONLY_UTILITY = /^(?:transition(?:-[a-z]+)?|duration-\S+|ease-\S+|delay-\S+|will-change-\S+|cursor-\S+|select-(?:none|text|all|auto)|outline-none|outline-0|appearance-none|scroll-smooth|scroll-auto|antialiased|subpixel-antialiased|touch-\S+|resize(?:-\S+)?|backdrop-blur(?:-\S+)?|isolate|contain-\S+)$/;
1258
1269
  function splitVariants(token) {
1259
1270
  const parts = [];
@@ -1305,7 +1316,7 @@ export function compileClassStyles(classes, variables, options = {}) {
1305
1316
  continue;
1306
1317
  if (WEB_ONLY_UTILITY.test(utility) || !focusing && parts.some((variant) => POINTER_ONLY_VARIANTS.has(variant)))
1307
1318
  continue;
1308
- let min, max, disabled = !1;
1319
+ let min, max, disabled = !1, state;
1309
1320
  const kept = [];
1310
1321
  for (const variant of parts) {
1311
1322
  const width = nativeBreakpoint(variant), below = variant.startsWith("max-") ? nativeBreakpoint(variant.slice(4)) : void 0;
@@ -1315,11 +1326,13 @@ export function compileClassStyles(classes, variables, options = {}) {
1315
1326
  max = below - 0.02;
1316
1327
  else if (variant === "disabled" && !disabled)
1317
1328
  disabled = !0;
1329
+ else if (NATIVE_STATE_VARIANTS.has(variant) && state === void 0)
1330
+ state = variant;
1318
1331
  else
1319
1332
  kept.push(variant);
1320
1333
  }
1321
- const stripped = [...kept, utility].join(":"), ranged = min !== void 0 || max !== void 0, target = disabled ? group("disabled", { disabled: !0 }) : ranged ? group(`range:${min ?? 0}:${max ?? ""}`, { min: min ?? 0, max }) : groups.get("base");
1322
- if (disabled && ranged) {
1334
+ const stripped = [...kept, utility].join(":"), ranged = min !== void 0 || max !== void 0, target = disabled ? group("disabled", { disabled: !0 }) : state ? group(`state:${state}`, { state }) : ranged ? group(`range:${min ?? 0}:${max ?? ""}`, { min: min ?? 0, max }) : groups.get("base");
1335
+ if ((disabled || state) && (ranged || disabled && state)) {
1323
1336
  groups.get("base").authored.set(token, authored);
1324
1337
  groups.get("base").classes.push(token);
1325
1338
  continue;
@@ -1359,6 +1372,8 @@ export function compileClassStyles(classes, variables, options = {}) {
1359
1372
  const entry = { style: compiled.style, ...compiled.dark ? { dark: compiled.dark } : {} };
1360
1373
  if (layer.disabled)
1361
1374
  result.disabled = entry;
1375
+ else if (layer.state)
1376
+ (result.states ??= {})[layer.state] = entry;
1362
1377
  else
1363
1378
  responsive.push({ min: layer.min ?? 0, ...layer.max === void 0 ? {} : { max: layer.max }, ...entry });
1364
1379
  }
@@ -1416,7 +1431,17 @@ function compileLayer(classes, variables, options = {}) {
1416
1431
  originals.get(translated).add(original);
1417
1432
  return translated;
1418
1433
  }
1434
+ const dividers = [], dividerOriginals = new Map;
1419
1435
  for (const name of classes.split(/\s+/).filter(Boolean)) {
1436
+ const darkDivide = name.startsWith("dark:") ? name.slice(5) : name, border = divideAsBorder(darkDivide);
1437
+ if (border !== null) {
1438
+ const translated = border && `${name === darkDivide ? "" : "dark:"}${border}`;
1439
+ if (translated) {
1440
+ dividers.push(translated);
1441
+ dividerOriginals.set(translated, name);
1442
+ }
1443
+ continue;
1444
+ }
1420
1445
  const focused = /^(dark:)?(focus|focus-within):(dark:)?(.+)$/.exec(name), focusKey = focused?.[2] === "focus" ? "focus" : "focusWithin";
1421
1446
  if (focused && options[focusKey] && !(focused[1] && focused[3])) {
1422
1447
  const translated = `${focused[1] || focused[3] ? "dark:" : ""}${focused[4]}`, layer = focusLayers[focusKey];
@@ -1463,6 +1488,11 @@ function compileLayer(classes, variables, options = {}) {
1463
1488
  }
1464
1489
  const authoredUnknown = unknown.flatMap((name) => [...originals.get(name) ?? [name]]);
1465
1490
  result.unknown = [...new Set([...authoredUnknown.filter((name) => !/^line-clamp-\d+$/.test(name)), ...unsupported])];
1491
+ if (dividers.length) {
1492
+ const divided = compileLayer(dividers.join(" "), variables);
1493
+ result.divide = { style: divided.style, ...divided.dark ? { dark: divided.dark } : {} };
1494
+ result.unknown = [...new Set([...result.unknown, ...divided.unknown.map((name) => dividerOriginals.get(name) ?? name)])];
1495
+ }
1466
1496
  for (const key of ["focus", "focusWithin"]) {
1467
1497
  const layer = focusLayers[key];
1468
1498
  if (!layer.classes.length)
@@ -1,4 +1,16 @@
1
1
  import type { STXDocument, STXNode } from './ir';
2
+ /**
3
+ * The binding a `{{ }}`-templated string makes, or null when it has none.
4
+ *
5
+ * The server evaluates what it can of a web view's mustaches and leaves the
6
+ * rest (a client signal, a call the device answers) for the browser's
7
+ * runtime, which binds them in the page's text. A native screen has no text
8
+ * nodes for that runtime to find, so a leftover mustache is a binding here,
9
+ * the `:text` or `:placeholder` an author could have written: a single one is
10
+ * its expression, words around it are joined in, and null or undefined reads
11
+ * as nothing, as the browser shows it.
12
+ */
13
+ export declare function mustacheBinding(text: string): string | null;
2
14
  /**
3
15
  * Translate stx's rendered HTML into the native view IR.
4
16
  *
@@ -1,4 +1,5 @@
1
1
  import { ACCESSIBILITY_FIELDS, projectAccessibility } from "../accessibility.js";
2
+ import { applyStaticTextEntry } from "../text-entry.js";
2
3
  import { NATIVE_EVENT_NAMES as EVENT_NAMES } from "../event-names.js";
3
4
  import { NATIVE_BOOLEAN_PROPS, nativePropName } from "../prop-names.js";
4
5
  import { mapToNativeComponent } from "./component-mapping.js";
@@ -109,9 +110,28 @@ function decodeEntities(text) {
109
110
  return whole;
110
111
  });
111
112
  }
113
+ export function mustacheBinding(text) {
114
+ if (!text.includes("{{"))
115
+ return null;
116
+ const parts = [];
117
+ let last = 0;
118
+ for (const match of text.matchAll(/\{\{([\s\S]+?)\}\}/g)) {
119
+ if (match.index > last)
120
+ parts.push(JSON.stringify(text.slice(last, match.index)));
121
+ parts.push(`(${match[1].trim()})`);
122
+ last = match.index + match[0].length;
123
+ }
124
+ if (!parts.some((part) => part.startsWith("(")))
125
+ return null;
126
+ if (last < text.length)
127
+ parts.push(JSON.stringify(text.slice(last)));
128
+ if (parts.length === 1)
129
+ return parts[0].slice(1, -1);
130
+ return `[${parts.join(", ")}].map(__stxPart => __stxPart == null ? '' : __stxPart).join('')`;
131
+ }
112
132
  function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
113
133
  let variables = styleContext.inheritedVariables;
114
- const props = {}, events = {}, bindings = {};
134
+ const props = {}, events = {}, bindings = {}, fromMustaches = [];
115
135
  let classes = "", inline = {};
116
136
  for (const [rawName, value] of attributes) {
117
137
  const name = rawName.toLowerCase();
@@ -146,7 +166,13 @@ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
146
166
  props.key = value;
147
167
  continue;
148
168
  }
149
- const decoded = decodeEntities(value), prop = nativePropName(rawName);
169
+ const decoded = decodeEntities(value), templated = mustacheBinding(decoded);
170
+ if (templated) {
171
+ bindings[name] = templated;
172
+ fromMustaches.push(name);
173
+ continue;
174
+ }
175
+ const prop = nativePropName(rawName);
150
176
  if (decoded === "" && NATIVE_BOOLEAN_PROPS.has(prop)) {
151
177
  props[prop] = !0;
152
178
  continue;
@@ -161,7 +187,7 @@ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
161
187
  for (const name of new Set(compiledClasses?.unknown ?? []))
162
188
  diagnostics.push({ kind: "unknown-class", tag, name });
163
189
  const style = applyNativeLayoutDefaults({ ...compiledClasses?.style, ...inline });
164
- return { props, style, events, bindings, classes, inline };
190
+ return { props, style, events, bindings, classes, inline, templated: fromMustaches };
165
191
  }
166
192
  function inlineStyle(tag, css, diagnostics, context) {
167
193
  return parseNativeStyle(decodeEntities(css), (diagnostic) => diagnostics.push({ ...diagnostic, tag }), context);
@@ -261,7 +287,7 @@ export async function translateHtmlToIR(html, options = {}) {
261
287
  return openSvg(tag, attributes, parentFrame);
262
288
  const dropped = DROP_SUBTREE.has(tag) && !BOX_ONLY.has(tag), inheritedDrop = stack[stack.length - 1]?.dropped ?? !1;
263
289
  let variables = parentFrame?.variables ?? stylesheetVariables;
264
- const { props, style, events, bindings, classes, inline } = dropped || inheritedDrop ? { props: {}, style: {}, events: {}, bindings: {}, classes: "", inline: {} } : readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
290
+ const { props, style, events, bindings, classes, inline, templated } = dropped || inheritedDrop ? { props: {}, style: {}, events: {}, bindings: {}, classes: "", inline: {}, templated: [] } : readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
265
291
  variables = value;
266
292
  }, rules: stylesheetRules });
267
293
  if (tag === "html")
@@ -338,6 +364,8 @@ export async function translateHtmlToIR(html, options = {}) {
338
364
  node._classes = classes;
339
365
  if (Object.keys(bindings).length > 0)
340
366
  node.bindings = bindings;
367
+ if (templated.length > 0)
368
+ node._templated = templated;
341
369
  if (typeof props.key === "string") {
342
370
  node.key = props.key;
343
371
  delete props.key;
@@ -362,7 +390,7 @@ export async function translateHtmlToIR(html, options = {}) {
362
390
  return { tag, node: createNode("G", {}, {}, {}), svg: !0, dropped: !0, discard: !0, unwrap: !1 };
363
391
  }
364
392
  let variables = parent?.variables ?? stylesheetVariables;
365
- const { props, style, events, bindings, classes, inline } = readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
393
+ const { props, style, events, bindings, classes, inline, templated } = readAttributes(tag, attributes, diagnostics, { inheritedVariables: variables, onVariables: (value) => {
366
394
  variables = value;
367
395
  }, rules: stylesheetRules });
368
396
  if (type === "Svg") {
@@ -397,6 +425,8 @@ export async function translateHtmlToIR(html, options = {}) {
397
425
  node._classes = classes;
398
426
  if (Object.keys(bindings).length > 0)
399
427
  node.bindings = bindings;
428
+ if (templated.length > 0)
429
+ node._templated = templated;
400
430
  if (typeof props.key === "string") {
401
431
  node.key = props.key;
402
432
  delete props.key;
@@ -443,11 +473,13 @@ export async function translateHtmlToIR(html, options = {}) {
443
473
  if (Object.keys(stylesheetRules).length)
444
474
  root._stylesheetRules = stylesheetRules;
445
475
  const project = (node) => {
476
+ bindMustaches(node);
446
477
  const projected = projectAccessibility(node.props);
447
478
  if (Object.keys(projected).length) {
448
479
  node._accessibilitySource = Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => (name in node.props)).map((name) => [name, node.props[name]]));
449
480
  Object.assign(node.props, projected);
450
481
  }
482
+ applyStaticTextEntry(node);
451
483
  for (const child of node.children)
452
484
  if (typeof child !== "string")
453
485
  project(child);
@@ -455,6 +487,25 @@ export async function translateHtmlToIR(html, options = {}) {
455
487
  project(root);
456
488
  return { root, diagnostics };
457
489
  }
490
+ function bindMustaches(node) {
491
+ if (node.bindings?.text || node.children.length === 0 || !node.children.every((child) => typeof child === "string"))
492
+ return;
493
+ const expression = mustacheBinding(node.children.join(""));
494
+ if (!expression)
495
+ return;
496
+ if (node.type !== "Button") {
497
+ node.bindings = { ...node.bindings, text: expression };
498
+ node._templated = [...node._templated ?? [], "text"];
499
+ node.children = [];
500
+ } else {
501
+ node.type = "Pressable";
502
+ node.props.role ??= "button";
503
+ const label = createNode("Text", {}, {}, {}, []);
504
+ label.bindings = { text: expression };
505
+ label._templated = ["text"];
506
+ node.children = [label];
507
+ }
508
+ }
458
509
  export async function translateHtmlToDocument(html, options = {}) {
459
510
  const { root, diagnostics } = await translateHtmlToIR(html, options), script = options.script ?? { exports: {}, functions: [], code: "" };
460
511
  return {
@@ -87,6 +87,7 @@ const STYLE_KEYS = new Set([
87
87
  "textDecorationColor",
88
88
  "textTransform",
89
89
  "resizeMode",
90
+ "objectFit",
90
91
  "tintColor",
91
92
  "transform",
92
93
  "overflow",
@@ -267,6 +268,18 @@ function parseEntries(entries, variables, report) {
267
268
  }
268
269
  if (value === "")
269
270
  continue;
271
+ if (property === "objectFit") {
272
+ const fit = typeof value === "string" ? value.trim().toLowerCase() : "";
273
+ if (fit === "cover" || fit === "contain")
274
+ style.resizeMode = fit;
275
+ else if (fit === "fill")
276
+ style.resizeMode = "stretch";
277
+ else if (fit === "none")
278
+ style.resizeMode = "center";
279
+ else
280
+ report({ kind: "unknown-style", name: `objectFit:${String(value)}` });
281
+ continue;
282
+ }
270
283
  let translated;
271
284
  if (NUMERIC_STYLE_KEYS.has(property) || DIMENSION_STYLE_KEYS.has(property)) {
272
285
  translated = numericValue(value);
@@ -12,6 +12,7 @@ export declare interface STXNode {
12
12
  key?: string
13
13
  props: Record<string, unknown>
14
14
  _accessibilitySource?: Record<string, unknown>
15
+ _textEntrySource?: Record<string, unknown>
15
16
  style: STXStyle
16
17
  events: Record<string, string>
17
18
  bindings?: Record<string, string>
@@ -24,6 +25,7 @@ export declare interface STXNode {
24
25
  _stylesheetTheme?: NativeStylesheetTheme
25
26
  _stylesheetRules?: NativeStylesheetRules
26
27
  _classes?: string
28
+ _templated?: string[]
27
29
  _source?: {
28
30
  file: string
29
31
  line: number