@stacksjs/stx 0.2.173 → 0.2.174
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/cli.js +9 -2
- package/dist/craft.js +8 -1
- package/dist/pwa.js +8 -1
- package/dist/signals.js +7 -1
- package/dist/ssg.js +8 -1
- package/dist/utils.js +1 -0
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -5112,9 +5112,15 @@ else if (immediate) {
|
|
|
5112
5112
|
// ==========================================================================
|
|
5113
5113
|
|
|
5114
5114
|
function useRef(name) {
|
|
5115
|
+
// A ref belongs to the component scope that created it. Capturing that
|
|
5116
|
+
// owner now is essential: componentScope is a mutable compatibility
|
|
5117
|
+
// fallback and changes while the rest of the page hydrates. Reading it
|
|
5118
|
+
// from the getter made an early component resolve refs from whichever
|
|
5119
|
+
// component happened to hydrate last.
|
|
5120
|
+
var ownerScope = currentLifecycleScope() || componentScope;
|
|
5115
5121
|
return {
|
|
5116
5122
|
get current() {
|
|
5117
|
-
return
|
|
5123
|
+
return ownerScope.$refs ? ownerScope.$refs[name] : null;
|
|
5118
5124
|
},
|
|
5119
5125
|
get value() {
|
|
5120
5126
|
return this.current;
|
|
@@ -14655,6 +14661,7 @@ ${V.map((m)=>` - ${m}`).join(`
|
|
|
14655
14661
|
${k8("const",[...jL,...a0],R0)}
|
|
14656
14662
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
14657
14663
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
14664
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
14658
14665
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
14659
14666
|
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
14660
14667
|
|
|
@@ -27060,7 +27067,7 @@ else {
|
|
|
27060
27067
|
`)}function Ox($,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:""}"`:Ox(K,X+1)),G=Q.length>0?`,
|
|
27061
27068
|
${Z} [${Q.join(`,
|
|
27062
27069
|
${Z} `)}]`:"";return`Craft.create("${$.zigType}", ${Y}${G})`}function m00($,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(`
|
|
27063
|
-
`)}return Z.get(X.target)||fH($,X)}function d00($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:Fx(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 c00($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function Bx(){return`id_${++l00}`}function Fx($){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 p00($){return $.charAt(0).toUpperCase()+$.slice(1)}function i00($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function n00($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function gH($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=gH(Z);return X}function hH($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=hH(Z);return X}function Vx($){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 uH,l00=0,r00,a00;var Ax=I(()=>{uH=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"}]]);r00={compileToNative:qx,createHotReloadServer:Vx,NATIVE_COMPONENTS:uH},a00=r00});import{spawn as Mx}from"child_process";import o0 from"fs";import s00 from"os";import G0 from"path";import g from"process";import{CLI as o00}from"@stacksjs/clapp";var N6="0.2.173";V8();zH();Gj();Lj();v4();jj();eq();b8();t_();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",T0=new o00("stx");function Rx($){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 Nx($){try{if(!o0.existsSync($)){let Z=G0.dirname($),J=G0.basename($);if(o0.existsSync(Z)){let Q=o0.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(o0.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 mH($){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 u7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),t00=($)=>$.endsWith(".stx")||$.endsWith(".md");function h7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);g.exit(X)}function e00($){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 $10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(u7(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=G0.join(s00.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",G0.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=Mx(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(`
|
|
27070
|
+
`)}return Z.get(X.target)||fH($,X)}function d00($,X,Z){let J=[];function Y(Q){J.push({name:Q.zigType,hash:Fx(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 c00($,X){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}function Bx(){return`id_${++l00}`}function Fx($){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 p00($){return $.charAt(0).toUpperCase()+$.slice(1)}function i00($){let X=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function n00($){let X=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Z.exec($))!==null)X.push(J[1]);return X}function gH($){let X=$.type==="component"?1:0;if($.children)for(let Z of $.children)X+=gH(Z);return X}function hH($){let X=$.zigType.startsWith("craft.")?1:0;for(let Z of $.children)X+=hH(Z);return X}function Vx($){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 uH,l00=0,r00,a00;var Ax=I(()=>{uH=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"}]]);r00={compileToNative:qx,createHotReloadServer:Vx,NATIVE_COMPONENTS:uH},a00=r00});import{spawn as Mx}from"child_process";import o0 from"fs";import s00 from"os";import G0 from"path";import g from"process";import{CLI as o00}from"@stacksjs/clapp";var N6="0.2.174";V8();zH();Gj();Lj();v4();jj();eq();b8();t_();var __dirname="/home/runner/work/stx/stx/packages/stx/bin",T0=new o00("stx");function Rx($){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 Nx($){try{if(!o0.existsSync($)){let Z=G0.dirname($),J=G0.basename($);if(o0.existsSync(Z)){let Q=o0.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(o0.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 mH($){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 u7=($)=>$.includes("*")||$.includes("?")||$.includes("{")||$.includes("["),t00=($)=>$.endsWith(".stx")||$.endsWith(".md");function h7($,X=1){if(console.error(`\u274C ${$.error}`),$.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${$.suggestion}`);g.exit(X)}function e00($){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 $10($,X){try{let Z=["test"],J=[];if($&&$.length>0)for(let W of $)if(u7(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=G0.join(s00.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",G0.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=Mx(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(`
|
|
27064
27071
|
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 X10=g.argv.length>=3&&(t00(g.argv[2])&&o0.existsSync(g.argv[2])||u7(g.argv[2]));if(X10){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=Rx(g.argv[++Z]);if(!Y.isValid)h7(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(u7($))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=G0.resolve(Y);try{let K=new Bun.Glob("**/*.stx"),U=(await Array.fromAsync(K.scan({cwd:Q,onlyFiles:!0,absolute:!0}))).filter((z)=>/\[.+\]/.test(G0.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 RZ(J,X))g.exit(1)}catch(Z){console.error("Failed to process files:",Z),g.exit(1)}else AZ($,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]};T0.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 Qj(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)}}),T0.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(() => (wb(),Vb));if(J==="list"){console.log(`
|
|
27065
27072
|
\uD83D\uDCDA Fetching available icon collections...
|
|
27066
27073
|
`);let K=await Q(),W=Object.entries(K).sort((U,z)=>z[1].total-U[1].total);console.log(`Available collections:
|
package/dist/craft.js
CHANGED
|
@@ -4872,9 +4872,15 @@ else if (immediate) {
|
|
|
4872
4872
|
// ==========================================================================
|
|
4873
4873
|
|
|
4874
4874
|
function useRef(name) {
|
|
4875
|
+
// A ref belongs to the component scope that created it. Capturing that
|
|
4876
|
+
// owner now is essential: componentScope is a mutable compatibility
|
|
4877
|
+
// fallback and changes while the rest of the page hydrates. Reading it
|
|
4878
|
+
// from the getter made an early component resolve refs from whichever
|
|
4879
|
+
// component happened to hydrate last.
|
|
4880
|
+
var ownerScope = currentLifecycleScope() || componentScope;
|
|
4875
4881
|
return {
|
|
4876
4882
|
get current() {
|
|
4877
|
-
return
|
|
4883
|
+
return ownerScope.$refs ? ownerScope.$refs[name] : null;
|
|
4878
4884
|
},
|
|
4879
4885
|
get value() {
|
|
4880
4886
|
return this.current;
|
|
@@ -14408,6 +14414,7 @@ ${F.map((v)=>` - ${v}`).join(`
|
|
|
14408
14414
|
${k5("const",[...w6,...Z1],z0)}
|
|
14409
14415
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
14410
14416
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
14417
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
14411
14418
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
14412
14419
|
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
14413
14420
|
|
package/dist/pwa.js
CHANGED
|
@@ -4883,9 +4883,15 @@ else if (immediate) {
|
|
|
4883
4883
|
// ==========================================================================
|
|
4884
4884
|
|
|
4885
4885
|
function useRef(name) {
|
|
4886
|
+
// A ref belongs to the component scope that created it. Capturing that
|
|
4887
|
+
// owner now is essential: componentScope is a mutable compatibility
|
|
4888
|
+
// fallback and changes while the rest of the page hydrates. Reading it
|
|
4889
|
+
// from the getter made an early component resolve refs from whichever
|
|
4890
|
+
// component happened to hydrate last.
|
|
4891
|
+
var ownerScope = currentLifecycleScope() || componentScope;
|
|
4886
4892
|
return {
|
|
4887
4893
|
get current() {
|
|
4888
|
-
return
|
|
4894
|
+
return ownerScope.$refs ? ownerScope.$refs[name] : null;
|
|
4889
4895
|
},
|
|
4890
4896
|
get value() {
|
|
4891
4897
|
return this.current;
|
|
@@ -11632,6 +11638,7 @@ ${F.map((v)=>` - ${v}`).join(`
|
|
|
11632
11638
|
${F5("const",[...a2,...a0],w0)}
|
|
11633
11639
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
11634
11640
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
11641
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
11635
11642
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
11636
11643
|
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
11637
11644
|
|
package/dist/signals.js
CHANGED
|
@@ -1175,9 +1175,15 @@ else if (immediate) {
|
|
|
1175
1175
|
// ==========================================================================
|
|
1176
1176
|
|
|
1177
1177
|
function useRef(name) {
|
|
1178
|
+
// A ref belongs to the component scope that created it. Capturing that
|
|
1179
|
+
// owner now is essential: componentScope is a mutable compatibility
|
|
1180
|
+
// fallback and changes while the rest of the page hydrates. Reading it
|
|
1181
|
+
// from the getter made an early component resolve refs from whichever
|
|
1182
|
+
// component happened to hydrate last.
|
|
1183
|
+
var ownerScope = currentLifecycleScope() || componentScope;
|
|
1178
1184
|
return {
|
|
1179
1185
|
get current() {
|
|
1180
|
-
return
|
|
1186
|
+
return ownerScope.$refs ? ownerScope.$refs[name] : null;
|
|
1181
1187
|
},
|
|
1182
1188
|
get value() {
|
|
1183
1189
|
return this.current;
|
package/dist/ssg.js
CHANGED
|
@@ -3692,9 +3692,15 @@ else if (immediate) {
|
|
|
3692
3692
|
// ==========================================================================
|
|
3693
3693
|
|
|
3694
3694
|
function useRef(name) {
|
|
3695
|
+
// A ref belongs to the component scope that created it. Capturing that
|
|
3696
|
+
// owner now is essential: componentScope is a mutable compatibility
|
|
3697
|
+
// fallback and changes while the rest of the page hydrates. Reading it
|
|
3698
|
+
// from the getter made an early component resolve refs from whichever
|
|
3699
|
+
// component happened to hydrate last.
|
|
3700
|
+
var ownerScope = currentLifecycleScope() || componentScope;
|
|
3695
3701
|
return {
|
|
3696
3702
|
get current() {
|
|
3697
|
-
return
|
|
3703
|
+
return ownerScope.$refs ? ownerScope.$refs[name] : null;
|
|
3698
3704
|
},
|
|
3699
3705
|
get value() {
|
|
3700
3706
|
return this.current;
|
|
@@ -10441,6 +10447,7 @@ ${F.map((v)=>` - ${v}`).join(`
|
|
|
10441
10447
|
${R5("const",[...u2,...Y1],B0)}
|
|
10442
10448
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
10443
10449
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
10450
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
10444
10451
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
10445
10452
|
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
10446
10453
|
|
package/dist/utils.js
CHANGED
|
@@ -698,6 +698,7 @@ ${triedPaths.map((p) => ` - ${p}`).join(`
|
|
|
698
698
|
${buildRuntimeGlobalsDestructure("const", [...COMPONENT_SCOPE_LOCAL_GLOBALS, ...componentLocalNames], content)}
|
|
699
699
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
700
700
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
701
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
701
702
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
702
703
|
window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
703
704
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.174",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.14",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.174",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.174",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.174",
|
|
124
124
|
"bunfig": "^0.15.17",
|
|
125
|
-
"stx-router": "0.2.
|
|
125
|
+
"stx-router": "0.2.174",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|