@stacksjs/stx 0.2.182 → 0.2.183

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.
@@ -33,5 +33,13 @@ export declare const IconBuiltin: BuiltinComponentDef;
33
33
  /**
34
34
  * Pre-load icon collections so they're available synchronously during render.
35
35
  * Call this before template processing starts.
36
+ *
37
+ * Silent when the collection is not installed. Callers preload on the chance a
38
+ * template wants it, so an absent collection here is a normal outcome and not
39
+ * a problem to report; the render path still says so if a template actually
40
+ * asks for one that is missing. Pass `speculative: false` when the caller knows
41
+ * the collection is required.
36
42
  */
37
- export declare function preloadIconCollection(prefix?: string): Promise<void>;
43
+ export declare function preloadIconCollection(prefix?: string, options?: {
44
+ speculative?: boolean;
45
+ }): Promise<void>;
@@ -42,12 +42,13 @@ function loadCollectionSync(prefix) {
42
42
  return null;
43
43
  }
44
44
  }
45
- async function loadCollection(prefix) {
45
+ async function loadCollection(prefix, speculative = !1) {
46
46
  if (collectionCache.has(prefix))
47
47
  return collectionCache.get(prefix);
48
48
  const jsonPath = resolveCollectionPath(prefix);
49
49
  if (!jsonPath) {
50
- warnMissingCollection(prefix);
50
+ if (!speculative)
51
+ warnMissingCollection(prefix);
51
52
  return null;
52
53
  }
53
54
  try {
@@ -94,6 +95,6 @@ export const IconBuiltin = {
94
95
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="${viewBox}" fill="none"${classAttr}${styleAttr}>${body}</svg>`;
95
96
  }
96
97
  };
97
- export async function preloadIconCollection(prefix = "lucide") {
98
- await loadCollection(prefix);
98
+ export async function preloadIconCollection(prefix = "lucide", options = {}) {
99
+ await loadCollection(prefix, options.speculative ?? !0);
99
100
  }
package/dist/cli.js CHANGED
@@ -3820,7 +3820,7 @@ ${S}
3820
3820
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3821
3821
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3822
3822
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3823
- </style>`}}});import{existsSync as Xu,readFileSync as Zu}from"fs";function dF($){if(mF.has($))return;mF.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function cF($){let X=process.cwd();for(let Z of[`${X}/node_modules/@iconify-json/${$}/icons.json`,`${X}/pantry/@iconify-json/${$}/icons.json`,`${X}/node_modules/@iconify/json/json/${$}.json`,`${X}/pantry/@iconify/json/json/${$}.json`])if(Xu(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Y0.resolve(Z)}catch{}return null}function Ju($){if(p6.has($))return p6.get($);let X=cF($);if(!X)return dF($),null;try{let Z=JSON.parse(Zu(X,"utf8"));return p6.set($,Z.icons),Z.icons}catch{return null}}async function Yu($){if(p6.has($))return p6.get($);let X=cF($);if(!X)return dF($),null;try{let Z=await Bun.file(X).json();return p6.set($,Z.icons),Z.icons}catch{return null}}function z5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);if($.static[X]!==void 0)return String($.static[X]);if($.clientReactive[X]!==void 0)return $.clientReactive[X];return}async function tK($="lucide"){await Yu($)}var p6,mF,oK;var eK=D(()=>{p6=new Map,mF=new Set;oK={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=z5($,"name")??z5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let F=J.split(":");Y=F[0],Q=F[1]}let G=_1(z5($,"size")||"24"),K=_1(z5($,"color")||"currentColor"),W=_1(z5($,"class")||""),U=_1(z5($,"style")||""),z=p6.get(Y)??Ju(Y);if(!z)return`<!-- Icon: collection "${Y}" not loaded -->`;let q=z[Q];if(!q)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let j=q.width||24,_=q.height||24,H=`0 0 ${j} ${_}`,L=q.body;if(K!=="currentColor")L=L.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",B=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${H}" fill="none"${O}${B}>${L}</svg>`}}});function $W(){return`
3823
+ </style>`}}});import{existsSync as Xu,readFileSync as Zu}from"fs";function dF($){if(mF.has($))return;mF.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function cF($){let X=process.cwd();for(let Z of[`${X}/node_modules/@iconify-json/${$}/icons.json`,`${X}/pantry/@iconify-json/${$}/icons.json`,`${X}/node_modules/@iconify/json/json/${$}.json`,`${X}/pantry/@iconify/json/json/${$}.json`])if(Xu(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Y0.resolve(Z)}catch{}return null}function Ju($){if(p6.has($))return p6.get($);let X=cF($);if(!X)return dF($),null;try{let Z=JSON.parse(Zu(X,"utf8"));return p6.set($,Z.icons),Z.icons}catch{return null}}async function Yu($,X=!1){if(p6.has($))return p6.get($);let Z=cF($);if(!Z){if(!X)dF($);return null}try{let J=await Bun.file(Z).json();return p6.set($,J.icons),J.icons}catch{return null}}function z5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);if($.static[X]!==void 0)return String($.static[X]);if($.clientReactive[X]!==void 0)return $.clientReactive[X];return}async function tK($="lucide",X={}){await Yu($,X.speculative??!0)}var p6,mF,oK;var eK=D(()=>{p6=new Map,mF=new Set;oK={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=z5($,"name")??z5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let F=J.split(":");Y=F[0],Q=F[1]}let G=_1(z5($,"size")||"24"),K=_1(z5($,"color")||"currentColor"),W=_1(z5($,"class")||""),U=_1(z5($,"style")||""),z=p6.get(Y)??Ju(Y);if(!z)return`<!-- Icon: collection "${Y}" not loaded -->`;let q=z[Q];if(!q)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let j=q.width||24,_=q.height||24,H=`0 0 ${j} ${_}`,L=q.body;if(K!=="currentColor")L=L.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",B=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${H}" fill="none"${O}${B}>${L}</svg>`}}});function $W(){return`
3824
3824
  (function(){
3825
3825
  var tip=null,hideTimer=null,currentEl=null;
3826
3826
 
@@ -27305,7 +27305,7 @@ else {
27305
27305
  `)}function ax($,X){let Z=" ".repeat(X),J=[];for(let[K,W]of Object.entries($.props))if(W.type==="literal"){let U=typeof W.value==="string"?`"${W.value}"`:String(W.value);J.push(`${K}: ${U}`)}let Y=J.length>0?`{ ${J.join(", ")} }`:"{}",Q=$.children.map((K)=>K.type==="text"?`"${K.props.text?.type==="literal"?K.props.text.value:""}"`:ax(K,X+1)),G=Q.length>0?`,
27306
27306
  ${Z} [${Q.join(`,
27307
27307
  ${Z} `)}]`:"";return`Craft.create("${$.zigType}", ${Y}${G})`}function v10($,X,Z){if(X.target==="universal"){let J=[];J.push("// Universal entry point"),J.push("");for(let[Y,Q]of Z)J.push(`// --- ${Y.toUpperCase()} ---`),J.push(`#if ${Y.toUpperCase()}`),J.push(Q),J.push("#endif"),J.push("");return J.join(`
27308
- `)}return Z.get(X.target)||KL($,X)}function f10($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:ox(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)Y(G)}return Y(X),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function g10($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function sx(){return`id_${++h10}`}function ox($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return Math.abs(X).toString(36)}function u10($){return $.charAt(0).toUpperCase()+$.slice(1)}function m10($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function d10($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function WL($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=WL(Z);return X}function UL($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=UL(Z);return X}function tx($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(X)=>{console.log(`[craft-compiler] File changed: ${X}`)}}}var zL,h10=0,c10,l10;var $v=D(()=>{zL=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);c10={compileToNative:lx,createHotReloadServer:tx,NATIVE_COMPONENTS:zL},l10=c10});import{spawn as Jv}from"child_process";import t0 from"fs";import p10 from"os";import K0 from"path";import g from"process";import{CLI as i10}from"@stacksjs/clapp";var I6="0.2.182";I8();yH();Sj();hj();h4();vj();Nj();b6();RH();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",C0=new i10("stx");function Xv($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(X<1024||X>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 Zv($){try{if(!t0.existsSync($)){let Z=K0.dirname($),J=K0.basename($);if(t0.existsSync(Z)){let Q=t0.readdirSync(Z).filter((K)=>K.toLowerCase().includes(J.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Z}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Z} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(t0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(X){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function qL($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(X<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(X>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 a7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),n10=($)=>$.endsWith(".stx")||$.endsWith(".md");function r7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);g.exit(X)}function r10($){if(!$)return;let X;try{X=JSON.parse($)}catch(Z){console.error(`\u274C --info-plist is not valid JSON: ${Z.message}`),g.exit(1)}if(typeof X!=="object"||X===null||Array.isArray(X))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),g.exit(1);for(let[Z,J]of Object.entries(X))if(typeof J!=="string"&&typeof J!=="number"&&typeof J!=="boolean")console.error(`\u274C --info-plist value for "${Z}" must be a string, number or boolean`),g.exit(1);return X}async function a10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(a7(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(J.push(...U),X.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else J.push(W);if(J.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Z.push(...J),X.filter)Z.push("--pattern",X.filter);if(X.timeout)Z.push("--timeout",X.timeout.toString());if(X.reporter&&X.reporter!=="default")if(X.reporter==="junit"){let W=K0.join(p10.tmpdir(),`stx-test-report-${Date.now()}.xml`);Z.push("--reporter",X.reporter),Z.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${X.reporter}' is not supported. Using default reporter.`);if(X.coverage)Z.push("--coverage");if(X.watch)Z.push("--watch");Z.push("--preload",K0.join(__dirname,"../../../test-utils/happy-dom.ts"));let Y={...g.env,STX_TEST_MODE:"true",STX_TEST_UI:X.ui?"true":"false",STX_TEST_VERBOSE:X.verbose?"true":"false"},Q="bun";if(X.verbose)console.log(`Running: ${Q} ${Z.join(" ")}`);let G=performance.now(),K=Jv(Q,Z,{stdio:"inherit",shell:!1,env:Y});return new Promise((W)=>{K.on("close",(U)=>{let q=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),g.on("SIGINT",()=>{console.log(`
27308
+ `)}return Z.get(X.target)||KL($,X)}function f10($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:ox(JSON.stringify(Q.props)),props:Object.keys(Q.props),events:Array.from(Q.events.keys()),slots:[],isNative:Q.zigType.startsWith("craft.")});for(let G of Q.children)Y(G)}return Y(X),{version:"1.0.0",components:J,entry:$.id,assets:[],styles:$.styles}}function g10($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function sx(){return`id_${++h10}`}function ox($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return Math.abs(X).toString(36)}function u10($){return $.charAt(0).toUpperCase()+$.slice(1)}function m10($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function d10($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function WL($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=WL(Z);return X}function UL($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=UL(Z);return X}function tx($){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(X)=>{console.log(`[craft-compiler] File changed: ${X}`)}}}var zL,h10=0,c10,l10;var $v=D(()=>{zL=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);c10={compileToNative:lx,createHotReloadServer:tx,NATIVE_COMPONENTS:zL},l10=c10});import{spawn as Jv}from"child_process";import t0 from"fs";import p10 from"os";import K0 from"path";import g from"process";import{CLI as i10}from"@stacksjs/clapp";var I6="0.2.183";I8();yH();Sj();hj();h4();vj();Nj();b6();RH();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",C0=new i10("stx");function Xv($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(X<1024||X>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 Zv($){try{if(!t0.existsSync($)){let Z=K0.dirname($),J=K0.basename($);if(t0.existsSync(Z)){let Q=t0.readdirSync(Z).filter((K)=>K.toLowerCase().includes(J.toLowerCase().substring(0,3))||K.endsWith(".stx")||K.endsWith(".md")),G=Q.length>0?`File not found. Similar files in ${Z}: ${Q.slice(0,3).join(", ")}`:`File not found. Directory ${Z} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${$}`,suggestion:G}}return{isValid:!1,error:`File does not exist: ${$}`,suggestion:"Check the file path and try again"}}if(t0.statSync($).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${$}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(X){return{isValid:!1,error:`Cannot access file: ${$}`,suggestion:"Check file permissions and path"}}}function qL($){let X=typeof $==="string"?Number.parseInt($,10):$;if(Number.isNaN(X))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(X<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(X>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 a7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),n10=($)=>$.endsWith(".stx")||$.endsWith(".md");function r7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);g.exit(X)}function r10($){if(!$)return;let X;try{X=JSON.parse($)}catch(Z){console.error(`\u274C --info-plist is not valid JSON: ${Z.message}`),g.exit(1)}if(typeof X!=="object"||X===null||Array.isArray(X))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),g.exit(1);for(let[Z,J]of Object.entries(X))if(typeof J!=="string"&&typeof J!=="number"&&typeof J!=="boolean")console.error(`\u274C --info-plist value for "${Z}" must be a string, number or boolean`),g.exit(1);return X}async function a10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(a7(W))try{let U=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(U.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(J.push(...U),X.verbose)console.log(`Found ${U.length} file(s) matching pattern: ${W}`)}catch(U){return console.error(`Error expanding glob pattern ${W}:`,U),!1}else J.push(W);if(J.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(Z.push(...J),X.filter)Z.push("--pattern",X.filter);if(X.timeout)Z.push("--timeout",X.timeout.toString());if(X.reporter&&X.reporter!=="default")if(X.reporter==="junit"){let W=K0.join(p10.tmpdir(),`stx-test-report-${Date.now()}.xml`);Z.push("--reporter",X.reporter),Z.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${X.reporter}' is not supported. Using default reporter.`);if(X.coverage)Z.push("--coverage");if(X.watch)Z.push("--watch");Z.push("--preload",K0.join(__dirname,"../../../test-utils/happy-dom.ts"));let Y={...g.env,STX_TEST_MODE:"true",STX_TEST_UI:X.ui?"true":"false",STX_TEST_VERBOSE:X.verbose?"true":"false"},Q="bun";if(X.verbose)console.log(`Running: ${Q} ${Z.join(" ")}`);let G=performance.now(),K=Jv(Q,Z,{stdio:"inherit",shell:!1,env:Y});return new Promise((W)=>{K.on("close",(U)=>{let q=((performance.now()-G)/1000).toFixed(2);if(U===0)W(!0);else W(!1)}),g.on("SIGINT",()=>{console.log(`
27309
27309
  Test run interrupted`),K.kill("SIGINT"),g.exit(1)})})}catch(Z){return console.error("Error running tests:",Z instanceof Error?Z.message:String(Z)),!1}}var s10=g.argv.length>=3&&(n10(g.argv[2])&&t0.existsSync(g.argv[2])||a7(g.argv[2]));if(s10){let $=g.argv[2],X={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let Z=3;Z<g.argv.length;Z++){let J=g.argv[Z];if(J==="--port"&&Z+1<g.argv.length){let Y=Xv(g.argv[++Z]);if(!Y.isValid)r7(Y);X.port=Number.parseInt(g.argv[Z],10)}else if(J==="--no-watch")X.watch=!1;else if(J==="--highlight-theme"&&Z+1<g.argv.length){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.defaultTheme=g.argv[++Z]}else if(J==="--no-highlight"){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.enabled=!1}else if(J==="--no-highlight-unknown"){if(!X.markdown)X.markdown={};if(!X.markdown.syntaxHighlighting)X.markdown.syntaxHighlighting={};X.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(J==="--no-cache")X.cache=!1;else if(J==="--native")X.native=!0}if(a7($))try{let Z=await Array.fromAsync(new Bun.Glob($).scan({onlyFiles:!0,absolute:!0})),J=$.endsWith(".stx")?Z.filter((K)=>K.endsWith(".stx")):$.endsWith(".md")?Z.filter((K)=>K.endsWith(".md")):Z.filter((K)=>K.endsWith(".stx")||K.endsWith(".md")),Y=$.split("*")[0].replace(/\/$/,"")||".",Q=K0.resolve(Y);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((z)=>/\[.+\]/.test(K0.basename(z)));for(let z of U)if(!J.includes(z))J.push(z)}catch{}if(J.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${$}`),g.exit(1);if(!await bZ(J,X))g.exit(1)}catch(Z){console.error("Failed to process files:",Z),g.exit(1)}else PZ($,X).catch((Z)=>{console.error("Failed to start dev server:",Z),g.exit(1)})}else{let $=function(J,Y){let Q=[];for(let G=0;G<=Y.length;G++)Q[G]=[G];for(let G=0;G<=J.length;G++)Q[0][G]=G;for(let G=1;G<=Y.length;G++)for(let K=1;K<=J.length;K++)if(Y.charAt(G-1)===J.charAt(K-1))Q[G][K]=Q[G-1][K-1];else Q[G][K]=Math.min(Q[G-1][K-1]+1,Q[G][K-1]+1,Q[G-1][K]+1);return Q[Y.length][J.length]};C0.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(J)=>{try{if(await kj(J))console.log("Documentation generated successfully."),g.exit(0);else console.error("Documentation generation failed."),g.exit(1)}catch(Y){console.error("Error generating documentation:",Y),g.exit(1)}}),C0.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(J,Y)=>{try{let{fetchCollections:Q,generatePackage:G}=await Promise.resolve().then(() => (eb(),tb));if(J==="list"){console.log(`
27310
27310
  \uD83D\uDCDA Fetching available icon collections...
27311
27311
  `);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections: