@stacksjs/stx 0.2.400 → 0.2.401
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appearance-bootstrap.d.ts +30 -2
- package/dist/appearance-bootstrap.js +26 -17
- package/dist/{chunk-mt0j29hr.js → chunk-0fwecpfm.js} +1 -1
- package/dist/{chunk-d6q7cv8w.js → chunk-0nqcv7z7.js} +1 -1
- package/dist/{chunk-2t41acdt.js → chunk-160zge7a.js} +1 -1
- package/dist/{chunk-3xpws4kd.js → chunk-19kj26z3.js} +1 -1
- package/dist/{chunk-6wcfe0s5.js → chunk-1nj174s0.js} +1 -1
- package/dist/{chunk-b3b3s1kr.js → chunk-1rskz446.js} +1 -1
- package/dist/{chunk-h1qtbdfs.js → chunk-1s9jswhp.js} +1 -1
- package/dist/{chunk-q25qsg28.js → chunk-21dz636m.js} +1 -1
- package/dist/{chunk-18qyx80g.js → chunk-2m88psbh.js} +1 -1
- package/dist/{chunk-b4d5pbhs.js → chunk-2x9gpv2d.js} +1 -1
- package/dist/{chunk-vd7thynz.js → chunk-3t17hkar.js} +1 -1
- package/dist/{chunk-1h9rc1jm.js → chunk-3wsrhb1a.js} +1 -1
- package/dist/{chunk-nvpjt609.js → chunk-3znzj20j.js} +1 -1
- package/dist/{chunk-ymkv623c.js → chunk-45etne17.js} +1 -1
- package/dist/{chunk-83ewzshg.js → chunk-61cwdy7h.js} +1 -1
- package/dist/{chunk-06h5zrm2.js → chunk-7bym5kky.js} +8 -8
- package/dist/{chunk-wjzcggh6.js → chunk-7c8r36ve.js} +1 -1
- package/dist/{chunk-27wgfqs0.js → chunk-8kkqx4sc.js} +1 -1
- package/dist/{chunk-awz5cx5w.js → chunk-8xm3z6dh.js} +1 -1
- package/dist/{chunk-es5qfybg.js → chunk-8ywzw4h9.js} +1 -1
- package/dist/{chunk-dzaf7qx8.js → chunk-bf6zcjr5.js} +1 -1
- package/dist/{chunk-x04ktd35.js → chunk-bgy4hwh4.js} +1 -1
- package/dist/{chunk-wva3ggqj.js → chunk-btn4481e.js} +1 -1
- package/dist/{chunk-zm92mg10.js → chunk-ch2aycnm.js} +1 -1
- package/dist/{chunk-x5z3r1d9.js → chunk-cmnve329.js} +1 -1
- package/dist/{chunk-4bnv6c6t.js → chunk-ef3y864p.js} +1 -1
- package/dist/{chunk-dazf77tr.js → chunk-epzm35py.js} +1 -1
- package/dist/{chunk-eqtc6w4a.js → chunk-h7sgg3vh.js} +1 -1
- package/dist/{chunk-rswsrggp.js → chunk-hh8abhtc.js} +1 -1
- package/dist/{chunk-vs3zfaxp.js → chunk-k9t7pyb8.js} +1 -1
- package/dist/{chunk-h4nydbnx.js → chunk-kfhm9vh1.js} +2 -2
- package/dist/{chunk-m4q3nsch.js → chunk-kxxph6d4.js} +1 -1
- package/dist/{chunk-1bvm3byf.js → chunk-mgndzdqy.js} +1 -1
- package/dist/{chunk-3818kp2d.js → chunk-nm7jfzmz.js} +2 -2
- package/dist/{chunk-gjpq3pmz.js → chunk-pm8wzxsb.js} +1 -1
- package/dist/{chunk-rem5ne21.js → chunk-pqc4sv02.js} +2 -2
- package/dist/{chunk-8gwby0r0.js → chunk-q4v62yed.js} +80 -21
- package/dist/{chunk-3ey6ha6w.js → chunk-r0jqyxbc.js} +1 -1
- package/dist/{chunk-0tak2f33.js → chunk-re9rv45k.js} +1 -1
- package/dist/{chunk-1f8kqg6a.js → chunk-s4yq7q1d.js} +1 -1
- package/dist/{chunk-74ebps1a.js → chunk-twws9vvz.js} +1 -1
- package/dist/{chunk-yc3x3rmf.js → chunk-vyn2y774.js} +1 -1
- package/dist/{chunk-ej2mb0t3.js → chunk-w680bfze.js} +1 -1
- package/dist/{chunk-126tkba9.js → chunk-waz1sddd.js} +1 -1
- package/dist/{chunk-38an983e.js → chunk-wdszjnbp.js} +1 -1
- package/dist/{chunk-nrgcfg8h.js → chunk-wmqhn6rq.js} +1 -1
- package/dist/{chunk-xs7f8h2r.js → chunk-x3h04mgd.js} +1 -1
- package/dist/{chunk-1qbj1kz4.js → chunk-y5gyez1p.js} +1 -1
- package/dist/{chunk-4tpsw999.js → chunk-zfs01pjr.js} +1 -1
- package/dist/{chunk-6am7e1be.js → chunk-zstrcmbj.js} +19 -19
- package/dist/cli.js +8 -8
- package/dist/color-mode-boot.d.ts +20 -0
- package/dist/color-mode-boot.js +5 -3
- package/dist/composables/use-color-mode.d.ts +1 -0
- package/dist/composables/use-color-mode.js +9 -5
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/script-validation.js +1 -1
- package/dist/signals.js +80 -21
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
import{Ka as a,Ke as F,Me as v,Ne as P,Ya as r,ge as s,he as t,o as m,qb as n,ra as l,rb as p,tb as i,zb as e}from"./chunk-
|
|
3
|
+
import{Ka as a,Ke as F,Me as v,Ne as P,Ya as r,ge as s,he as t,o as m,qb as n,ra as l,rb as p,tb as i,zb as e}from"./chunk-7bym5kky.js";import"./chunk-re9rv45k.js";import"./chunk-pkspqh0m.js";import"./chunk-61cwdy7h.js";import"./chunk-wmqhn6rq.js";import"./chunk-bf6zcjr5.js";import"./chunk-ewxbx67c.js";import"./chunk-kdwbpcm4.js";import"./chunk-fsvkqeya.js";import"./chunk-980w4zcq.js";import"./chunk-epzm35py.js";import"./chunk-nm7jfzmz.js";import"./chunk-g64qyhhb.js";import"./chunk-9vwpf0bk.js";import"./chunk-pm8wzxsb.js";import"./chunk-k2nydt80.js";import"./chunk-x86qttwm.js";import"./chunk-6rzwef28.js";import"./chunk-683tfkz4.js";import"./chunk-9r2xgf5k.js";import"./chunk-9368t9jm.js";import"./chunk-st9vrfw7.js";import"./chunk-mwh3ymwc.js";import"./chunk-r0jqyxbc.js";import"./chunk-1t5vwavd.js";import"./chunk-cks5rbzt.js";import"./chunk-092qw0ps.js";import"./chunk-kpg48dhw.js";import"./chunk-4bb28mz5.js";import"./chunk-90zfg77v.js";import"./chunk-8kkqx4sc.js";import"./chunk-452k8psm.js";import"./chunk-45etne17.js";import"./chunk-q4v62yed.js";import"./chunk-mnk5mdwp.js";import"./chunk-8xm3z6dh.js";import"./chunk-pqc4sv02.js";import"./chunk-gtn2agxa.js";import"./chunk-7eea1cse.js";import{el as u,fl as c}from"./chunk-21dz636m.js";import"./chunk-h7sgg3vh.js";import"./chunk-2andsajh.js";import"./chunk-zstrcmbj.js";import{ns as f}from"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import{Rs as A}from"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import{$w as B}from"./chunk-rxz43r6k.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.401";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>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 d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>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 V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
|
|
4
4
|
Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.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(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.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(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-5zmppe0c.js");if(x==="list"){console.log(`
|
|
5
5
|
\uD83D\uDCDA Fetching available icon collections...
|
|
6
6
|
`);let j=await z(),W=Object.entries(j).sort((H,U)=>U[1].total-H[1].total);console.log(`Available collections:
|
|
7
7
|
`);for(let[H,U]of W){let Y=U;console.log(` ${H.padEnd(30)} ${Y.name} (${Y.total} icons)`)}console.log(`
|
|
8
8
|
Total: ${W.length} collections`)}else if(x.startsWith("generate")){let j=x==="generate"?"":x.replace("generate:","").replace("generate-","").replace("generate","").trim();if(!j)console.error("Error: Please specify a collection prefix"),console.error("Usage: stx iconify generate <prefix> [--icons icon1,icon2,...]"),w.exit(1);let W=b.output||$.join(w.cwd(),"packages/collections"),H=b.icons?b.icons.split(",").map((U)=>U.trim()):void 0;await k(j,W,H),console.log(`
|
|
9
9
|
\u2713 Package generated successfully!`),console.log(`
|
|
10
|
-
To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.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(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-cd6pe75s.js"),{loadConfig:j}=await import("./chunk-
|
|
10
|
+
To use the package:`),console.log(` 1. cd packages/collections/iconify-${j}`),console.log(" 2. bun install"),console.log(" 3. bun run build")}else console.error(`Unknown iconify command: ${x}`),console.error("Available commands: list, generate"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.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(x,b)=>{try{if(x==="audit"){let{runPwaAudit:z,formatAuditResult:k}=await import("./chunk-cd6pe75s.js"),{loadConfig:j}=await import("./chunk-8ywzw4h9.js");console.log(`
|
|
11
11
|
\uD83D\uDD0D Running PWA audit...
|
|
12
12
|
`);let W=await j(),H=b.output||"dist",U=z(W,H);if(console.log(k(U)),U.failed>0)w.exit(1)}else console.error(`Unknown pwa command: ${x}`),console.error("Available commands: audit"),w.exit(1)}catch(z){console.error("Error:",z instanceof Error?z.message:String(z)),w.exit(1)}}),E.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(x,b)=>{try{if(b.port!==void 0){let k=h(b.port);if(!k.isValid)S(k);b.port=Number.parseInt(String(b.port),10)}if(b.timeout!==void 0){let k=y(b.timeout);if(!k.isValid)S(k)}let z={syntaxHighlighting:{enabled:b.highlight!==!1,serverSide:!0,defaultTheme:b.highlightTheme||"github-dark",highlightUnknownLanguages:b.highlightUnknown!==!1}};if(!x){if(!await P(".",{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}if(!V(x))try{let k=await import("fs");if(k.existsSync(x)&&k.statSync(x).isDirectory()){if(!await P(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,cache:b.cache!==!1,hotReload:b.hmr!==!1,profile:b.profile===!0,debugDirectives:b.debugDirectives===!0,...b.pages&&{pagesDir:b.pages}}))w.exit(1);return}}catch{}if(V(x)){console.log(`Expanding glob pattern: ${x}`);let k=await A.timeAsync("glob-expansion",async()=>{return Array.fromAsync(new Bun.Glob(x).scan({onlyFiles:!0,absolute:!0}))}),j=x.endsWith(".stx")?k.filter((Y)=>Y.endsWith(".stx")):x.endsWith(".md")?k.filter((Y)=>Y.endsWith(".md")):k.filter((Y)=>Y.endsWith(".stx")||Y.endsWith(".md"));if(j.length===0)console.error(`No STX or Markdown files found matching pattern: ${x}`),console.error("Try using patterns like '*.stx' or 'components/**/*.stx'"),w.exit(1);let W=x.split("*")[0].replace(/\/$/,"")||".",H=$.resolve(W);try{let Y=new Bun.Glob("**/*.stx"),X=(await Array.fromAsync(Y.scan({cwd:H,onlyFiles:!0,absolute:!0}))).filter((_)=>/\[.+\]/.test($.basename(_)));for(let _ of X)if(!j.includes(_))j.push(_)}catch{}if(console.log(`Found ${j.length} ${j.length===1?"file":"files"} matching ${x}`),!await v(j,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}else{if(!V(x)){let j=d(x);if(!j.isValid)S(j)}if(!await F(x,{port:b.port,watch:b.watch!==!1,native:b.native||b.titlebarHidden||!1,titlebarHidden:b.titlebarHidden===!0,markdown:z,cache:b.cache!==!1}))w.exit(1)}}catch(z){console.error("Error starting dev server:",z),w.exit(1)}}),E.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(x=".",b)=>{try{console.log(`Scanning ${x} for accessibility issues...`);let z=b.ignore?b.ignore.split(",").map((U)=>U.trim()):[],{results:k,scannedFiles:j}=await f(x,{recursive:b.recursive!==!1,ignorePaths:z});if(j.length===0)console.log(`
|
|
13
13
|
No .stx files matched ${x}
|
|
@@ -69,7 +69,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
69
69
|
File not found: ${x}`),w.exit(1);if(!x.endsWith(".stx"))console.error(`
|
|
70
70
|
File must have .stx extension: ${x}`),w.exit(1)}let k=$.resolve(b.pages),j=$.resolve(b.out);if(!x&&!L.existsSync(k))console.error(`
|
|
71
71
|
Pages directory not found: ${k}`),console.log(`
|
|
72
|
-
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-
|
|
72
|
+
Create a 'pages' directory with .stx files, or use --pages to specify a different directory.`),w.exit(1);let{buildApp:W}=await import("./chunk-kxxph6d4.js");c();let H=await W({root:x?$.dirname(x):void 0,debug:b.verbose,ssg:{pagesDir:b.pages,outputDir:b.out,domain:b.domain,baseUrl:b.base,sitemap:b.sitemap,rss:b.rss,minify:b.minify,cache:b.cache!==!1,cleanOutput:b.clean,concurrency:Number.parseInt(b.concurrency,10)||10,publicDir:b.public,trailingSlash:b.trailingSlash,generate404:!0,hooks:b.verbose?{onPageStart:(Y)=>console.log(` Generating: ${Y}`),onPageEnd:(Y,Q)=>console.log(` Generated: ${Y} (${Q.length} bytes)`),onError:(Y,Q)=>console.error(` Error in ${Q}: ${Y.message}`)}:void 0},ssr:{outputDir:b.out==="dist"?".output":b.out,debug:b.verbose}}),U=((performance.now()-z)/1000).toFixed(2);if(H.mode==="ssr"&&H.ssr)console.log(`
|
|
73
73
|
Build complete! (SSR)
|
|
74
74
|
`),console.log(` Pages compiled: ${H.ssr.pageCount}`),console.log(` Output: ${H.ssr.outputDir}`),console.log(` Duration: ${U}s
|
|
75
75
|
`);else if(H.ssg){if(console.log(`
|
|
@@ -84,7 +84,7 @@ Total: ${H} issues in ${W} files`),b.output){let U=`
|
|
|
84
84
|
Build completed with ${H.ssg.failedCount} error(s). Fix the issues above and try again.
|
|
85
85
|
`),w.exit(1);console.log(" To preview locally:"),console.log(` cd ${b.out||"dist"} && npx serve
|
|
86
86
|
`)}}catch(z){console.error(`
|
|
87
|
-
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.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(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-
|
|
87
|
+
Build failed:`,z instanceof Error?z.message:String(z)),w.exit(1)}}),E.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(x)=>{try{let b=$.resolve(x.output);if(!L.existsSync($.join(b,"manifest.json")))console.error("\n No production build found. Run `stx build --out .output` first.\n"),w.exit(1);let{startProductionServer:z}=await import("./chunk-vyn2y774.js");await z({outputDir:b,port:Number.parseInt(x.port,10)||3000})}catch(b){console.error(`
|
|
88
88
|
Failed to start production server:`,b instanceof Error?b.message:String(b)),w.exit(1)}}),E.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(x,b)=>{try{let{deploy:z,initNetlify:k,DeployError:j}=await import("./chunk-r1d9x0dy.js");if(console.log(`\x1B[1mstx deploy\x1B[0m \x1B[2mv${N}\x1B[0m`),b.init){console.log(`
|
|
89
89
|
\uD83D\uDCDD Initializing Netlify configuration...
|
|
90
90
|
`);let H=await k({directory:x||w.cwd(),siteId:b.siteId});if(console.log(`\u2713 Created ${H.configPath}`),H.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 ${x}
|
|
|
124
124
|
\uD83D\uDCDD ${$.relative(w.cwd(),Q)}:`),console.log("--- Original"),console.log("+++ Formatted"),console.log(`@@ Changes in ${$.basename(Q)} @@`),console.log("+ Formatted content would be applied");else await Bun.write(Q,q),console.log(`\u2705 Formatted ${$.relative(w.cwd(),Q)}`),U++}catch(X){console.error(`\u274C Error formatting ${$.relative(w.cwd(),Q)}:`,X),Y++}if(b.check&&Y>0)console.log(`
|
|
125
125
|
${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.check&&!b.diff)console.log(`\u2728 Formatted ${U} files successfully`)}catch(z){console.error("Error formatting files:",z),w.exit(1)}}),E.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(x,b)=>{try{if(b.clear){A.clear(),console.log("\u2705 Performance statistics cleared");return}let z=A.getStats();if(Object.keys(z).length===0){if(b.json){console.log(JSON.stringify({},null,2));return}console.log("No performance data available. Run some STX commands first.");return}if(b.json)console.log(JSON.stringify(z,null,2));else{console.log(`
|
|
126
126
|
\uD83D\uDCCA STX Performance Statistics
|
|
127
|
-
`);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.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(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-
|
|
127
|
+
`);for(let[k,j]of Object.entries(z))console.log(`\uD83D\uDD27 ${k}:`),console.log(` Count: ${j.count}`),console.log(` Average: ${j.avgTime.toFixed(2)}ms`),console.log(` Total: ${j.totalTime.toFixed(2)}ms`),console.log(` Min: ${j.minTime.toFixed(2)}ms`),console.log(` Max: ${j.maxTime.toFixed(2)}ms`),console.log("")}}catch(z){console.error("Error showing performance stats:",z),w.exit(1)}}),E.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(x,b)=>{let{formatTypecheckDiagnostics:z,typecheckStxFiles:k}=await import("./chunk-ch2aycnm.js"),{resolveStxTargets:j}=await import("./chunk-7vnkqnyh.js"),W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx"],U=await j(H);if(U.length===0){console.log(`
|
|
128
128
|
No .stx files matched ${H.join(", ")}
|
|
129
129
|
`);return}let Y=m(w.argv,"--lib"),Q=Y.length>0?Y:b.lib?Array.isArray(b.lib)?b.lib:[b.lib]:[],X=await k(U,{client:b.client!==!1,server:b.server!==!1,templates:b.templates!==!1,extraLibs:Q});if(X.failure)console.error(`
|
|
130
130
|
Type-check did not run.
|
|
@@ -136,7 +136,7 @@ ${Y} files need formatting. Run 'stx format' to fix.`),w.exit(1);else if(!b.chec
|
|
|
136
136
|
${z(X.diagnostics)}
|
|
137
137
|
`);if(console.log(` Checked ${X.blockCount} script block(s) and ${X.expressionCount} template expression(s) in ${X.checkedFiles.length} file(s) \u2014 `+`${_.length} error(s), ${X.diagnostics.length-_.length} warning(s)
|
|
138
138
|
`),_.length>0)w.exit(1)}),E.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(x,b)=>{let{codemodSource:z,formatCodemodFindings:k}=await import("./chunk-76q768gt.js"),j=globalThis.Bun.Glob,W=Array.isArray(x)?x:x?[x]:[],H=W.length?W:["**/*.stx","**/*.ts"],U=b.rule?[b.rule]:void 0;if(b.rule&&b.rule!=="confirm"&&b.rule!=="tooltip")console.error(`Unknown rule "${b.rule}". Expected: confirm | tooltip`),w.exit(1);let Y=new Set,Q=[],X=0,_=new Set;try{let q=Bun.spawnSync(["git","ls-files","--others","--ignored","--exclude-standard","-z"],{cwd:w.cwd(),stdout:"pipe",stderr:"pipe"});for(let O of new TextDecoder().decode(q.stdout).split("\x00"))if(O)_.add($.resolve(w.cwd(),O))}catch{}for(let q of H)for await(let O of new j(q).scan({cwd:w.cwd(),absolute:!0})){if(O.includes("/node_modules/")||O.includes("/dist/")||Y.has(O)||_.has(O))continue;Y.add(O);let M=await Bun.file(O).text(),G=z(M,{file:O,rules:U});if(Q.push(...G.findings),b.fix&&G.code!==M)await Bun.write(O,G.code),X++}if(console.error(k(Q,Boolean(b.fix))),b.fix)console.error(`
|
|
139
|
-
${X} file(s) written.`)}),E.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(x)=>{try{let b;try{b=(await import("./chunk-
|
|
139
|
+
${X} file(s) written.`)}),E.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(x)=>{try{let b;try{b=(await import("./chunk-mgndzdqy.js")).generateSignalsRuntime}catch{b=void 0}let z=await s({generateRuntime:b});if(x.json)console.log(JSON.stringify(z,null,2));else console.log(t(z));if(!z.ok)w.exit(1)}catch(b){console.error("Error running doctor:",b),w.exit(1)}}),E.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(x,b)=>{try{let z=d(x);if(!z.isValid)S(z);console.log(`\uD83D\uDD0D Debugging stx template: ${x}
|
|
140
140
|
`);let k={};if(b.context)try{k=JSON.parse(b.context)}catch(H){console.error("\u274C Invalid JSON in --context option"),w.exit(1)}let j=await Bun.file(x).text();console.log(`\uD83D\uDCC4 Template Content (${j.length} chars):`),console.log("\u2500".repeat(50)),console.log(j.substring(0,500)+(j.length>500?`
|
|
141
141
|
...
|
|
142
142
|
`:"")),console.log("\u2500".repeat(50));let W=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(W)console.log(`
|
|
@@ -160,11 +160,11 @@ Press Ctrl+C to stop watching...
|
|
|
160
160
|
\uD83D\uDCC4 Files with issues:`),Y.forEach((Q)=>{let X=Q.issues.filter((_)=>j[_.type]>=W).length;if(X>0)console.log(` ${$.relative(w.cwd(),Q.file)} (${X} issues)`)});if(b.saveReport){let Q={summary:U,results:Y,generatedAt:new Date().toISOString(),commandOptions:b};await Bun.write(b.saveReport,JSON.stringify(Q,null,2)),console.log(`
|
|
161
161
|
\uD83D\uDCCB Analysis report saved to: ${b.saveReport}`)}console.log(`
|
|
162
162
|
\u2728 Analysis complete! Use --detailed for more information.`)}catch(z){console.error("Error analyzing templates:",z),w.exit(1)}}),E.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(x,b)=>{let{captureScreenshots:z}=await import("./chunk-w4nmvn5v.js"),k=x||"dist";try{let j=await z(k,b.out,{width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),waitMs:Number.parseInt(b.wait,10),timeoutMs:Number.parseInt(b.timeout,10),fullPage:Boolean(b.fullPage),waitSelector:b.waitSelector,format:b.format,backend:b.backend});for(let W of j)console.log(`\uD83D\uDCF8 ${W.output} (${(W.bytes/1024).toFixed(0)} KB)`);console.log(`
|
|
163
|
-
\u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.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(x)=>{let{startInteractive:b}=await import("./chunk-
|
|
163
|
+
\u2728 Captured ${j.length} screenshot(s) to ${b.out}/ via Bun WebView`)}catch(j){console.error(`Screenshot failed: ${j.message}`),w.exit(1)}}),E.command("version","Show the version of the CLI").action(()=>{console.log(N)}),E.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(x)=>{let{startInteractive:b}=await import("./chunk-3t17hkar.js"),z={};if(x.context){let k=$.resolve(x.context);if(L.existsSync(k))try{let j=L.readFileSync(k,"utf-8");z=JSON.parse(j)}catch(j){console.error("Error loading context file:",j),w.exit(1)}else console.error(`Context file not found: ${k}`),w.exit(1)}await b({context:z,cwd:x.cwd?$.resolve(x.cwd):w.cwd(),verbose:x.verbose})}),E.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(x,b)=>{try{let{buildNative:z,getAvailableTargets:k,getAvailableFormats:j}=await import("./chunk-160zge7a.js"),W=$.resolve(x);if(!L.existsSync(W))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let H=k();if(b.target&&!["macos","windows","linux","ios","android"].includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error("\uD83D\uDCA1 Available targets: macos, windows, linux, ios, android"),console.error(`\uD83D\uDCA1 Targets available on this machine: ${H.join(", ")}`),w.exit(1);let U=b.target||H[0],Y=j(U);if(b.format&&!Y.includes(b.format))console.error(`\u274C Invalid format for ${U}: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${Y.join(", ")}`),w.exit(1);console.log(`
|
|
164
164
|
\uD83D\uDD28 Building native app...`),console.log(` Input: ${x}`),console.log(` Target: ${U}`),console.log(` Format: ${b.format||"default"}`),console.log(` Output: ${b.output}
|
|
165
165
|
`);let Q=await z({input:W,output:$.resolve(b.output),target:U,format:b.format,name:b.name,version:b.version,description:b.description,author:b.author,bundleId:b.bundleId,icon:b.icon?$.resolve(b.icon):void 0,window:{title:b.title,width:Number.parseInt(b.width,10),height:Number.parseInt(b.height,10),frameless:b.frameless,alwaysOnTop:b.alwaysOnTop},systemTray:b.systemTray,menubarOnly:b.menubarOnly,category:b.category,copyright:b.copyright,minimumSystemVersion:b.minSystemVersion,infoPlist:kb(b.infoPlist),devTools:b.devTools,craftPath:b.craftPath,verbose:b.verbose});if(Q.success){if(console.log("\u2705 Build successful!"),console.log(` Output: ${Q.outputPath}`),Q.duration)console.log(` Duration: ${(Q.duration/1000).toFixed(2)}s`);if(U==="macos"&&Q.format==="app")console.log(`
|
|
166
166
|
\uD83D\uDCA1 To run: open "${Q.outputPath}"`);else if(U==="linux"&&Q.format==="appimage")console.log(`
|
|
167
|
-
\uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.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(x)=>{try{let{devCommand:b}=await import("./chunk-
|
|
167
|
+
\uD83D\uDCA1 To run: chmod +x "${Q.outputPath}" && "${Q.outputPath}"`)}else console.error(`\u274C Build failed: ${Q.error}`),w.exit(1)}catch(z){console.error(`\u274C Build error: ${z.message}`),w.exit(1)}}),E.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(x)=>{try{let{devCommand:b}=await import("./chunk-kfhm9vh1.js");await b({port:x.port?Number.parseInt(x.port,10):6006,open:x.open,host:x.host})}catch(b){console.error(`\u274C Story error: ${b.message}`),w.exit(1)}}),E.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(x)=>{try{let{buildCommand:b}=await import("./chunk-zh3q10wd.js");await b({outDir:x.outDir})}catch(b){console.error(`\u274C Story build error: ${b.message}`),w.exit(1)}}),E.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(x)=>{try{let{createContext:b}=await import("./chunk-8qzc5n61.js"),{runVisualTests:z,updateSnapshots:k,formatTestResults:j}=await import("./chunk-h01bbt3r.js"),W=await b({mode:"build"});if(x.update){let H=await k(W,{filter:x.filter?[x.filter]:void 0});console.log(`Updated ${H} snapshots`)}else{let H=await z(W,{filter:x.filter?[x.filter]:void 0});if(console.log(j(H)),H.failed>0)w.exit(1)}}catch(b){console.error(`\u274C Story test error: ${b.message}`),w.exit(1)}}),E.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(x,b)=>{try{let{compileToNative:z}=await import("./chunk-ar5stjnb.js"),k=$.resolve(x);if(!L.existsSync(k))console.error(`\u274C Input file not found: ${x}`),w.exit(1);let j=["macos","windows","linux","ios","android","universal"];if(!j.includes(b.target))console.error(`\u274C Invalid target: ${b.target}`),console.error(`\uD83D\uDCA1 Available targets: ${j.join(", ")}`),w.exit(1);let W=["zig","typescript","json"];if(!W.includes(b.format))console.error(`\u274C Invalid format: ${b.format}`),console.error(`\uD83D\uDCA1 Available formats: ${W.join(", ")}`),w.exit(1);console.log(`
|
|
168
168
|
\uD83D\uDD27 Compiling stx template to native code...`),console.log(` Input: ${x}`),console.log(` Target: ${b.target}`),console.log(` Format: ${b.format}`),console.log(` Output: ${b.output}
|
|
169
169
|
`);let H=L.readFileSync(k,"utf-8"),U=await z(H,{target:b.target,format:b.format,optimize:b.optimize,treeShake:b.treeShake,hotReload:b.hotReload,debug:b.verbose,sourceMaps:b.sourcemaps,bundle:b.bundle,minify:b.minify}),Y=$.resolve(b.output);if(!L.existsSync(Y))L.mkdirSync(Y,{recursive:!0});let Q=$.basename(x,$.extname(x)),X=b.format==="typescript"?"ts":b.format==="json"?"json":"zig",_=$.join(Y,`${Q}.${X}`);L.writeFileSync(_,U.code);let q=$.join(Y,`${Q}.manifest.json`);if(L.writeFileSync(q,JSON.stringify(U.manifest,null,2)),b.sourcemaps&&U.sourceMaps){let O=$.join(Y,`${Q}.${X}.map`);L.writeFileSync(O,U.sourceMaps)}if(b.target==="universal"&&U.platformCode.size>0)for(let[O,M]of U.platformCode){let G=$.join(Y,`${Q}.${O}.${X}`);L.writeFileSync(G,M)}if(console.log("\u2705 Compilation successful!"),console.log(` Output: ${_}`),console.log(` Manifest: ${q}`),console.log(`
|
|
170
170
|
\uD83D\uDCCA Statistics:`),console.log(` Compilation time: ${U.stats.compilationTime.toFixed(2)}ms`),console.log(` Total components: ${U.stats.totalComponents}`),console.log(` Native components: ${U.stats.nativeComponents}`),console.log(` Web fallback components: ${U.stats.webComponents}`),console.log(` Bundle size: ${(U.stats.bundleSize/1024).toFixed(2)}KB`),U.stats.warnings.length>0){console.log(`
|
|
@@ -35,6 +35,26 @@ export interface ColorModeBootConfig {
|
|
|
35
35
|
* key to `'auto'`. @default whatever is stored, else 'auto'
|
|
36
36
|
*/
|
|
37
37
|
autoValue?: ColorModeBootAutoValue;
|
|
38
|
+
/**
|
|
39
|
+
* Leave `attribute` alone when it already carries a concrete mode, and
|
|
40
|
+
* render that instead of the visitor's stored preference. @default false
|
|
41
|
+
*
|
|
42
|
+
* For a page whose theme is not the visitor's to choose: a public status
|
|
43
|
+
* page whose owner forces light or dark for everyone, stamped server-side
|
|
44
|
+
* during render. Without this the boot script computes from storage and
|
|
45
|
+
* stamps unconditionally, so a visitor who had browsed in dark saw the
|
|
46
|
+
* forced-light page in dark (stacksjs/stx#2050).
|
|
47
|
+
*
|
|
48
|
+
* Only `'light'` and `'dark'` count as concrete. `'auto'` and `'system'`
|
|
49
|
+
* are instructions to resolve, not answers, so they are ignored here and
|
|
50
|
+
* the stored preference wins as usual.
|
|
51
|
+
*
|
|
52
|
+
* The adopted value is published as `forced` on the boot global, because
|
|
53
|
+
* once this script has stamped the attribute nothing downstream can tell a
|
|
54
|
+
* forced value from a computed one by looking at the DOM. `useColorMode`
|
|
55
|
+
* reads it and renders it over its own resolution.
|
|
56
|
+
*/
|
|
57
|
+
respectExisting?: boolean;
|
|
38
58
|
}
|
|
39
59
|
/**
|
|
40
60
|
* Build the synchronous pre-paint `<script>`.
|
package/dist/color-mode-boot.js
CHANGED
|
@@ -2,7 +2,7 @@ import { headInsertionPoint } from "./head-injection.js";
|
|
|
2
2
|
export const COLOR_MODE_BOOT_MARKER = "data-stx-color-mode-boot", COLOR_MODE_BOOT_GLOBAL = "__STX_COLOR_MODE__";
|
|
3
3
|
const MODES = new Set(["light", "dark", "auto", "system"]), AUTO_VALUES = new Set(["auto", "system"]), ATTRIBUTE_PATTERN = /^[a-z][\w:-]*$/i, CLASS_PATTERN = /^[\w-]+$/;
|
|
4
4
|
function resolveConfig(options) {
|
|
5
|
-
const storageKey = options.storageKey ?? "stx-color-mode", rawInitial = options.initialMode ?? "auto", darkClass = options.darkClass === void 0 ? "dark" : options.darkClass, attribute = options.attribute ?? null, autoValue = options.autoValue ?? null;
|
|
5
|
+
const storageKey = options.storageKey ?? "stx-color-mode", rawInitial = options.initialMode ?? "auto", darkClass = options.darkClass === void 0 ? "dark" : options.darkClass, attribute = options.attribute ?? null, autoValue = options.autoValue ?? null, respectExisting = options.respectExisting === !0;
|
|
6
6
|
if (typeof storageKey !== "string" || storageKey.length === 0)
|
|
7
7
|
throw Error("colorMode.storageKey must be a non-empty string");
|
|
8
8
|
if (!MODES.has(rawInitial))
|
|
@@ -15,13 +15,15 @@ function resolveConfig(options) {
|
|
|
15
15
|
throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(autoValue)}`);
|
|
16
16
|
if (darkClass === null && attribute === null)
|
|
17
17
|
throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");
|
|
18
|
-
|
|
18
|
+
if (respectExisting && attribute === null)
|
|
19
|
+
throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");
|
|
20
|
+
return { storageKey, initialMode: rawInitial === "system" ? "auto" : rawInitial, darkClass, attribute, autoValue, respectExisting };
|
|
19
21
|
}
|
|
20
22
|
function serializeForScript(value) {
|
|
21
23
|
return JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
22
24
|
}
|
|
23
25
|
export function generateColorModeBootScript(options = {}) {
|
|
24
|
-
const config = resolveConfig(options), body = `(function(){"use strict";var c=${serializeForScript(config)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}
|
|
26
|
+
const config = resolveConfig(options), body = `(function(){"use strict";var c=${serializeForScript(config)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var r=document.documentElement;var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f;if(!m){m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}}if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${COLOR_MODE_BOOT_GLOBAL}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m}}catch(e){}}());`;
|
|
25
27
|
return `<script ${COLOR_MODE_BOOT_MARKER}>${body}</script>`;
|
|
26
28
|
}
|
|
27
29
|
export function injectColorModeBootScript(html, options = {}) {
|
|
@@ -21,8 +21,12 @@ export function useColorMode(options = {}) {
|
|
|
21
21
|
darkClass = pick(void 0, boot?.darkClass, "dark"),
|
|
22
22
|
attribute = pick(void 0, boot?.attribute, null),
|
|
23
23
|
autoValue: autoValueOption = boot?.autoValue,
|
|
24
|
-
disableTransitions = !0
|
|
25
|
-
|
|
24
|
+
disableTransitions = !0,
|
|
25
|
+
respectExisting = !1
|
|
26
|
+
} = options, bootForced = boot?.forced, forcedMode = (respectExisting || boot?.respectExisting === !0) && (bootForced === "light" || bootForced === "dark") ? bootForced : null;
|
|
27
|
+
function effective(pref) {
|
|
28
|
+
return forcedMode ?? resolve(pref);
|
|
29
|
+
}
|
|
26
30
|
let preference = normalizeColorMode(initialMode) ?? "auto", resolved = "light";
|
|
27
31
|
const listeners = new Set, cleanups = [], isBrowser = typeof window < "u";
|
|
28
32
|
function getSystemPreference() {
|
|
@@ -71,7 +75,7 @@ export function useColorMode(options = {}) {
|
|
|
71
75
|
}
|
|
72
76
|
function update(pref, persistChoice = !0) {
|
|
73
77
|
preference = normalizeColorMode(pref) ?? "auto";
|
|
74
|
-
resolved =
|
|
78
|
+
resolved = effective(preference);
|
|
75
79
|
applyToDOM(resolved);
|
|
76
80
|
if (persistChoice)
|
|
77
81
|
persist(preference);
|
|
@@ -81,7 +85,7 @@ export function useColorMode(options = {}) {
|
|
|
81
85
|
if (isBrowser) {
|
|
82
86
|
const mql = window.matchMedia("(prefers-color-scheme: dark)"), onSystemChange = () => {
|
|
83
87
|
if (preference === "auto") {
|
|
84
|
-
resolved = getSystemPreference();
|
|
88
|
+
resolved = forcedMode ?? getSystemPreference();
|
|
85
89
|
applyToDOM(resolved);
|
|
86
90
|
listeners.forEach((fn) => fn(resolved, preference));
|
|
87
91
|
}
|
|
@@ -96,7 +100,7 @@ export function useColorMode(options = {}) {
|
|
|
96
100
|
if (v === "auto" && e.newValue && AUTO_VALUES.includes(e.newValue))
|
|
97
101
|
autoValue = e.newValue;
|
|
98
102
|
preference = v;
|
|
99
|
-
resolved =
|
|
103
|
+
resolved = effective(v);
|
|
100
104
|
applyToDOM(resolved);
|
|
101
105
|
listeners.forEach((fn) => fn(resolved, preference));
|
|
102
106
|
}
|
package/dist/craft-entry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$j as Nj,ak as wj,bk as Aj}from"./chunk-m3s6kzxv.js";import{dk as Uj,ek as Xj,fk as Yj,gk as Zj,hk as _j,ik as $j,jk as qj,kk as Fj,lk as Oj,mk as Vj,nk as Ij,ok as Qj,pk as Wj,qk as Kj}from"./chunk-
|
|
2
|
+
import{$j as Nj,ak as wj,bk as Aj}from"./chunk-m3s6kzxv.js";import{dk as Uj,ek as Xj,fk as Yj,gk as Zj,hk as _j,ik as $j,jk as qj,kk as Fj,lk as Oj,mk as Vj,nk as Ij,ok as Qj,pk as Wj,qk as Kj}from"./chunk-hh8abhtc.js";import"./chunk-pqc4sv02.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|
package/dist/craft.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$j as Nj,ak as wj,bk as Aj}from"./chunk-m3s6kzxv.js";import{dk as Uj,ek as Xj,fk as Yj,gk as Zj,hk as _j,ik as $j,jk as qj,kk as Fj,lk as Oj,mk as Vj,nk as Ij,ok as Qj,pk as Wj,qk as Kj}from"./chunk-
|
|
2
|
+
import{$j as Nj,ak as wj,bk as Aj}from"./chunk-m3s6kzxv.js";import{dk as Uj,ek as Xj,fk as Yj,gk as Zj,hk as _j,ik as $j,jk as qj,kk as Fj,lk as Oj,mk as Vj,nk as Ij,ok as Qj,pk as Wj,qk as Kj}from"./chunk-hh8abhtc.js";import"./chunk-pqc4sv02.js";import"./chunk-zstrcmbj.js";import"./chunk-4cv7bw5e.js";import"./chunk-7tgjn256.js";import"./chunk-h8zp2fz9.js";import"./chunk-ekvejzvk.js";import"./chunk-3769e62c.js";import"./chunk-7c8r36ve.js";import"./chunk-yj5gkn17.js";import"./chunk-cy8hgd86.js";import"./chunk-twws9vvz.js";import"./chunk-g7qmxjyc.js";import"./chunk-88tt0qg0.js";import"./chunk-e1rv01pn.js";import"./chunk-bdz7nznw.js";import"./chunk-rwtj7j0r.js";import"./chunk-eqhsprr0.js";import"./chunk-csgshaeh.js";import"./chunk-d0qy1ezf.js";import"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import"./chunk-rxz43r6k.js";var I=new Map,Q=new Map;function L(j,B){let G=B?.id||g(j),J=h(j),U=I.get(G);if(U&&U.hash===J)return U;let X=S(j),Z=y(j),Y=T(j),_=v(X),{staticParts:q,dynamicParts:$}=C(X),F=u(j),O={id:G,hash:J,tree:X,scripts:Z,styles:Y,staticParts:q,dynamicParts:$,dependencies:F,metadata:_};return I.set(G,O),O}async function r(j,B={},G={}){let J=performance.now();if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`,_=Q.get(Y);if(_&&Date.now()-_.timestamp<(G.cacheTTL||60000))return{html:_.html,styles:j.styles.join(`
|
|
3
3
|
`),scripts:j.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:_.html.length,componentCount:j.metadata.componentCount}}}let U;if(G.streaming)U=await H(j.tree,B);else U=W(j.tree,B);let X;if(G.hydrate){let Y=k(U,j,B);U=Y.html,X=Y.data}if(G.minify)U=x(U);if(G.cache){let Y=`${j.id}:${JSON.stringify(B)}`;Q.set(Y,{html:U,timestamp:Date.now()})}let Z=performance.now()-J;return{html:U,styles:j.styles.join(`
|
|
5
5
|
`),scripts:j.scripts.join(`
|
package/dist/pwa.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Jk as wq,Kk as dq,Lk as Cq,Mk as mq,Nk as gq}from"./chunk-fj6fbqgb.js";import{$k as Mq,Ok as S,Pk as Tq,Qk as _q,Rk as z,Sk as D,Tk as P,Uk as kq,Vk as vq,Wk as w,Xk as Iq,Yk as d,Zk as Hq,_k as Oq}from"./chunk-8ded3tn8.js";import{Ow as Aq,Pw as bq,Qw as Sq,Rw as zq,Sw as Dq,Tw as Pq}from"./chunk-c9kj8p6j.js";import"./chunk-x2wmn8m7.js";import{$w as N}from"./chunk-rxz43r6k.js";import p from"fs";import E from"path";import C from"fs";import L from"path";var k=[72,96,128,144,152,192,384,512],v=[120,152,167,180],I=[16,32];async function H(G,B){let q={success:!0,generatedFiles:[],errors:[],warnings:[]},K=G.pwa?.icons;if(!K?.src)return q.errors.push("No source icon specified in pwa.icons.src"),q.success=!1,q;let Y=L.isAbsolute(K.src)?K.src:L.resolve(process.cwd(),K.src);if(!await Bun.file(Y).exists())return q.errors.push(`Source icon not found: ${Y}`),q.success=!1,q;let Q=L.resolve(B,K.outputDir||"pwa-icons");try{C.mkdirSync(Q,{recursive:!0})}catch{return q.errors.push(`Failed to create output directory: ${Q}`),q.success=!1,q}let X=K.sizes||k,j=K.generateWebP??!0,J=K.generateAppleIcons??!0;try{let y;try{y=await import("sharp")}catch{return q.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
3
|
-
Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-
|
|
3
|
+
Icon generation requires the sharp package for image processing.`),q.success=!1,q}let R=await y.default(Y).metadata();if(R.width&&R.width<512)q.warnings.push(`Source icon is ${R.width}x${R.height}. Recommend using at least 512x512 for best quality.`);for(let $ of X){let x=L.join(Q,`icon-${$}x${$}.png`);if(await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x),j){let F=L.join(Q,`icon-${$}x${$}.webp`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(F),q.generatedFiles.push(F)}}if(J){for(let x of v){let F=L.join(Q,`apple-touch-icon-${x}x${x}.png`);await y.default(Y).resize(x,x,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(F),q.generatedFiles.push(F)}let $=L.join(Q,"apple-touch-icon.png");await y.default(Y).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile($),q.generatedFiles.push($)}for(let $ of I){let x=L.join(Q,`favicon-${$}x${$}.png`);await y.default(Y).resize($,$,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(x),q.generatedFiles.push(x)}let U=512,T=L.join(Q,`icon-maskable-${U}x${U}.png`),Z=Math.floor(U*0.1),_=U-Z*2;await y.default(Y).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:Z,bottom:Z,left:Z,right:Z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(T),q.generatedFiles.push(T)}catch(y){let V=y instanceof Error?y.message:String(y);q.errors.push(`Icon generation failed: ${V}`),q.success=!1}return q}function n(G){let B=G.sizes||k,q=G.outputDir?`/${G.outputDir}`:"/pwa-icons",K=G.generateWebP??!0,Y=G.generateAppleIcons??!0,Q=[];for(let X of B)if(Q.push(`${q}/icon-${X}x${X}.png`),K)Q.push(`${q}/icon-${X}x${X}.webp`);if(Y){Q.push(`${q}/apple-touch-icon.png`);for(let X of v)Q.push(`${q}/apple-touch-icon-${X}x${X}.png`)}for(let X of I)Q.push(`${q}/favicon-${X}x${X}.png`);return Q.push(`${q}/icon-maskable-512x512.png`),Q}async function O(){try{return await import("sharp"),!0}catch{return!1}}function m(G,B,q,K){let Y=[],Q=K.join(" ");for(let X of G)if(Y.push({src:`${B}/icon-${X}x${X}.png`,sizes:`${X}x${X}`,type:"image/png",purpose:Q}),q)Y.push({src:`${B}/icon-${X}x${X}.webp`,sizes:`${X}x${X}`,type:"image/webp",purpose:Q});return Y}function g(G){return G.map((B)=>({name:B.name,short_name:B.shortName,description:B.description,url:B.url,icons:B.icons?.map((q)=>({src:q.src,sizes:q.sizes,type:q.type}))}))}function h(G){let B=G.pwa?.shareTarget;if(!B?.enabled)return;let q={action:B.action||"/share",method:B.method||"POST",enctype:B.enctype||"multipart/form-data",params:{title:B.params?.title||"title",text:B.params?.text||"text",url:B.params?.url||"url"}};if(B.acceptFiles&&B.acceptFiles.length>0)q.params.files=B.acceptFiles.map((K)=>({name:K.name,accept:K.accept}));return q}function c(G){let B=G.pwa?.fileHandlers;if(!B?.enabled||!B.accept)return;let q=[{action:B.action||"/",accept:B.accept,launch_type:B.launchType||"single-client"}];if(B.icons)q[0].icons=B.icons.map((K)=>({src:K.src,sizes:K.sizes,type:K.type}));return q}function l(G){let B=G.pwa?.protocolHandlers;if(!B||B.length===0)return;return B.map((q)=>({protocol:q.protocol,url:q.url}))}function u(G){let B=G.pwa;if(!B?.enabled||!B.manifest)return null;let{manifest:q,icons:K}=B,Y=K?.sizes||[72,96,128,144,152,192,384,512],Q=K?.outputDir?`/${K.outputDir}`:"/pwa-icons",X=K?.generateWebP??!0,j=K?.purpose||["any","maskable"],J={name:q.name,short_name:q.shortName||q.name,description:q.description,start_url:q.startUrl||"/",display:q.display||"standalone",display_override:q.displayOverride,orientation:q.orientation,theme_color:q.themeColor,background_color:q.backgroundColor,scope:q.scope||"/",lang:q.lang,dir:q.dir,id:q.id,categories:q.categories,icons:m(Y,Q,X,j)};if(q.shortcuts&&q.shortcuts.length>0)J.shortcuts=g(q.shortcuts);if(q.screenshots&&q.screenshots.length>0)J.screenshots=q.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let y=h(G);if(y)J.share_target=y;let V=c(G);if(V)J.file_handlers=V;let R=l(G);if(R)J.protocol_handlers=R;if(q.launchHandler)J.launch_handler={client_mode:q.launchHandler};if(q.handleLinks)J.handle_links=q.handleLinks;if(q.edgeSidePanel?.enabled)J.edge_side_panel={preferred_width:q.edgeSidePanel.preferredWidth};return J}function M(G){let B=u(G);if(!B)return"";let q=JSON.parse(JSON.stringify(B));return JSON.stringify(q,null,2)}function i(G,B){return{...B,...G,shortcuts:G.shortcuts||B.shortcuts,screenshots:G.screenshots||B.screenshots,categories:G.categories||B.categories}}function s(G){let B=[],q=G.pwa;if(!q?.enabled)return B;let K=q.manifest;if(!K)return B.push("PWA manifest configuration is missing"),B;if(!K.name)B.push("Manifest name is required");let Y=["fullscreen","standalone","minimal-ui","browser"];if(K.display&&!Y.includes(K.display))B.push(`Invalid display mode: ${K.display}. Must be one of: ${Y.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(K.orientation&&!Q.includes(K.orientation))B.push(`Invalid orientation: ${K.orientation}`);let X=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(K.themeColor&&!X.test(K.themeColor))B.push(`Invalid theme color: ${K.themeColor}. Must be a valid hex color.`);if(K.backgroundColor&&!X.test(K.backgroundColor))B.push(`Invalid background color: ${K.backgroundColor}. Must be a valid hex color.`);if(q.shareTarget?.enabled){if(!q.shareTarget.action)B.push("Share target action URL is required")}if(q.fileHandlers?.enabled){if(!q.fileHandlers.accept||Object.keys(q.fileHandlers.accept).length===0)B.push("File handlers must specify accepted MIME types")}if(q.protocolHandlers)for(let j of q.protocolHandlers){if(!j.protocol)B.push("Protocol handler missing protocol");if(!j.url||!j.url.includes("%s"))B.push(`Protocol handler URL must contain %s placeholder: ${j.protocol}`)}return B}import A from"path";async function b(G){let B=G.pwa?.offline;if(!B?.enabled)return"";if(B.page){let q=A.isAbsolute(B.page)?B.page:A.resolve(process.cwd(),B.page);if(await Bun.file(q).exists())try{let{processDirectives:K}=await import("./chunk-k9t7pyb8.js"),Y=await Bun.file(q).text();return await K(Y,{},q,G,new Set)}catch(K){console.warn(`[PWA] Failed to process custom offline page: ${K}`)}else console.warn(`[PWA] Custom offline page not found: ${q}`)}return f(G)}function f(G){let B=G.pwa?.offline,q=G.pwa?.manifest,K=B?.fallbackTitle||"You are offline",Y=B?.fallbackMessage||"Please check your internet connection and try again.",Q=q?.themeColor||"#4f46e5",X=q?.shortName||q?.name||"App";return`<!DOCTYPE html>
|
|
4
4
|
<html lang="en">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -65,7 +65,7 @@ export const PROHIBITED_DOM_PATTERNS = [
|
|
|
65
65
|
{
|
|
66
66
|
pattern: /(?:\bwindow\.)?localStorage(?![A-Za-z])/g,
|
|
67
67
|
message: "window.localStorage is prohibited",
|
|
68
|
-
suggestion: "Use useLocalStorage() from composables \u2014 or
|
|
68
|
+
suggestion: "Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
71
|
pattern: /window\.sessionStorage(?![A-Za-z])/g,
|
package/dist/signals.js
CHANGED
|
@@ -137,7 +137,39 @@ console.log('[stx] entering IIFE');
|
|
|
137
137
|
anchor: function(label) { return document.createComment(label); },
|
|
138
138
|
clone: function(node) { return node.cloneNode(true); },
|
|
139
139
|
insert: function(parent, node, before) { parent.insertBefore(node, before); },
|
|
140
|
-
remove: function(node) { if (node.parentNode) node.parentNode.removeChild(node); }
|
|
140
|
+
remove: function(node) { if (node.parentNode) node.parentNode.removeChild(node); },
|
|
141
|
+
|
|
142
|
+
// Teardown needs to reach a subtree, and both ways of reaching one were
|
|
143
|
+
// selector queries -- the last DOM assumption left in the binding layer
|
|
144
|
+
// (#1984). A view hierarchy has no selectors, and a native host already
|
|
145
|
+
// knows what it built, so being asked is cheaper for it than searching is
|
|
146
|
+
// for the document.
|
|
147
|
+
//
|
|
148
|
+
// descendants() is every node under this one, for the per-node teardown
|
|
149
|
+
// state the runtime hangs off elements. scopesIn() is the scope IDS in the
|
|
150
|
+
// subtree, this node included -- ids and not nodes, because the only thing
|
|
151
|
+
// done with them is a lookup in window.stx._scopes.
|
|
152
|
+
descendants: function(node) {
|
|
153
|
+
var out = [];
|
|
154
|
+
if (!node || !node.querySelectorAll) return out;
|
|
155
|
+
var all = node.querySelectorAll('*');
|
|
156
|
+
for (var i = 0; i < all.length; i++) out.push(all[i]);
|
|
157
|
+
return out;
|
|
158
|
+
},
|
|
159
|
+
scopesIn: function(node) {
|
|
160
|
+
var ids = [];
|
|
161
|
+
if (!node) return ids;
|
|
162
|
+
var own = node.getAttribute && node.getAttribute('data-stx-scope');
|
|
163
|
+
if (own) ids.push(own);
|
|
164
|
+
if (node.querySelectorAll) {
|
|
165
|
+
var matches = node.querySelectorAll('[data-stx-scope]');
|
|
166
|
+
for (var i = 0; i < matches.length; i++) {
|
|
167
|
+
var id = matches[i].getAttribute('data-stx-scope');
|
|
168
|
+
if (id) ids.push(id);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return ids;
|
|
172
|
+
}
|
|
141
173
|
};
|
|
142
174
|
|
|
143
175
|
// Inject x-cloak CSS to prevent FOUC (Flash of Unstyled Content)
|
|
@@ -3058,6 +3090,28 @@ catch (e2) {
|
|
|
3058
3090
|
const value = attr.value;
|
|
3059
3091
|
if (!name) return;
|
|
3060
3092
|
|
|
3093
|
+
/*
|
|
3094
|
+
* A doubled colon escapes the prefix, the way a doubled at-sign does in
|
|
3095
|
+
* a directive: @@if renders @if, so ::foo renders :foo.
|
|
3096
|
+
*
|
|
3097
|
+
* It was excluded from the generic attribute path, which is why it was
|
|
3098
|
+
* never evaluated as an expression -- but a name beginning with two
|
|
3099
|
+
* colons also begins with one, so the event catch-all below claimed it,
|
|
3100
|
+
* registered a listener for an event named :foo, and removed the
|
|
3101
|
+
* attribute. The author got neither a binding nor their attribute: it
|
|
3102
|
+
* disappeared, silently, and nothing took its place.
|
|
3103
|
+
*
|
|
3104
|
+
* Unescaped here rather than on the server, because an unescaped :foo
|
|
3105
|
+
* reaching this pass is indistinguishable from one the author wrote and
|
|
3106
|
+
* would be bound as an event. The attributes were snapshotted before
|
|
3107
|
+
* this loop, so the one written now is not revisited.
|
|
3108
|
+
*/
|
|
3109
|
+
if (name.startsWith('::')) {
|
|
3110
|
+
el.removeAttribute(name);
|
|
3111
|
+
el.setAttribute(name.slice(1), value);
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3061
3115
|
// Dynamic attribute binding: @bind:attr, x-bind:attr, :attr, OR x-attr
|
|
3062
3116
|
// x-attr (e.g. x-class, x-style, x-href, x-src) is the canonical binding prefix.
|
|
3063
3117
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
@@ -5773,6 +5827,18 @@ else if (timer === null) {
|
|
|
5773
5827
|
var attribute = pick(options.attribute, fromBoot('attribute'), null);
|
|
5774
5828
|
var autoValueOption = pick(options.autoValue, fromBoot('autoValue'), undefined);
|
|
5775
5829
|
var disableTransitions = options.disableTransitions !== false;
|
|
5830
|
+
// A mode the page was served already stamped with, which outranks this
|
|
5831
|
+
// composable's own resolution: for a page whose theme is not the visitor's
|
|
5832
|
+
// to choose (stacksjs/stx#2050). Taken from the boot global's forced key
|
|
5833
|
+
// rather than by reading the attribute, because the boot script has
|
|
5834
|
+
// stamped it by now either way and the DOM can no longer say which it was.
|
|
5835
|
+
//
|
|
5836
|
+
// No backticks in this comment, or any other in this file: the runtime is
|
|
5837
|
+
// generated from a template literal, so one would end the literal and
|
|
5838
|
+
// break the whole emitted script.
|
|
5839
|
+
var respectExisting = options.respectExisting === true || fromBoot('respectExisting') === true;
|
|
5840
|
+
var bootForced = fromBoot('forced');
|
|
5841
|
+
var forcedMode = (respectExisting && (bootForced === 'light' || bootForced === 'dark')) ? bootForced : null;
|
|
5776
5842
|
var resolved = 'light';
|
|
5777
5843
|
var listeners = [];
|
|
5778
5844
|
var cleanups = [];
|
|
@@ -5792,6 +5858,9 @@ else if (timer === null) {
|
|
|
5792
5858
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
5793
5859
|
}
|
|
5794
5860
|
function resolve(pref) { return pref === 'auto' ? getSystem() : pref; }
|
|
5861
|
+
// Used wherever the resolved mode is assigned, so a forced page survives
|
|
5862
|
+
// a system-theme change and another tab's write, not just the first mount.
|
|
5863
|
+
function effective(pref) { return forcedMode || resolve(pref); }
|
|
5795
5864
|
function applyDOM(mode) {
|
|
5796
5865
|
var el = document.documentElement;
|
|
5797
5866
|
if (disableTransitions) el.style.setProperty('transition', 'none', 'important');
|
|
@@ -5824,7 +5893,7 @@ catch (e) {} }
|
|
|
5824
5893
|
// composable didn't recognise, destroying it.
|
|
5825
5894
|
function update(pref, persistChoice) {
|
|
5826
5895
|
preference = normalizeMode(pref) || 'auto';
|
|
5827
|
-
resolved =
|
|
5896
|
+
resolved = effective(preference);
|
|
5828
5897
|
applyDOM(resolved);
|
|
5829
5898
|
if (persistChoice !== false) persist(preference);
|
|
5830
5899
|
listeners.forEach(function(fn) { fn(resolved, preference); });
|
|
@@ -5835,7 +5904,7 @@ catch (e) {} }
|
|
|
5835
5904
|
var mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
5836
5905
|
var onSystemChange = function() {
|
|
5837
5906
|
if (preference === 'auto') {
|
|
5838
|
-
resolved = getSystem();
|
|
5907
|
+
resolved = forcedMode || getSystem();
|
|
5839
5908
|
applyDOM(resolved);
|
|
5840
5909
|
listeners.forEach(function(fn) { fn(resolved, preference); });
|
|
5841
5910
|
}
|
|
@@ -5850,7 +5919,7 @@ catch (e) {} }
|
|
|
5850
5919
|
// Track the other tab's spelling too, so a write from here doesn't
|
|
5851
5920
|
// convert the key out from under it.
|
|
5852
5921
|
if (v === 'auto' && (e.newValue === 'auto' || e.newValue === 'system')) autoValue = e.newValue;
|
|
5853
|
-
preference = v; resolved =
|
|
5922
|
+
preference = v; resolved = effective(v); applyDOM(resolved);
|
|
5854
5923
|
listeners.forEach(function(fn) { fn(resolved, preference); });
|
|
5855
5924
|
}
|
|
5856
5925
|
};
|
|
@@ -8527,11 +8596,7 @@ catch (e) {
|
|
|
8527
8596
|
// Descendants first, then the root, the order cleanupContainer always used.
|
|
8528
8597
|
function disposeSubtreeEffects(root) {
|
|
8529
8598
|
if (!root) return;
|
|
8530
|
-
var nodes =
|
|
8531
|
-
if (root.querySelectorAll) {
|
|
8532
|
-
var all = root.querySelectorAll('*');
|
|
8533
|
-
for (var i = 0; i < all.length; i++) nodes.push(all[i]);
|
|
8534
|
-
}
|
|
8599
|
+
var nodes = stxHost.descendants(root);
|
|
8535
8600
|
nodes.push(root);
|
|
8536
8601
|
var owned = ['__stx_disposers', '__stx_effect_disposers', '__stx_if_disposers', '__stx_chain_disposers'];
|
|
8537
8602
|
for (var n = 0; n < nodes.length; n++) {
|
|
@@ -8565,18 +8630,12 @@ catch (e) {
|
|
|
8565
8630
|
|
|
8566
8631
|
function disposeSubtreeScopes(root) {
|
|
8567
8632
|
if (!root || !window.stx || !window.stx._scopes) return;
|
|
8568
|
-
//
|
|
8569
|
-
//
|
|
8570
|
-
//
|
|
8571
|
-
var
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
var matches = root.querySelectorAll('[data-stx-scope]');
|
|
8575
|
-
for (var i = 0; i < matches.length; i++) nodes.push(matches[i]);
|
|
8576
|
-
}
|
|
8577
|
-
for (var n = 0; n < nodes.length; n++) {
|
|
8578
|
-
var el = nodes[n];
|
|
8579
|
-
var scopeId = el.getAttribute('data-stx-scope');
|
|
8633
|
+
// The host reports which scopes live in this subtree: the document finds
|
|
8634
|
+
// them with a selector, a native host reads the map it keeps as it builds
|
|
8635
|
+
// views (#1984).
|
|
8636
|
+
var scopeIds = stxHost.scopesIn(root);
|
|
8637
|
+
for (var n = 0; n < scopeIds.length; n++) {
|
|
8638
|
+
var scopeId = scopeIds[n];
|
|
8580
8639
|
if (!scopeId) continue;
|
|
8581
8640
|
var scopeVars = window.stx._scopes[scopeId];
|
|
8582
8641
|
if (!scopeVars) continue;
|