@stacksjs/stx 0.2.221 → 0.2.223
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/builtins/image-placeholder.d.ts +78 -0
- package/dist/builtins/image-placeholder.js +136 -0
- package/dist/builtins/stx-image.js +15 -4
- package/dist/chunk-05c6c4sf.js +2 -0
- package/dist/{chunk-nnw1ka45.js → chunk-0h08j951.js} +1 -1
- package/dist/{chunk-yppz6dgg.js → chunk-0n4fvqm8.js} +2 -2
- package/dist/{chunk-xqnwy1t6.js → chunk-0yw0x5qz.js} +1 -1
- package/dist/{chunk-qr90ng3a.js → chunk-21kvpnqq.js} +2 -2
- package/dist/chunk-23sgbe69.js +2 -0
- package/dist/chunk-2kdfa1sw.js +2 -0
- package/dist/chunk-2m9k26n4.js +2 -0
- package/dist/chunk-38dwv9n5.js +2 -0
- package/dist/{chunk-5y731xe9.js → chunk-43hbdkws.js} +1 -1
- package/dist/{chunk-vg0kzfcy.js → chunk-47v621t0.js} +1 -1
- package/dist/{chunk-vaa8tk98.js → chunk-4jzzgnym.js} +2 -2
- package/dist/chunk-5e887teq.js +2 -0
- package/dist/{chunk-8awfakrk.js → chunk-5m9vyv2m.js} +1 -1
- package/dist/{chunk-gnmft4dz.js → chunk-5rynsy4e.js} +1 -1
- package/dist/{chunk-2bxgan9p.js → chunk-6345zcg6.js} +1 -1
- package/dist/{chunk-6sm1vr9h.js → chunk-6jzf989m.js} +1 -1
- package/dist/{chunk-bgb5a3q6.js → chunk-6n317mmy.js} +2 -2
- package/dist/{chunk-ad84gwgv.js → chunk-6rjc6687.js} +1 -1
- package/dist/{chunk-4vhxtfkw.js → chunk-6t89bck2.js} +1 -1
- package/dist/{chunk-dykhpgyx.js → chunk-70v7vvry.js} +1 -1
- package/dist/{chunk-4k5f40bb.js → chunk-72ywcwe8.js} +1 -1
- package/dist/{chunk-ewdn7s6r.js → chunk-82qd7jw1.js} +1 -1
- package/dist/{chunk-zhfdf2h5.js → chunk-87q97btf.js} +1 -1
- package/dist/{chunk-02k0pg5s.js → chunk-8hnyynhv.js} +1 -1
- package/dist/{chunk-q5w0fqd5.js → chunk-9aewbe13.js} +1 -1
- package/dist/chunk-9vpqzs8r.js +3 -0
- package/dist/{chunk-135mme4g.js → chunk-a2ppgamd.js} +1 -1
- package/dist/{chunk-qfsktf7s.js → chunk-a2yanhxh.js} +2 -2
- package/dist/{chunk-kdpy5rgk.js → chunk-bqdbf8k2.js} +24 -5
- package/dist/{chunk-kvz7rg2x.js → chunk-by2p4by1.js} +1 -1
- package/dist/{chunk-vgf945mj.js → chunk-c38dqdqt.js} +1 -1
- package/dist/{chunk-anenwsj3.js → chunk-c4aez3fr.js} +2 -2
- package/dist/{chunk-ejspksxd.js → chunk-ctba9211.js} +1 -1
- package/dist/chunk-d1nk0neq.js +2 -0
- package/dist/chunk-d8efym0s.js +2 -0
- package/dist/{chunk-5a5efazd.js → chunk-dgy9fns1.js} +2 -2
- package/dist/{chunk-arnse15r.js → chunk-dmzc008f.js} +1 -1
- package/dist/{chunk-zg5mq1cj.js → chunk-dn4gw490.js} +1 -1
- package/dist/{chunk-j3mw2vpt.js → chunk-ds6jn0m1.js} +1 -1
- package/dist/chunk-dwb1yw05.js +2 -0
- package/dist/{chunk-7ryqex47.js → chunk-ectezqxn.js} +1 -1
- package/dist/chunk-ejm3bypm.js +2 -0
- package/dist/{chunk-m6damb1f.js → chunk-ep2agtrk.js} +1 -1
- package/dist/{chunk-efrv1yp5.js → chunk-exr6hs21.js} +1 -1
- package/dist/{chunk-e890s5em.js → chunk-f10yf8p0.js} +1 -1
- package/dist/{chunk-x0bcc9sj.js → chunk-ge69r310.js} +1 -1
- package/dist/chunk-gmj16etx.js +2 -0
- package/dist/chunk-grp2f3mq.js +2 -0
- package/dist/chunk-gw35w0wr.js +2 -0
- package/dist/{chunk-1rka3ffx.js → chunk-hm4gvkhg.js} +1 -1
- package/dist/chunk-hrdps19s.js +2 -0
- package/dist/{chunk-4svjne4w.js → chunk-j3jzc0xj.js} +1 -1
- package/dist/{chunk-6vdn3qy0.js → chunk-j4v43wsq.js} +1 -1
- package/dist/chunk-jd68p7x1.js +2 -0
- package/dist/chunk-k2avxp56.js +2 -0
- package/dist/chunk-k7xpch16.js +2 -0
- package/dist/{chunk-pzcf36xm.js → chunk-kq4z185m.js} +168 -168
- package/dist/{chunk-2v1cj2qp.js → chunk-m0sgdvnk.js} +1 -1
- package/dist/chunk-m0xtfsd4.js +2 -0
- package/dist/chunk-m1sqpnkq.js +2 -0
- package/dist/chunk-m29rat2r.js +2 -0
- package/dist/{chunk-xrnqz76v.js → chunk-mjv4ar2y.js} +1 -1
- package/dist/{chunk-ry86fd41.js → chunk-myh6j9ab.js} +1 -1
- package/dist/{chunk-s6yn1mbm.js → chunk-n3ggrhb3.js} +1 -1
- package/dist/{chunk-mt4cdgz3.js → chunk-n3w7xxx7.js} +1 -1
- package/dist/{chunk-fw5d1aev.js → chunk-n43xg568.js} +2 -2
- package/dist/{chunk-7s3wrtpb.js → chunk-n58aem37.js} +1 -1
- package/dist/{chunk-06f65jz3.js → chunk-nf4tx374.js} +1 -1
- package/dist/{chunk-z794cdmn.js → chunk-njc6sven.js} +1 -1
- package/dist/{chunk-6b0xz02h.js → chunk-nstqd54d.js} +1 -1
- package/dist/{chunk-bx766t25.js → chunk-nx5qkm8k.js} +1 -1
- package/dist/{chunk-rpyck7kn.js → chunk-p3h8z1zx.js} +1 -1
- package/dist/chunk-p799ret6.js +12 -0
- package/dist/chunk-p7rde9hp.js +2 -0
- package/dist/chunk-pm23gcqm.js +2 -0
- package/dist/chunk-pt1bcewc.js +2 -0
- package/dist/{chunk-8rn5e39c.js → chunk-q891e1vj.js} +1 -1
- package/dist/chunk-qbp1yp4a.js +2 -0
- package/dist/{chunk-v7ggp28p.js → chunk-qn2hsdy5.js} +1 -1
- package/dist/{chunk-bz9z4pfr.js → chunk-qrpg15eb.js} +1 -1
- package/dist/{chunk-4wdbmjmg.js → chunk-r93rb19w.js} +1 -1
- package/dist/{chunk-hcqzbhc1.js → chunk-rhkwswq0.js} +1 -1
- package/dist/chunk-rmwbw8fw.js +2 -0
- package/dist/{chunk-5fz9n4wq.js → chunk-sm1xqvra.js} +2 -2
- package/dist/{chunk-80qre9zp.js → chunk-t0jzk81v.js} +1 -1
- package/dist/chunk-t0ybs2jy.js +2 -0
- package/dist/chunk-t2c96p0g.js +2 -0
- package/dist/chunk-tbyaz9ff.js +2 -0
- package/dist/{chunk-txre2e2m.js → chunk-tdt7b8kg.js} +1 -1
- package/dist/{chunk-pscdy0gn.js → chunk-tjb64c7k.js} +12 -12
- package/dist/{chunk-6qjzx44j.js → chunk-v7vwmmts.js} +2 -2
- package/dist/{chunk-8ha8h3s1.js → chunk-vqxmxgaj.js} +1 -1
- package/dist/{chunk-mcz70xms.js → chunk-vrpqmd6b.js} +1 -1
- package/dist/{chunk-1gy7fa09.js → chunk-vs7843yp.js} +1 -1
- package/dist/{chunk-hg2ja2gj.js → chunk-vwwn4h5j.js} +1 -1
- package/dist/{chunk-w7ped5p5.js → chunk-w6h9c3f6.js} +1 -1
- package/dist/chunk-wkmd8pfh.js +2 -0
- package/dist/chunk-wyy4ny3x.js +2 -0
- package/dist/{chunk-3s3zyq5q.js → chunk-x8w319bf.js} +1 -1
- package/dist/{chunk-tgaddq21.js → chunk-y494rjex.js} +2 -2
- package/dist/{chunk-a4329ma8.js → chunk-ypjgcb5w.js} +2 -2
- package/dist/{chunk-ydk1n77q.js → chunk-ytr18qnm.js} +2 -2
- package/dist/{chunk-rbnmbeda.js → chunk-z44ra321.js} +1 -1
- package/dist/{chunk-0k12epgy.js → chunk-z4msg4y0.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +7 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +14 -14
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-08031d2g.js +0 -12
- package/dist/chunk-1y3kc7mb.js +0 -2
- package/dist/chunk-20wgmax7.js +0 -2
- package/dist/chunk-25jkkv9d.js +0 -2
- package/dist/chunk-2y8ss8b3.js +0 -2
- package/dist/chunk-38zpyb7q.js +0 -2
- package/dist/chunk-3zhhytkd.js +0 -2
- package/dist/chunk-67b47fez.js +0 -2
- package/dist/chunk-735atsqq.js +0 -2
- package/dist/chunk-7cq5b6zp.js +0 -2
- package/dist/chunk-7jhtvcy5.js +0 -2
- package/dist/chunk-7x3nd6r4.js +0 -2
- package/dist/chunk-9ktvkzcc.js +0 -2
- package/dist/chunk-bj25jvsn.js +0 -2
- package/dist/chunk-cw0352e8.js +0 -2
- package/dist/chunk-et555kdz.js +0 -2
- package/dist/chunk-g3rg8afc.js +0 -2
- package/dist/chunk-h7xtn6j0.js +0 -2
- package/dist/chunk-hh2r7hrb.js +0 -2
- package/dist/chunk-hysfnyh4.js +0 -2
- package/dist/chunk-n1b7b20f.js +0 -2
- package/dist/chunk-rmrnnv87.js +0 -2
- package/dist/chunk-rq20qvkk.js +0 -2
- package/dist/chunk-tc2d9en8.js +0 -2
- package/dist/chunk-th7snpq2.js +0 -2
- package/dist/chunk-x0f34a44.js +0 -2
- package/dist/chunk-yk45219d.js +0 -2
- package/dist/chunk-zh75hc6a.js +0 -2
- package/dist/chunk-zpskp2xb.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Hf as _$,If as G5}from"./chunk-sm1xqvra.js";import{$g as b6,Vg as b7,Xg as U$,Yg as A6,_g as Q1,ah as $5,bh as B$,ch as L$,dh as y6,eh as v6}from"./chunk-ypjgcb5w.js";import{Vi as Y$,Wi as J$}from"./chunk-vrpqmd6b.js";import{Ej as u1,Fj as j1,Gj as O1,Hj as d$,Ij as u$,Jj as m5,Lj as p5}from"./chunk-k6b7gpk2.js";import{wk as v5,xk as g5}from"./chunk-n58aem37.js";import{Dk as c7,Ek as l7}from"./chunk-c0n802j1.js";import{gl as X1}from"./chunk-ncvd7673.js";import{$r as M0,Bq as O0,Gm as x6,Km as X5,Lr as G$,Mp as v7,Nm as N1,Om as M1,Pq as X6,Qq as E1,Tp as k6,Uo as Z$,Up as S6,Uq as m0,Yl as P7,Yr as E$,Zm as c1,_l as $6,_r as H1,an as B6,ap as j0,ds as V0,in as r$,ip as u0,jq as e$,kn as s$,lq as P6,mq as F6,nn as l1,om as d0,rn as n$,un as Q$,vn as L6,ym as a$}from"./chunk-kq4z185m.js";import{Js as B,Rs as W$,Ss as K$,Ws as o}from"./chunk-a2yanhxh.js";import{gt as S0}from"./chunk-t0jzk81v.js";import{Qt as t$,Rt as O6,Vt as M6,Wt as V6,ju as E6,ku as I6,lu as R6,mu as D6,nu as w6,ou as T6,qu as C6,uu as H6}from"./chunk-bqdbf8k2.js";import{Eu as p}from"./chunk-q891e1vj.js";var c5={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function t7($,X,Q={}){let{storage:Z="local",serializer:Y=c5,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Q,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Z==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let H=L.getItem($);if(H===null)return X;let A=Y.read(H);if(J&&typeof X==="object"&&X!==null)return{...X,...A};return A}catch{return X}},z=(L)=>{let H=_();if(!H)return;try{if(L===null||L===void 0)H.removeItem($);else H.setItem($,Y.write(L))}catch(A){console.warn(`[useStorage] Failed to write key "${$}":`,A)}},F=U(),O=(L,H)=>{for(let A of W)try{A(L,H)}catch(q){console.error("[useStorage] Subscriber error:",q)}};if(K&&G){let L=(A)=>{if(A.key===$&&A.storageArea===_()){let q=F;try{F=A.newValue?Y.read(A.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}O(F,q)}};window.addEventListener("storage",L);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",L))}let j={get value(){return F},set value(L){let H=F;F=L,z(L),O(L,H)},get:()=>F,set:(L)=>{j.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let H=F;F=X,O(X,H)}},subscribe:(L)=>{return W.add(L),L(F,void 0),()=>W.delete(L)}};return j}function l5($,X,Q,Z,Y={}){let{serializer:J=c5,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(O)=>{if(O===null||O===void 0)return Z;try{let j=J.read(O);if(G&&typeof Z==="object"&&Z!==null)return{...Z,...j};return j}catch(j){return console.warn(`[${X}] Failed to read key "${Q}":`,j),Z}},F=m5((()=>{let O=_();if(!O)return Z;try{return U(O.getItem(Q))}catch(j){return console.warn(`[${X}] Cannot read "${Q}":`,j),Z}})());if(p5(()=>{let O=F(),j=_();if(!j)return;try{if(O===null||O===void 0)j.removeItem(Q);else j.setItem(Q,J.write(O))}catch(L){console.warn(`[${X}] Cannot persist "${Q}":`,L)}}),K&&W){let O=(L)=>{if(L.key!==Q)return;if(L.storageArea&&L.storageArea!==_())return;F.set(U(L.newValue))};window.addEventListener("storage",O);let j=globalThis.onDestroy;if(typeof j==="function")j(()=>window.removeEventListener("storage",O))}return F}function e7($,X,Q){return l5("local","useLocalStorage",$,X,Q)}function $3($,X,Q){return l5("session","useSessionStorage",$,X,Q)}function X3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function Q3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function Z3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Q=0;for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))Q+=(Z.length+(X.getItem(Z)?.length||0))*2;return Q}var l=null;function d1($,X,Q=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Q.has($))return!0;if(Q.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!d1($[J],X[J],Q))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!d1(G,X.get(J),Q))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Z=Object.keys($),Y=Object.keys(X);if(Z.length!==Y.length)return!1;for(let J of Z){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!d1($[J],X[J],Q))return!1}return!0}function WJ($){l=$}function KJ(){return l}function _J(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:Y3()}}function Y3(){return{refs:new Map,effects:new Set,cleanups:[]}}function UJ($){let X=new Set,Q=new Set,Z=$,Y=Symbol("ref"),J={get value(){let G=u1();if(G)Q.add(G);return Z},set value(G){if(!Object.is(G,Z)){let W=Z;Z=G;for(let K of X)K(G,W);for(let K of Q)if(d$())u$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(l)l.scope.refs.set(Y,J);return J}var i5=new WeakMap;function J3($){let X=i5.get($);if(X)return X;let Q=new Map,Z=(G)=>{let W=Q.get(G);if(!W)return;for(let K of[...W])if(d$())u$(K);else K()},Y=(G,W)=>{if(!Q.has(G))Q.set(G,new Set);return Q.get(G).add(W),()=>{Q.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=u1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let z=Object.getPrototypeOf(_);if(z===Object.prototype||z===null)return J3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),z=Reflect.set(G,W,K,_);if(!Object.is(K,U))Z(W);return z},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Z(W),K}});return i5.set($,J),J}function BJ($){let X,Q=!0,Z=new Set,Y=new Set,J=()=>{Q=!0,G()},G=()=>{if(Q){let K=X,_=j1(J);if(X=$(),O1(_),Q=!1,!Object.is(X,K)){for(let U of Z)U(X,K);for(let U of Y)U()}}},W=j1(J);return X=$(),Q=!1,O1(W),{get value(){let K=u1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Z.add(K),()=>{Z.delete(K)}}}}function G3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function LJ($,X,Q={}){let{immediate:Z=!1,deep:Y=!1,flush:J="post"}=Q,G,W,K=!1,_=()=>{if(K)return;let j=O();if((Y?!d1(j,G):!Object.is(j,G))||Z)if(X(j,G),Y&&j!==null&&typeof j==="object")try{G=structuredClone(j)}catch{G=j}else G=j},U=(j)=>{if(J==="sync")j();else if(J==="pre")Promise.resolve().then(j);else G3(j)},z=!1,F=()=>{if(K||z)return;z=!0,U(()=>{z=!1,_()})},O=()=>{if(typeof $==="function"){let j=j1(F);try{return $()}finally{O1(j)}}return $.value};if(typeof $!=="function"){let j=$.subscribe(()=>{U(_)});W=()=>{K=!0,j()}}else W=()=>{K=!0};if(G=O(),Z)U(_);if(l)l.scope.cleanups.push(()=>W?.());return()=>W?.()}function FJ($,X,Q={}){let Z=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Z.push(G)}if(Q.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Z)J()}}function zJ($){let X,Q=!1,Z=()=>{if(Q)return;if(X)X();let Y=j1(Z);X=$(),O1(Y)};if(Z(),l)l.scope.cleanups.push(()=>{if(Q=!0,X)X()});return()=>{if(Q=!0,X)X()}}function jJ($){if(l)l.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function OJ($){if(l)l.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function HJ($){if(l)l.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function AJ($){if(l)l.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function qJ($){if(l)l.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function NJ($){if(l)l.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function s0($,X){let Q=$.hooks[X];for(let Z of Q)await Z()}async function MJ($){await s0($,"beforeMount"),$.isMounted=!0,await s0($,"mounted")}async function VJ($){if(!$.isMounted||$.isUnmounted)return;await s0($,"beforeUpdate"),await s0($,"updated")}async function EJ($){if($.isUnmounted)return;await s0($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await s0($,"unmounted")}function IJ(){return`
|
|
3
3
|
<script data-stx-client-runtime>
|
|
4
4
|
(function() {
|
|
5
5
|
'use strict';
|
|
@@ -685,7 +685,7 @@ else {
|
|
|
685
685
|
<span class="frontmatter-label">${X}:</span>
|
|
686
686
|
<span>${Array.isArray(Q)?Q.join(", "):String(Q)}</span>
|
|
687
687
|
</div>`).join("")}
|
|
688
|
-
</div>`}import _6 from"net";async function Z4($){return new Promise((X)=>{let Q=_6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"0.0.0.0")})}async function Y4($){return new Promise((X)=>{let Q=_6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"::")})}async function J4($){if(!await Z4($))return!1;return await Y4($)}async function x0($,X=20){$=Number($);for(let Q=0;Q<X;Q++){let Z=$+Q;if(await J4(Z))return Z}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var G4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function W4(){try{let $=await import("./chunk-
|
|
688
|
+
</div>`}import _6 from"net";async function Z4($){return new Promise((X)=>{let Q=_6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"0.0.0.0")})}async function Y4($){return new Promise((X)=>{let Q=_6.createServer();Q.once("error",()=>X(!1)),Q.once("listening",()=>{Q.close(()=>X(!0))}),Q.listen($,"::")})}async function J4($){if(!await Z4($))return!1;return await Y4($)}async function x0($,X=20){$=Number($);for(let Q=0;Q<X;Q++){let Z=$+Q;if(await J4(Z))return Z}throw Error(`Could not find an available port between ${$} and ${$+X-1}`)}var G4={title:"stx Development",width:1400,height:900,darkMode:!0,hotReload:!0,titlebarHidden:!1,nativeSidebar:!1,sidebarWidth:260,sidebarConfig:void 0};async function W4(){try{let $=await import("./chunk-x8w319bf.js");if(typeof $.openDevWindow!=="function")return null;return $}catch{return null}}async function o0($,X={}){let Q={...G4,...X},Z=await W4();if(!Z)return console.log(`${B.yellow}\u26A0${B.reset} Native window requested, but @stacksjs/desktop is not available.`),console.log(" Install & build the desktop package to enable --native."),!1;try{let Y=await Z.openDevWindow($,{title:Q.title,width:Q.width,height:Q.height,darkMode:Q.darkMode,hotReload:Q.hotReload,titlebarHidden:Q.titlebarHidden,nativeSidebar:Q.nativeSidebar,sidebarWidth:Q.sidebarWidth,sidebarConfig:Q.sidebarConfig});if(Y&&Q.nativeSidebar)console.log(`${B.green}\u2713${B.reset} Native sidebar enabled (macOS Tahoe style)`);return Y}catch(Y){return console.log(`${B.red}\u2717${B.reset} Could not open native window:`,Y),!1}}function o1($){if($.match(/<Sidebar[\s\S]*?variant=["'](?:tahoe|vibrancy|desktop)["'][\s\S]*?\/>/i)){let Y=$.match(/<script\s+server[^>]*>([\s\S]*?)<\/script>/i);if(Y){let J=Y[1];try{let G=`
|
|
689
689
|
${J}
|
|
690
690
|
return typeof sidebarConfig !== 'undefined' ? sidebarConfig : null;
|
|
691
691
|
`,K=Function(G)();if(K)return K}catch(G){console.warn("Invalid sidebarConfig:",G)}}return{sections:[]}}let Q=$.match(/@nativeSidebar\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(Q)try{return JSON.parse(Q[1])}catch{console.warn("Invalid @nativeSidebar configuration")}let Z=$.match(/<script\s+native-sidebar[^>]*>([\s\S]*?)<\/script>/i);if(Z)try{let Y=Z[1].match(/(?:export\s+(?:default\s+)?|const\s+\w+\s*=\s*)(\{[\s\S]*\})/m);if(Y)return Function(`return ${Y[1]}`)()}catch(Y){console.warn("Invalid native-sidebar script configuration:",Y)}return}function c$(){console.log(`
|
|
@@ -1057,7 +1057,7 @@ else {
|
|
|
1057
1057
|
};
|
|
1058
1058
|
})();
|
|
1059
1059
|
</script>
|
|
1060
|
-
`}function D0($,X,Q={}){let Z=F4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var e0=null;function X$($){if(!e0)e0=new U6($);return e0}function A1(){if(e0)e0.stop(),e0=null}import q1 from"path";var $1={name:"bun-plugin-stx",async setup($){let Q={...await H1(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await n$(()=>Bun.file(G).text(),"",(L)=>{throw new s$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new s$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:z}=a$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let A=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],q="",M=[];for(let N of A){let R=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=N.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))q=R;else M.push(N)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:q,templateContent:V,allScripts:M}}),F={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await n$(()=>j0(_,F,G),void 0,(L)=>{let H=new r$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let j=await a$.timeAsync("directive-processing",async()=>{return await O0(U,F,G,Q,W)});if(z.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-
|
|
1060
|
+
`}function D0($,X,Q={}){let Z=F4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var e0=null;function X$($){if(!e0)e0=new U6($);return e0}function A1(){if(e0)e0.stop(),e0=null}import q1 from"path";var $1={name:"bun-plugin-stx",async setup($){let Q={...await H1(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await n$(()=>Bun.file(G).text(),"",(L)=>{throw new s$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new s$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:z}=a$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let A=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],q="",M=[];for(let N of A){let R=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=N.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))q=R;else M.push(N)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:q,templateContent:V,allScripts:M}}),F={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await n$(()=>j0(_,F,G),void 0,(L)=>{let H=new r$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let j=await a$.timeAsync("directive-processing",async()=>{return await O0(U,F,G,Q,W)});if(z.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-t2c96p0g.js"),H=L(z.join(`
|
|
1061
1061
|
`),F),A=j.search(/<\/body>/i);if(A!==-1)j=j.slice(0,A)+H+`
|
|
1062
1062
|
`+j.slice(A);else j+=`
|
|
1063
1063
|
${H}`}if(j=await F6(j),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J$(G,j,W,Q),Q.debug)console.log(`Cached template ${G} with ${W.size} dependencies`)}return{contents:j,loader:"html"}}catch(W){let K=W instanceof Error?W:new r$(`Plugin processing failed: ${String(W)}`,G);if(Q$.log(K,{filePath:G,buildConfig:$.config}),L6.logDetailedError(K,{filePath:G,plugin:"bun-plugin-stx"}),Q.debug)console.error("stx Plugin Error:",K);let _=K,U=_.line||null,z=_.context||null;return{contents:Q.debug||B6()?`<!DOCTYPE html>
|
|
@@ -1120,7 +1120,7 @@ ${H}`}if(j=await F6(j),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J
|
|
|
1120
1120
|
<h1>Something went wrong</h1>
|
|
1121
1121
|
<p>An internal error occurred. Please try again later.</p>
|
|
1122
1122
|
</body>
|
|
1123
|
-
</html>`,loader:"html"}}})}};async function j4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Z0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return i$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let q={name:"public-assets",setup(R){R.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},M=await Bun.build({entrypoints:[W],outdir:K,plugins:[q,$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!M.success)return console.error(`${B.red}Build failed:${B.reset}`,M.logs),!1;let V=M.outputs.find((R)=>R.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(q){return console.error(`${B.red}Error building stx file:${B.reset}`,q),!1}};if(!await U())return!1;let F=Z0.dirname(W);await W$(F);let O=Q;try{if(O=await x0(Q),O!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${O} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let q=X.hmrPort||O+1;J=X$({wsPort:q,verbose:!1}),G=J.start(q)}let j={},L=null;try{let{loadStxConfig:q}=await import("./chunk-
|
|
1123
|
+
</html>`,loader:"html"}}})}};async function j4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Z0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return i$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let q={name:"public-assets",setup(R){R.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},M=await Bun.build({entrypoints:[W],outdir:K,plugins:[q,$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!M.success)return console.error(`${B.red}Build failed:${B.reset}`,M.logs),!1;let V=M.outputs.find((R)=>R.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(q){return console.error(`${B.red}Error building stx file:${B.reset}`,q),!1}};if(!await U())return!1;let F=Z0.dirname(W);await W$(F);let O=Q;try{if(O=await x0(Q),O!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${O} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let q=X.hmrPort||O+1;J=X$({wsPort:q,verbose:!1}),G=J.start(q)}let j={},L=null;try{let{loadStxConfig:q}=await import("./chunk-k2avxp56.js"),M=await q();if(M?.apiRouter)L=M?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(M?.apiRoutes){j=M.apiRoutes;let V=Object.keys(j).length;if(V>0)console.log(`${B.blue}Loaded ${B.bright}${V} API route${V>1?"s":""}${B.reset}`)}if(M?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:N}=await import("./chunk-ectezqxn.js"),R=M.broadcasting;await V(R);let w=R.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w}/ws${B.reset}`);let C=Z0.join(process.cwd(),"channels.ts");if(H0.existsSync(C))try{let I=await N(C);console.log(`${B.blue}Loaded ${B.bright}${I} broadcast channel${I!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(I){console.warn(`${B.yellow}Failed to load channels.ts: ${I.message}${B.reset}`)}}catch(V){console.warn(`${B.yellow}Broadcasting failed to start: ${V.message}${B.reset}`)}}catch{}if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${O}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let H=z4({port:O,async fetch(q){return _$(q,await(async()=>{let M=new URL(q.url);if(L)try{let C=await L.handleRequest(q);if(C.status!==404)return C}catch{}if(j[M.pathname])try{return await j[M.pathname](q)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(M.pathname==="/")return(async()=>{let I=await o(_||"");if(Y)I=D0(I,G);if(X.native)if(I.includes("<head>"))I=I.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else I="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+I;if(X.titlebarHidden)if(I.includes("<head>"))I=I.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else I=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${I}`;return I})().then((I)=>new Response(I,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let V=Z0.join(K,M.pathname);if(H0.existsSync(V)&&H0.statSync(V).isFile()){let C=Bun.file(V),I=Z0.extname(V).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let N=Z0.dirname(W),R=Z0.join(N,M.pathname);if(H0.existsSync(R)&&H0.statSync(R).isFile()){let C=Bun.file(R),I=Z0.extname(R).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let w=Z0.join(process.cwd(),"public",M.pathname);if(H0.existsSync(w)&&H0.statSync(w).isFile()){let C=Bun.file(w),I=Z0.extname(w).toLowerCase(),E="application/octet-stream";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})})())},error(q){return new Response(`<pre>${q}
|
|
1124
1124
|
${q.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
|
|
1125
1125
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1126
1126
|
${B.bright}\u2192 ${B.cyan}http://localhost:${O}/${B.reset}`),console.log(`
|
|
@@ -1607,12 +1607,12 @@ ${j.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
|
|
|
1607
1607
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1608
1608
|
${B.bright}\u2192 ${B.cyan}http://localhost:${U}/${B.reset}`),console.log(`
|
|
1609
1609
|
${B.yellow}Routes:${B.reset}`);let F=new Set(W.map((j)=>j.routeTemplate)),O=Object.entries(G).filter(([j])=>!F.has(j)).sort(([j],[L])=>j.localeCompare(L)).map(([j,L])=>({route:j==="/"?"/":j,filePath:X0.relative(process.cwd(),L.filePath),fileType:L.fileType}));for(let j of W){let L=j.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");O.push({route:L,filePath:X0.relative(process.cwd(),j.filePath),fileType:"stx"})}if(O.sort((j,L)=>j.route.localeCompare(L.route)),O.forEach((j,L)=>{let A=L===O.length-1?"\u2514\u2500 ":"\u251C\u2500 ",q=j.fileType==="md"?`${B.magenta}(markdown)${B.reset}`:"";console.log(` ${B.green}${A}${j.route}${B.reset} \u2192 ${B.bright}${j.filePath}${B.reset} ${q}`)}),console.log(`
|
|
1610
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(z.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();z.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let j=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),u0.clear(),m0(),await K()});process.on("SIGINT",()=>{j.close(),z.stop(),process.exit(0)})}return!0}function j6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:A4}=globalThis.Bun;import Y0 from"fs";import g from"path";async function N6($){try{return X5(await Bun.file($).text())}catch{return}}function o$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function q4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-7x3nd6r4.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,z=X.pagesDir||_.pagesDir||"pages",F=g.join(U,z);if(!Y0.existsSync(F))return console.error(`${B.red}Error: No '${z}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${F}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${z}/index.stx for the homepage.${B.reset}`),!1;let O=e$(U,{pagesDir:z});if(O.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${F}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${O.length}${B.blue} routes${B.reset}`);let j=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of j)if(Y0.existsSync(D)){let k=e$(g.dirname(D),{pagesDir:g.basename(D)});for(let S of k){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(k.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${k.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,A=null,q=null;if(X.stxOptions?.shell!==!1){if(q=await b6(W,X.stxOptions?.shell),q){if(A=await $5(q,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,q)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}E6(),await R6(W);let M=I6();if(M.length>0)console.log(`${B.blue}Loaded ${B.bright}${M.length}${B.blue} middleware: ${B.dim}${M.join(", ")}${B.reset}`);let V={},N=null;try{let{loadStxConfig:D}=await import("./chunk-7x3nd6r4.js"),T=await D(W);if(T?.apiRouter)N=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let k=Object.keys(V).length;if(k>0)console.log(`${B.blue}Loaded ${B.bright}${k} API route${k>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:k,loadChannels:S}=await import("./chunk-7ryqex47.js"),b=T.broadcasting;await k(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let W0=g.join(process.cwd(),"channels.ts");if(Y0.existsSync(W0))try{let C0=await S(W0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(k){console.warn(`${B.yellow}Broadcasting failed to start: ${k.message}${B.reset}`)}}catch{}let R=S0(W,"output");Y0.mkdirSync(R,{recursive:!0});let w=new Map,C=new Set,I=async(D)=>{let T=M6(F,D);if(!T)return null;try{let k=await Bun.build({entrypoints:[T],outdir:R,plugins:[$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!k.success)return null;let S=k.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,m=async(D,T)=>{try{let{processDirectives:k,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:W0}=await import("./chunk-7x3nd6r4.js"),{checkCache:C0,cacheTemplate:h$,readFileCached:r,templateCache:f1}=await import("./chunk-2y8ss8b3.js"),h1=await _0(W),x=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=x(y.partialsDir),y.componentsDir=x(y.componentsDir),y.layoutsDir=x(y.layoutsDir),y.storesDir=x(y.storesDir||"stores"),y.cachePath=x(y.cachePath)??S0(W,"cache");let u=!T&&!X.profile,c=y.cache!==!1;if(c&&u){let d=f1.get(D.filePath);if(d)try{if((await Y0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let e of d.dependencies){if(!Y0.existsSync(e)){z0=!1;break}if((await Y0.promises.stat(e)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let e=d.output;if(A)e=L$(e,{preserveHead:!0});let z1=E.get(D.filePath);return{route:D,content:e,status:z1?.status??await N6(D.filePath),headers:z1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(A)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await N6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=X5(s),{classifyAllScripts:U0}=await import("./chunk-7x3nd6r4.js"),B0=U0(s),a=B0.server.map((d)=>d.content),t=s;for(let d of B0.server)t=t.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let a0=new Set,N0;if(X.profile){let d=performance.now();N0=await k(t,n,D.filePath,y,a0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await k(t,n,D.filePath,y,a0);if(!A)N0=await W0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-rq20qvkk.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(A)N0=L$(N0,{preserveHead:!0});if(c&&u)await h$(D.filePath,N0,a0,y);let{extractStreamBoundaries:o7}=await import("./chunk-g3rg8afc.js"),r0=o7(n),F1=n.__streamTemplates;if(F1&&typeof F1==="object"&&Object.keys(F1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(F1).map((e)=>({id:e,render:async()=>{let z1=typeof d[e]==="function"?await d[e]():void 0;return k(F1[e],{...n,$boundary:z1},D.filePath,L0,new Set)}})),z0=new Set(F0.map((e)=>e.id));r0=[...(r0||[]).filter((e)=>!z0.has(e.id)),...F0]}if(r0&&r0.length>0)C.add(D.pattern);else r0=void 0;let d5=N1(n),u5=M1(n);if(u)E.set(D.filePath,{status:d5,headers:u5});return{route:D,content:N0,status:d5??v,headers:u5,boundaries:r0}}catch(k){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,k),null}},f=8,K0=async()=>{w.clear(),H.clear();for(let D=0;D<O.length;D+=f){let T=O.slice(D,D+f),k=await Promise.all(T.map((S)=>m(S)));for(let S of k)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=f){let T=L.slice(D,D+f),k=await Promise.all(T.map(({route:S})=>m(S)));for(let S of k)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await K0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let G0=Q;try{if(G0=await x0(Q),G0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${G0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||G0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=A4({port:G0,async fetch(D){let T=new URL(D.url),k=_?.publicDir||"public",S=g.join(W,k,T.pathname),b=g.join(W,T.pathname),_0=g.join(R,T.pathname),[W0,C0,h$]=await Promise.all([Y0.promises.stat(S).catch(()=>null),Y0.promises.stat(b).catch(()=>null),Y0.promises.stat(_0).catch(()=>null)]);if(W0?.isFile())return o$(S);if(C0?.isFile())return o$(b);if(h$?.isFile())return o$(_0);if(T.pathname.startsWith("/_stx/component/")){let x=decodeURIComponent(T.pathname.slice(16));if(x)try{let y=`<${x} />`,u={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${x}.stx`),u,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:x}=await import("./chunk-67b47fez.js"),y=await x(D,{publicDir:g.join(W,k),cacheDir:S0(W,"cache","img")});if(y)return y}if(N)try{let x=await N.handleRequest(D);if(x.status!==404)return x}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(x){return new Response(JSON.stringify({error:x.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=t$(T.pathname,O);if(r){let x=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let u=await m(r.route,r.params);if(u)x=u}if(x){let u=x.status??200,c=x.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await I(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=D6(T.pathname,r.params,s,T.search),B0=w6(U0,null,D,{isServer:!0}),a=await T6(s.middleware,B0);if(a.redirect){let t=a.redirect.path,n=a.redirect.options.redirectCode||302,a0=new Headers(a.responseHeaders);return a0.set("Location",t),new Response(null,{status:n,headers:a0})}if(a.abort){let{statusCode:t,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${t}</title></head><body><h1>Error ${t}</h1><p>${n}</p></body></html>`,{status:t,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let t=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;x.content=x.content.replace("</head>",`${t}</head>`)}}let v=x.content;if(A&&y6(D)){let U0=C6(v),B0=P6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),t=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=v6(v,n),new Response(v,{status:u,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...t&&{"X-STX-Title":encodeURIComponent(t)},[k6]:S6(),...Q1(),"Cache-Control":U$}})}if(A)v=B$(A,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(x.boundaries&&x.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-g3rg8afc.js");return B0(U0(v,x.boundaries,{timeoutMs:30000}),{status:u,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:u,headers:{"Content-Type":"text/html",...Q1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let x=L.map((u)=>u.route),y=t$(T.pathname,x);if(y){let u=H.get(y.route.pattern);if(u){let c=u.content;if(A)c=B$(A,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:u.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:u}of j)if(u!=="/"&&T.pathname.startsWith(u)){let c=H.get(u)||H.get(u+"/");if(c){let s=c.content;if(A)s=B$(A,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let x=f1.content;if(x=await o(x,W),Y)x=D0(x,G);if(X.native)if(x.includes("<head>"))x=x.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else x="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+x;return new Response(x,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await I(404);if(h1){let x=h1;if(x=await o(x,W),Y)x=D0(x,G);return new Response(x,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await I(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
|
|
1610
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(z.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();z.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let j=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),u0.clear(),m0(),await K()});process.on("SIGINT",()=>{j.close(),z.stop(),process.exit(0)})}return!0}function j6($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var{serve:A4}=globalThis.Bun;import Y0 from"fs";import g from"path";async function N6($){try{return X5(await Bun.file($).text())}catch{return}}function o$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function q4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-k2avxp56.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,z=X.pagesDir||_.pagesDir||"pages",F=g.join(U,z);if(!Y0.existsSync(F))return console.error(`${B.red}Error: No '${z}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${F}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${z}/index.stx for the homepage.${B.reset}`),!1;let O=e$(U,{pagesDir:z});if(O.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${F}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${O.length}${B.blue} routes${B.reset}`);let j=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of j)if(Y0.existsSync(D)){let k=e$(g.dirname(D),{pagesDir:g.basename(D)});for(let S of k){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(k.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${k.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,A=null,q=null;if(X.stxOptions?.shell!==!1){if(q=await b6(W,X.stxOptions?.shell),q){if(A=await $5(q,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,q)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}E6(),await R6(W);let M=I6();if(M.length>0)console.log(`${B.blue}Loaded ${B.bright}${M.length}${B.blue} middleware: ${B.dim}${M.join(", ")}${B.reset}`);let V={},N=null;try{let{loadStxConfig:D}=await import("./chunk-k2avxp56.js"),T=await D(W);if(T?.apiRouter)N=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let k=Object.keys(V).length;if(k>0)console.log(`${B.blue}Loaded ${B.bright}${k} API route${k>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:k,loadChannels:S}=await import("./chunk-ectezqxn.js"),b=T.broadcasting;await k(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let W0=g.join(process.cwd(),"channels.ts");if(Y0.existsSync(W0))try{let C0=await S(W0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(k){console.warn(`${B.yellow}Broadcasting failed to start: ${k.message}${B.reset}`)}}catch{}let R=S0(W,"output");Y0.mkdirSync(R,{recursive:!0});let w=new Map,C=new Set,I=async(D)=>{let T=M6(F,D);if(!T)return null;try{let k=await Bun.build({entrypoints:[T],outdir:R,plugins:[$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!k.success)return null;let S=k.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,m=async(D,T)=>{try{let{processDirectives:k,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:W0}=await import("./chunk-k2avxp56.js"),{checkCache:C0,cacheTemplate:h$,readFileCached:r,templateCache:f1}=await import("./chunk-tbyaz9ff.js"),h1=await _0(W),x=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=x(y.partialsDir),y.componentsDir=x(y.componentsDir),y.layoutsDir=x(y.layoutsDir),y.storesDir=x(y.storesDir||"stores"),y.cachePath=x(y.cachePath)??S0(W,"cache");let u=!T&&!X.profile,c=y.cache!==!1;if(c&&u){let d=f1.get(D.filePath);if(d)try{if((await Y0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let e of d.dependencies){if(!Y0.existsSync(e)){z0=!1;break}if((await Y0.promises.stat(e)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let e=d.output;if(A)e=L$(e,{preserveHead:!0});let z1=E.get(D.filePath);return{route:D,content:e,status:z1?.status??await N6(D.filePath),headers:z1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(A)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await N6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=X5(s),{classifyAllScripts:U0}=await import("./chunk-k2avxp56.js"),B0=U0(s),a=B0.server.map((d)=>d.content),t=s;for(let d of B0.server)t=t.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let a0=new Set,N0;if(X.profile){let d=performance.now();N0=await k(t,n,D.filePath,y,a0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await k(t,n,D.filePath,y,a0);if(!A)N0=await W0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-t2c96p0g.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(A)N0=L$(N0,{preserveHead:!0});if(c&&u)await h$(D.filePath,N0,a0,y);let{extractStreamBoundaries:o7}=await import("./chunk-qbp1yp4a.js"),r0=o7(n),F1=n.__streamTemplates;if(F1&&typeof F1==="object"&&Object.keys(F1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(F1).map((e)=>({id:e,render:async()=>{let z1=typeof d[e]==="function"?await d[e]():void 0;return k(F1[e],{...n,$boundary:z1},D.filePath,L0,new Set)}})),z0=new Set(F0.map((e)=>e.id));r0=[...(r0||[]).filter((e)=>!z0.has(e.id)),...F0]}if(r0&&r0.length>0)C.add(D.pattern);else r0=void 0;let d5=N1(n),u5=M1(n);if(u)E.set(D.filePath,{status:d5,headers:u5});return{route:D,content:N0,status:d5??v,headers:u5,boundaries:r0}}catch(k){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,k),null}},f=8,K0=async()=>{w.clear(),H.clear();for(let D=0;D<O.length;D+=f){let T=O.slice(D,D+f),k=await Promise.all(T.map((S)=>m(S)));for(let S of k)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=f){let T=L.slice(D,D+f),k=await Promise.all(T.map(({route:S})=>m(S)));for(let S of k)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await K0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let G0=Q;try{if(G0=await x0(Q),G0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${G0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||G0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=A4({port:G0,async fetch(D){let T=new URL(D.url),k=_?.publicDir||"public",S=g.join(W,k,T.pathname),b=g.join(W,T.pathname),_0=g.join(R,T.pathname),[W0,C0,h$]=await Promise.all([Y0.promises.stat(S).catch(()=>null),Y0.promises.stat(b).catch(()=>null),Y0.promises.stat(_0).catch(()=>null)]);if(W0?.isFile())return o$(S);if(C0?.isFile())return o$(b);if(h$?.isFile())return o$(_0);if(T.pathname.startsWith("/_stx/component/")){let x=decodeURIComponent(T.pathname.slice(16));if(x)try{let y=`<${x} />`,u={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${x}.stx`),u,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:x}=await import("./chunk-jd68p7x1.js"),y=await x(D,{publicDir:g.join(W,k),cacheDir:S0(W,"cache","img")});if(y)return y}if(N)try{let x=await N.handleRequest(D);if(x.status!==404)return x}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(x){return new Response(JSON.stringify({error:x.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=t$(T.pathname,O);if(r){let x=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let u=await m(r.route,r.params);if(u)x=u}if(x){let u=x.status??200,c=x.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await I(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=D6(T.pathname,r.params,s,T.search),B0=w6(U0,null,D,{isServer:!0}),a=await T6(s.middleware,B0);if(a.redirect){let t=a.redirect.path,n=a.redirect.options.redirectCode||302,a0=new Headers(a.responseHeaders);return a0.set("Location",t),new Response(null,{status:n,headers:a0})}if(a.abort){let{statusCode:t,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${t}</title></head><body><h1>Error ${t}</h1><p>${n}</p></body></html>`,{status:t,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let t=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;x.content=x.content.replace("</head>",`${t}</head>`)}}let v=x.content;if(A&&y6(D)){let U0=C6(v),B0=P6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),t=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=v6(v,n),new Response(v,{status:u,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...t&&{"X-STX-Title":encodeURIComponent(t)},[k6]:S6(),...Q1(),"Cache-Control":U$}})}if(A)v=B$(A,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(x.boundaries&&x.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-qbp1yp4a.js");return B0(U0(v,x.boundaries,{timeoutMs:30000}),{status:u,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:u,headers:{"Content-Type":"text/html",...Q1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let x=L.map((u)=>u.route),y=t$(T.pathname,x);if(y){let u=H.get(y.route.pattern);if(u){let c=u.content;if(A)c=B$(A,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:u.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:u}of j)if(u!=="/"&&T.pathname.startsWith(u)){let c=H.get(u)||H.get(u+"/");if(c){let s=c.content;if(A)s=B$(A,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let x=f1.content;if(x=await o(x,W),Y)x=D0(x,G);if(X.native)if(x.includes("<head>"))x=x.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else x="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+x;return new Response(x,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await I(404);if(h1){let x=h1;if(x=await o(x,W),Y)x=D0(x,G);return new Response(x,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await I(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
|
|
1611
1611
|
${D.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
|
|
1612
1612
|
${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
|
|
1613
1613
|
${B.bright}\u2192 ${B.cyan}http://localhost:${G0}/${B.reset}`),Y)console.log(`${B.dim} HMR: ws://localhost:${G}${B.reset}`);console.log(`
|
|
1614
1614
|
${B.yellow}Routes:${B.reset}`);let i0=[...V6(O,W)];for(let{route:D}of L)i0.push(`${D.pattern}`);if(i0.forEach((D,T)=>{let S=T===i0.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${B.green}${S}${B.reset}${D}`)}),console.log(`
|
|
1615
|
-
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(F,"index.stx");if(Y0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let k=_?.app?.window??{};await o0(G0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:k.width,height:k.height,darkMode:k.darkMode,hotReload:k.hotReload,titlebarHidden:k.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},k=Y0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-
|
|
1615
|
+
Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(F,"index.stx");if(Y0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let k=_?.app?.window??{};await o0(G0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:k.width,height:k.height,darkMode:k.darkMode,hotReload:k.hotReload,titlebarHidden:k.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},k=Y0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-tbyaz9ff.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(q&&b){if(g.resolve(W,b)===q||g.basename(q)===b){let W0=await $5(q,X.stxOptions||{});if(W0)A=W0}}if(await K0(),await K$(W),Y&&J)J.reload(b)}else{console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-tbyaz9ff.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(await K0(),Y&&J)J.reload(b)}else if(t1(b)){if(console.log(`${B.cyan}CSS ${b} changed${B.reset}`),Y&&J)J.updateCss(b)}});process.on("SIGINT",()=>{if(k.close(),J)A1();g1.stop(),process.exit(0)})}return!0}var N4=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function M4($){let X=($||"").trim();if(!X)return null;if(/[\s>+~,:]/.test(X))return null;let Q={},Z=X,Y=Z.match(/^[a-z][\w-]*/i);if(Y)Q.tag=Y[0].toLowerCase(),Z=Z.slice(Y[0].length);while(Z.length>0){let J=Z.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(J){if(Q.attr=J[1],J[3]!==void 0&&J[3]!=="")Q.attrValue=J[3];Z=Z.slice(J[0].length);continue}let G=Z.match(/^#([\w-]+)/);if(G){Q.id=G[1],Z=Z.slice(G[0].length);continue}let W=Z.match(/^\.([\w-]+)/);if(W){Q.className=W[1],Z=Z.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function V4($,X){if(X.attr){if(!(X.attrValue===void 0?new RegExp(`\\b${X.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${X.attr}\\s*=\\s*(["'])\\s*${X.attrValue}\\s*\\1`,"i")).test($))return!1}if(X.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${X.id}\\s*\\1`,"i").test($))return!1}if(X.className){let Q=$.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(X.className))return!1}return!0}function bW($,X="main"){let Q=M4(X);if(!Q)return null;let Z=/<([a-z][\w-]*)\b([^>]*)>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1].toLowerCase(),G=Y[2]||"";if(G.trimEnd().endsWith("/")||N4.has(J))continue;if(Q.tag&&Q.tag!==J)continue;if(!V4(G,Q))continue;let W=Y[0],K=Y.index+W.length,_=new RegExp(`<(/?)${J}\\b([^>]*)>`,"gi");_.lastIndex=K;let U=1,z;while((z=_.exec($))!==null){let F=z[1]==="/";if(!F&&(z[2]||"").trimEnd().endsWith("/"))continue;if(U+=F?-1:1,U===0)return{openTag:W,openIndex:Y.index,start:K,end:z.index,tagName:J}}return null}return null}var P={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function E4($={}){if(typeof window>"u")return;P.enabled=!0,P.maxEvents=$.maxEvents||1000,P.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>P,getComponents:()=>Array.from(P.components.values()),getComponent:(X)=>P.components.get(X),getStores:()=>Array.from(P.stores.values()),getStore:(X)=>P.stores.get(X),getEvents:()=>P.events,getPerformance:()=>P.performance,selectComponent:(X)=>Z5(X),selectStore:(X)=>R4(X),inspectElement:(X)=>D4(X),highlightComponent:(X)=>u6(X),clearHighlight:()=>m6(),logComponentTree:()=>w4(),logStoreState:(X)=>T4(X),timeTravel:(X,Q)=>C4(X,Q)},k4(),x4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function I4(){P.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function g6($){if(!P.enabled)return;let X=P.components.get($);if(X){if(X.parentId){let Q=P.components.get(X.parentId);if(Q)Q.children=Q.children.filter((Z)=>Z!==$)}P.components.delete($),Q5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function h6($,X,Q={},Z=[]){if(!P.enabled)return;let Y={id:$,state:X,getters:Q,actions:Z,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};P.stores.set($,Y),Q5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function d6($,X,Q,Z,Y="state"){if(!P.enabled)return;let J=P.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Q,newValue:Z,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Z};Q5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Q,newValue:Z}})}}function Q5($){if(!P.enabled)return;if(P.events.push($),P.events.length>P.maxEvents)P.events=P.events.slice(-P.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function Z5($){P.selectedComponent=$;let X=P.components.get($);if(X)u6($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function R4($){P.selectedStore=$;let X=P.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function D4($){let X=$;while(X){let Q=X.getAttribute("data-stx-component-id");if(Q)return Z5(Q);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function u6($){m6();let X=P.components.get($);if(X?.element){let Q=document.createElement("div");Q.id="stx-devtools-highlight",Q.style.cssText=`
|
|
1616
1616
|
position: absolute;
|
|
1617
1617
|
background: rgba(59, 130, 246, 0.2);
|
|
1618
1618
|
border: 2px solid #3b82f6;
|
|
@@ -2881,9 +2881,9 @@ describe('Example', () => {
|
|
|
2881
2881
|
</footer>
|
|
2882
2882
|
@yield('scripts')
|
|
2883
2883
|
</body>
|
|
2884
|
-
</html>`}function aX(){return"<!-- Hero section -->"}function rX(){return"<!-- Features -->"}function sX(){return"<!-- Pricing -->"}function nX(){return"<!-- Button -->"}function C1($){if(!T1($))U5($,{recursive:!0})}function oX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function B5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function tX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function p0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:eX}=globalThis.Bun;import x1 from"fs";import y0 from"path";function c2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function Y8($){let{loadStxConfig:X}=await import("./chunk-
|
|
2884
|
+
</html>`}function aX(){return"<!-- Hero section -->"}function rX(){return"<!-- Features -->"}function sX(){return"<!-- Pricing -->"}function nX(){return"<!-- Button -->"}function C1($){if(!T1($))U5($,{recursive:!0})}function oX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function B5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function tX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function p0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:eX}=globalThis.Bun;import x1 from"fs";import y0 from"path";function c2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function Y8($){let{loadStxConfig:X}=await import("./chunk-gw35w0wr.js");return{...await X($.configDir??process.cwd()).catch(()=>({})),...$.stxOptions??{}}}async function $Q($={}){let{port:X=3000,root:Q=".",watch:Z=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=y0.resolve(Q),U=await Y8($),z=new Map;async function F(q){let M=x1.statSync(q),V=`${q}:${M.mtimeMs}`,N=z.get(V);if(N)return{content:N.content,status:N.status,headers:N.headers};for(let T of z.keys())if(T.startsWith(`${q}:`)&&T!==V)z.delete(T);let R=await Bun.file(q).text(),w=R,C=Z$(R);if(C)w=C.content.trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],m=[],f;while((f=I.exec(R))!==null){let T=f[1],k=f[2],S=f[0];if(T.includes("server"))m.push(k);else E.push(S)}let K0=R.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],h5=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),G0={__filename:q,__dirname:y0.dirname(q)};for(let T of m)await j0(T,G0,q);let q0=await O0(h5,G0,q,U,new Set);if(K0.length>0){let T=K0.join(`
|
|
2885
2885
|
`);if(q0.match(/(<\/head>)/i))q0=q0.replace(/(<\/head>)/i,`${T}
|
|
2886
|
-
$1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-
|
|
2886
|
+
$1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-t2c96p0g.js"),k=T(E.join(`
|
|
2887
2887
|
`),G0);if(q0.match(/(<\/body>)/i))q0=q0.replace(/(<\/body>)/i,`${k}
|
|
2888
2888
|
$1`);else q0+=`
|
|
2889
2889
|
${k}`}let i0=N1(G0),D=M1(G0);return z.set(V,{content:q0,mtime:M.mtimeMs,status:i0,headers:D}),{content:q0,status:i0,headers:D}}async function O(q){let M=x1.statSync(q),V=`${q}:${M.mtimeMs}`,N=z.get(V);if(N)return N.content;let{content:R}=await V0(q,U);return z.set(V,{content:R,mtime:M.mtimeMs}),R}function j(q){let M=q.startsWith("/")?q.slice(1):q,V=[M,`${M}.stx`,`${M}.md`,`${M}.html`,y0.join(M,"index.stx"),y0.join(M,"index.md"),y0.join(M,"index.html")];for(let N of V){let R=y0.join(_,N);if(x1.existsSync(R)&&x1.statSync(R).isFile())return R}return null}async function L(q){let M=new URL(q.url),V=async()=>{if(J[M.pathname])return await J[M.pathname](q);if(Y){let R=await Y(q);if(R)return R}let N=j(M.pathname);if(!N){if(W)return await W(q);return new Response("Not Found",{status:404})}try{let R,w="text/html",C,I;if(N.endsWith(".stx")){let E=await F(N);R=E.content,C=E.status,I=E.headers}else if(N.endsWith(".md"))R=await O(N);else if(N.endsWith(".html"))R=await Bun.file(N).text();else if(N.endsWith(".css"))R=await Bun.file(N).text(),w="text/css";else if(N.endsWith(".js"))R=await Bun.file(N).text(),w="text/javascript";else if(N.endsWith(".json"))R=await Bun.file(N).text(),w="application/json";else return new Response(Bun.file(N));return new Response(R,{status:C??200,headers:{"Content-Type":w,...I}})}catch(R){if(K)return await K(R,q);let w=R instanceof Error?R.message:String(R),I=U?.debug===!0?`<h1>Error</h1><pre>${w}
|
|
@@ -4315,7 +4315,7 @@ else {
|
|
|
4315
4315
|
\u26A0\uFE0F Built ${Q.views.length} views with ${Q.errors.length} errors`);return Q}function Y9($,X){let Q=V$.watch($.viewsDir,{recursive:!0},async(Z,Y)=>{if(!Y)return;if(Y.endsWith(".stx")||Y.endsWith(".ts")||Y.endsWith(".js")){if($.debug)console.log(`
|
|
4316
4316
|
File changed: ${Y}, rebuilding...`);let J=await VZ($);X?.(J)}});return{close:()=>Q.close()}}async function J9($,X={},Q={}){let Z={...Q,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},Y=await M7($,X,Z);Y=await EZ(Y),Y=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=Y.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),Y=Y.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
|
|
4317
4317
|
|
|
4318
|
-
`).trim();let J=RZ(Y);return{html:Y,text:J}}async function EZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-
|
|
4318
|
+
`).trim();let J=RZ(Y);return{html:Y,text:J}}async function EZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-43hbdkws.js");if(Q($).size===0)return $;let Y=await X($);if(!Y)return $;let J=IZ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,z)=>{let F=_.split(/\s+/).filter(Boolean),O=[];for(let A of F){let q=J.get(A);if(q)O.push(q)}if(O.length===0)return`${W}${K}class="${_}"${U}${z}`;let j=O.join("; "),H=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(H){let A=`${j}; ${H[1]}`,q=K.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`);return`${W}${q}class="${_}"${M}${z}`}return`${W}${K}class="${_}" style="${j}"${U}${z}`})}catch{return $}}function IZ($){let X=new Map,Q=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Z=Q.exec($);while(Z!==null){let Y=Z[1].replace(/\\/g,""),J=Z[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Z=Q.exec($)}return X}function RZ($){return $.replace(/<br\s*\/?>/gi,`
|
|
4319
4319
|
`).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
|
|
4320
4320
|
`).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/©/g,"(c)").replace(/·/g,"-").replace(/\n\s*\n\s*\n/g,`
|
|
4321
4321
|
|
|
@@ -4450,7 +4450,7 @@ ${N}`}function Q0($){return $.replace(/&/g,"&").replace(/"/g,""").repla
|
|
|
4450
4450
|
`;let Q=$.sitemap!==!1?`Sitemap: ${$.url.replace(/\/$/,"")}/sitemap.xml
|
|
4451
4451
|
`:"";if(X==="disallow")return["User-agent: *","Disallow: /","",Q].filter(Boolean).join(`
|
|
4452
4452
|
`);return["User-agent: *","Allow: /","",Q].filter(Boolean).join(`
|
|
4453
|
-
`)}var L1=null;async function YY(){if(L1!==null)return L1;try{let $=await import("./chunk-
|
|
4453
|
+
`)}var L1=null;async function YY(){if(L1!==null)return L1;try{let $=await import("./chunk-0yw0x5qz.js");if(typeof $.getRouterScript==="function")L1=$.getRouterScript();else L1=""}catch{L1=""}return L1}async function S5($,X){let Q=await YY();if(!Q)return $;let Z={interceptAllLinks:!0,container:"main",...X},J=`${`<script>window.__stxRouterConfig=${JSON.stringify(Z)};</script>
|
|
4454
4454
|
`}<script>${Q}</script>`;if(/<\/body>/i.test($))return $.replace(/<\/body>/i,`${J}
|
|
4455
4455
|
</body>`);return`${$}
|
|
4456
4456
|
${J}`}var JY=`window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':'light';var pick=document.querySelector('link[rel~="icon"][media*="prefers-color-scheme: '+want+'"]');if(!pick)return;var live=document.querySelector('link[rel~="icon"]:not([media])');if(!live){live=document.createElement('link');live.setAttribute('rel','icon');document.head.appendChild(live)}if(pick.type)live.setAttribute('type',pick.type);var href=pick.getAttribute('href');if(live.getAttribute('href')!==href)live.setAttribute('href',href)}catch(e){}};`,GY=($,X,Q,Z)=>`(function(){${JY}function read(){try{var k=${JSON.stringify(X)};var t=localStorage.getItem(k);return t===null?(${JSON.stringify($)}==='dark'||(${JSON.stringify($)}==='auto'&&window.matchMedia('(prefers-color-scheme: dark)').matches)):t==='dark'}catch(e){return ${JSON.stringify($)}==='dark'}}function apply(){var isDark=read();var html=document.documentElement;html.classList[isDark?'add':'remove']('dark');var color=isDark?${JSON.stringify(Z)}:${JSON.stringify(Q)};if(!document.head)return;var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(!tc){tc=document.createElement('meta');tc.setAttribute('name','theme-color');tc.setAttribute('data-stx-theme-meta','1')}tc.setAttribute('content',color);if(tc!==document.head.firstChild){document.head.insertBefore(tc,document.head.firstChild)}if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)}apply();window.addEventListener('stx:navigate',apply);window.addEventListener('popstate',apply)})();`,WY=($,X,Q)=>`document.addEventListener('click',function(e){var t=e.target&&e.target.closest&&e.target.closest('#theme-toggle');if(!t)return;var html=document.documentElement;var isDark=html.classList.toggle('dark');try{localStorage.setItem(${JSON.stringify($)},isDark?'dark':'light')}catch(e){}var tc=document.querySelector('meta[name="theme-color"]:not([media])');if(tc)tc.setAttribute('content',isDark?${JSON.stringify(Q)}:${JSON.stringify(X)});if(window.__stxThemeIcon)window.__stxThemeIcon(isDark)});`;function C$($,X){if(X.theme===!1)return $;let Q=$.includes(v7),Z=typeof X.theme==="object"&&X.theme!==null?X.theme:{},Y=Z.default??"dark",J=Z.storageKey??"theme",G=Z.colors?.light??"#ffffff",W=Z.colors?.dark??"#000000";if(Y==="dark"&&!Q){if(!/<html\b[^>]*\bclass=/.test($))$=$.replace(/<html\b([^>]*)>/i,'<html$1 class="dark">');else if(!/<html\b[^>]*\bclass="[^"]*\bdark\b/.test($))$=$.replace(/<html\b([^>]*\bclass=")([^"]*)(")/i,"<html$1$2 dark$3")}if(!$.includes("data-stx-theme-meta")&&/<head\b[^>]*>/i.test($)){let K=['<meta name="color-scheme" content="dark light" data-stx-theme-meta="1">',`<meta name="theme-color" media="(prefers-color-scheme: light)" content="${G}" data-stx-theme-meta="1">`,`<meta name="theme-color" media="(prefers-color-scheme: dark)" content="${W}" data-stx-theme-meta="1">`].join(`
|
|
@@ -4467,5 +4467,5 @@ ${J}`}var JY=`window.__stxThemeIcon=function(isDark){try{var want=isDark?'dark':
|
|
|
4467
4467
|
${Y.slice(W)}`;return`${$.slice(0,Z)}${z}${$.slice(Q)}`}function SY($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function a7($){return $}var PY=new Set(["if","else","elseif","else-if","for","foreach","show","model","html","text","bind","key","ref","once","memo","slot","teleport","cloak","pre","effect","init"]),bY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function yY($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vY($){let X=[],Q=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Z;while((Z=Q.exec($))!==null)X.push([Z.index,Z.index+Z[0].length]);return X}function gY($,X){for(let[Q,Z]of $)if(X>=Q&&X<Z)return!0;return!1}function f$($,X){let Q=1,Z=0;for(let Y=0;Y<X&&Y<$.length;Y++)if($[Y]===`
|
|
4468
4468
|
`)Q++,Z=Y+1;return{line:Q,column:X-Z+1}}function fY($,X,Q){let Z=X.toLowerCase(),Y=$.length,J=1,G=Q;while(G<Y){let W=$.indexOf("<",G);if(W===-1)return-1;if(G=W,$.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);if(U===-1)return-1;G=U+3;continue}if($[G+1]==="/"){let U=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(G,G+64));if(!U){G++;continue}if(U[1].toLowerCase()===Z){if(J--,G+=U[0].length,J===0)return G;continue}G+=U[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(G,G+64));if(!K){G++;continue}let _=$.indexOf(">",G);if(_===-1)return-1;if(K[1].toLowerCase()===Z&&$[_-1]!=="/")J++;G=_+1}return-1}function hY($,X,Q){let Z=/@([a-z][\w:-]*)((?:\.[a-z][\w-]*)*)\s*=\s*"([^"]*)"/gi,Y;while((Y=Z.exec($))!==null){if(gY(X,Y.index))continue;let J=Y[1].toLowerCase().split(":")[0];if(PY.has(J))continue;let G=Y[3].trim();if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(G)){let W=$.indexOf(Y[3],Y.index),{line:K,column:_}=f$($,W<0?Y.index:W);Q.push({ruleId:"stx/no-bare-function-ref-in-event",message:`Event handler @${Y[1]}="${G}" is a member path, which the runtime does not invoke \u2014 it only auto-calls a plain identifier. Call it: @${Y[1]}="${G}($event)".`,line:K,column:_,severity:"error"})}}}function r7($){let X=$.split("/"),Q=[];for(let Z of X){if(Z===""||Z===".")continue;if(Z==="..")Q.pop();else Q.push(Z)}return Q.join("/")}function dY($,X,Q){let Z=X.replace(/\\/g,"/"),Y=Z.indexOf("resources/stores/");if(Y===-1)return;let J=Z.slice(0,Y+16),G=Z.slice(0,Z.lastIndexOf("/")),W=/\b(import|export)\s+(type\s+)?([^'"]*?)\s*from\s*['"]([^'"]+)['"]/g,K;while((K=W.exec($))!==null){if(K[2])continue;let _=K[1],U=K[4],z;if(U.startsWith("."))z=!r7(`${G}/${U}`).startsWith(r7(J));else z=!0;if(z){let{line:F,column:O}=f$($,K.index),j=_==="export"?"Value re-export":"Value import";Q.push({ruleId:"stx/store-value-imports-must-be-local",message:`${j} from "${U}" is outside resources/stores/ and will be stripped from the store bundle. Use \`${_} type\`, or move the value into the stores dir.`,line:F,column:O,severity:"error"})}}}function uY($){let X=$.trim(),Q=(G)=>{let W=G.match(/[A-Za-z_$][\w$]*/g);return W?W:[]},Z=/\bas\s+(.+)$/.exec(X);if(Z){let G=Z[1].trim(),W=/^([A-Za-z_$][\w$]*)\s*=>\s*([A-Za-z_$][\w$]*)/.exec(G);if(W)return[W[1],W[2]];let K=/^\(([^)]*)\)/.exec(G);if(K)return Q(K[1]);let _=/^([A-Za-z_$][\w$]*)/.exec(G);return _?[_[1]]:[]}let Y=/^\(([^)]*)\)\s+(?:in|of)\s+/.exec(X);if(Y)return Q(Y[1]);let J=/^([A-Za-z_$][\w$]*)\s+(?:in|of)\s+/.exec(X);return J?[J[1]]:[]}function mY($,X){let Q=/(?::for|x-for|@for)\s*=\s*"([^"]*)"/gi,Z;while((Z=Q.exec($))!==null){let Y=uY(Z[1]);if(Y.length===0)continue;let J=$.lastIndexOf("<",Z.index);if(J===-1)continue;let G=/^<([a-z][\w-]*)/i.exec($.slice(J,J+64));if(!G)continue;let W=$.indexOf(">",Z.index);if(W===-1)continue;let _=$[W-1]==="/"||bY.has(G[1].toLowerCase())?W+1:fY($,G[1],W+1),U=_===-1?W+1:_,z=$.indexOf(Z[1],Z.index),F=$.slice(J,U);if(z>=0&&z+Z[1].length<=U){let O=z-J;F=F.slice(0,O)+" ".repeat(Z[1].length)+F.slice(O+Z[1].length)}for(let O of Y){let j=new RegExp(`(?<![.\\w$])${yY(O)}\\s*\\(`,"g"),L;while((L=j.exec(F))!==null){let H=J+L.index,{line:A,column:q}=f$($,H);X.push({ruleId:"stx/no-signal-call-in-for-iteration-var",message:`"${O}" is a :for iteration variable, not a signal \u2014 calling it as "${O}()" leaves it as a function and silently breaks comparisons. Use "${O}" directly.`,line:A,column:q,severity:"error"})}}}}function pY($,X){let Q=/<!--([\s\S]*?)-->/g,Z;while((Z=Q.exec($))!==null){let J=Z[1].indexOf("`");if(J!==-1){let G=Z.index+4+J,{line:W,column:K}=f$($,G);X.push({ruleId:"stx/no-backticks-in-html-comments",message:"Backtick inside an HTML comment leaks into the merged setup function and flips the JS parser into template-literal mode. Remove it or rephrase the comment.",line:W,column:K,severity:"error"})}}}function g$($,X){return $?.[X]!==!1}function cY($,X={}){let Q=[],Z=vY($),Y=(X.filePath??"").replace(/\\/g,"/"),J=X.fileKind??(/\/components?\//i.test(Y)?"component":/\/layouts?\//i.test(Y)?"layout":"view");if(g$(X.rules,"stx/no-bare-function-ref-in-event"))hY($,Z,Q);if(Y&&g$(X.rules,"stx/store-value-imports-must-be-local"))dY($,Y,Q);if(g$(X.rules,"stx/no-signal-call-in-for-iteration-var"))mY($,Q);if(g$(X.rules,"stx/no-backticks-in-html-comments"))pY($,Q);Q.sort((W,K)=>W.line-K.line||W.column-K.column);let G=new Set;return Q.filter((W)=>{let K=`${W.ruleId}:${W.line}:${W.column}`;if(G.has(K))return!1;return G.add(K),!0})}function lY($,X){return $.kind===X}function s7($){if($===String)return"string";if($===Number)return"number";if($===Boolean)return"boolean";if($===Array)return"array";if($===Object)return"object";if($===Function)return"function";if($===Date)return"date";if($===Symbol)return"symbol";if(typeof $==="function"&&$.name)return $.name;return"unknown"}function iY($,X){if($===null||$===void 0)return!0;if(X===String)return typeof $==="string";if(X===Number)return typeof $==="number"&&!Number.isNaN($);if(X===Boolean)return typeof $==="boolean";if(X===Array)return Array.isArray($);if(X===Object)return typeof $==="object"&&!Array.isArray($);if(X===Function)return typeof $==="function";if(X===Date)return $ instanceof Date;if(X===Symbol)return typeof $==="symbol";if(typeof X==="function")return $ instanceof X;return!0}function n7($,X,Q,Z){let Y=Z?`[${Z}]`:"";if(Q.required&&(X===void 0||X===null))return{prop:$,message:`${Y} Missing required prop: "${$}"`,value:X,expected:Q.type?s7(Q.type):void 0};if(X===void 0||X===null)return null;if(Q.type){let J=Array.isArray(Q.type)?Q.type:[Q.type];if(!J.some((W)=>iY(X,W))){let W=J.map((K)=>s7(K)).join(" | ");return{prop:$,message:`${Y} Invalid prop type for "${$}": expected ${W}, got ${typeof X}`,value:X,expected:W}}}if(Q.validator){if(!Q.validator(X))return{prop:$,message:`${Y} Custom validation failed for prop "${$}"`,value:X}}return null}function aY($){let X=globalThis.__STX_CURRENT_PROPS__||{};if(!$)return X;let Q={...X};for(let[Z,Y]of Object.entries($)){let J=typeof Y==="function"||Array.isArray(Y)?{type:Y}:Y||{};if(Q[Z]===void 0&&J.default!==void 0)Q[Z]=typeof J.default==="function"?J.default():J.default}return Q}function rY($,X={}){let{componentName:Q,throwOnError:Z=!1,logWarnings:Y=!0}=X,J=globalThis.__STX_CURRENT_PROPS__||{},G={...J},W={valid:!0,errors:[],warnings:[]};for(let[K,_]of Object.entries($)){let U=typeof _==="function"||Array.isArray(_)?{type:_}:_||{};if(G[K]===void 0&&U.default!==void 0)G[K]=typeof U.default==="function"?U.default():U.default;let z=n7(K,G[K],U,Q);if(z){if(W.valid=!1,W.errors.push(z),Y)console.warn(z.message)}}for(let K of Object.keys(J))if(!(K in $)){let _=`${Q?`[${Q}]`:""} Unknown prop: "${K}"`;if(W.warnings.push(_),Y)console.warn(_)}if(Z&&!W.valid){let K=W.errors.map((_)=>_.message).join(`
|
|
4469
4469
|
`);throw Error(`Prop validation failed:
|
|
4470
|
-
${K}`)}return{props:G,validation:W}}function sY($,X){let Q={...$};for(let[Z,Y]of Object.entries(X))if(Q[Z]===void 0)Q[Z]=typeof Y==="function"?Y():Y;return Q}function nY($){return $}function oY($){return{type:$,required:!0}}function tY($,X){return{type:X,default:$}}function eY($,X={}){return{...X,validator:$}}function $J($,X={}){return{...X,validator:(Q)=>$.includes(Q)}}function XJ($,X={}){return{...X,type:Array,validator:(Q)=>{if(!Array.isArray(Q))return!1;return!0}}}function QJ($,X={}){return{...X,type:Object}}function ZJ($,X,Q){if(!X)return $;let Z={};for(let[Y,J]of Object.entries(X)){let G=typeof J==="function"||Array.isArray(J)?{type:J}:J||{},W=$[Y];if(W===void 0&&G.default!==void 0)W=typeof G.default==="function"?G.default():G.default;{let K=n7(Y,W,G,Q);if(K)console.warn(K.message)}Z[Y]=W}for(let[Y,J]of Object.entries($))if(!(Y in Z))Z[Y]=J;return Z}var
|
|
4471
|
-
export{JK as o,i$ as p,U6 as q,F4 as r,D0 as s,t1 as t,e1 as u,$$ as v,X$ as w,A1 as x,t7 as y,e7 as z,$3 as A,X3 as B,Q3 as C,Z3 as D,WJ as E,KJ as F,_J as G,Y3 as H,UJ as I,J3 as J,BJ as K,LJ as L,FJ as M,zJ as N,jJ as O,OJ as P,HJ as Q,AJ as R,qJ as S,NJ as T,s0 as U,MJ as V,VJ as W,EJ as X,IJ as Y,DJ as Z,wJ as _,W3 as $,K3 as aa,TJ as ba,_3 as ca,CJ as da,xJ as ea,kJ as fa,SJ as ga,PJ as ha,bJ as ia,U3 as ja,B3 as ka,yJ as la,vJ as ma,L3 as na,fJ as oa,mJ as pa,pJ as qa,e5 as ra,q3 as sa,N3 as ta,M3 as ua,V3 as va,m$ as wa,E3 as xa,I3 as ya,R3 as za,D3 as Aa,lJ as Ba,nJ as Ca,oJ as Da,C3 as Ea,tJ as Fa,QG as Ga,M4 as Ha,bW as Ia,E4 as Ja,I4 as Ka,y4 as La,v4 as Ma,g4 as Na,p6 as Oa,f4 as Pa,h4 as Qa,d4 as Ra,u4 as Sa,m4 as Ta,p4 as Ua,c4 as Va,uW as Wa,I1 as Xa,lW as Ya,iW as Za,l4 as _a,i4 as $a,s4 as ab,F$ as bb,aW as cb,rW as db,sW as eb,nW as fb,oW as gb,tW as hb,eW as ib,$2 as jb,X2 as kb,Q2 as lb,Z2 as mb,Y2 as nb,XX as ob,G2 as pb,U2 as qb,B2 as rb,_5 as sb,A2 as tb,q2 as ub,N2 as vb,V2 as wb,T2 as xb,C2 as yb,x2 as zb,k2 as Ab,S2 as Bb,P2 as Cb,c2 as Db,$Q as Eb,l2 as Fb,XQ as Gb,QQ as Hb,G8 as Ib,W8 as Jb,r2 as Kb,s2 as Lb,n2 as Mb,t2 as Nb,e2 as Ob,_Q as Pb,XK as Qb,QK as Rb,ZK as Sb,z6 as Tb,U8 as Ub,WK as Vb,KK as Wb,_K as Xb,UK as Yb,UQ as Zb,BQ as _b,LK as $b,LQ as ac,L8 as bc,FK as cc,FQ as dc,zK as ec,jK as fc,zQ as gc,IK as hc,j8 as ic,OQ as jc,HQ as kc,O8 as lc,qQ as mc,NQ as nc,VQ as oc,h as pc,H8 as qc,H5 as rc,A8 as sc,q8 as tc,N8 as uc,M8 as vc,V8 as wc,E8 as xc,I8 as yc,R8 as zc,D8 as Ac,w8 as Bc,T8 as Cc,C8 as Dc,x8 as Ec,k8 as Fc,S8 as Gc,P8 as Hc,b8 as Ic,y8 as Jc,v8 as Kc,g8 as Lc,A5 as Mc,f8 as Nc,h8 as Oc,d8 as Pc,u8 as Qc,m8 as Rc,c8 as Sc,q5 as Tc,N5 as Uc,l8 as Vc,M5 as Wc,V5 as Xc,E5 as Yc,b1 as Zc,j$ as _c,i8 as $c,a8 as ad,r8 as bd,O$ as cd,n8 as dd,o8 as ed,t8 as fd,e8 as gd,LZ as hd,FZ as id,I5 as jd,R5 as kd,Y7 as ld,v0 as md,J7 as nd,G7 as od,W7 as pd,K7 as qd,_7 as rd,H$ as sd,D5 as td,B7 as ud,A$ as vd,L7 as wd,F7 as xd,z7 as yd,j7 as zd,q$ as Ad,N$ as Bd,w5 as Cd,T5 as Dd,H7 as Ed,A7 as Fd,q7 as Gd,M$ as Hd,N7 as Id,MZ as Jd,m_ as Kd,M7 as Ld,VZ as Md,Y9 as Nd,J9 as Od,W9 as Pd,TZ as Qd,CZ as Rd,C5 as Sd,xZ as Td,kZ as Ud,SZ as Vd,PZ as Wd,bZ as Xd,yZ as Yd,vZ as Zd,gZ as _d,fZ as $d,hZ as ae,_1 as be,U1 as ce,mZ as de,pZ as ee,K1 as fe,lZ as ge,y1 as he,aZ as ie,rZ as je,sZ as ke,nZ as le,w7 as me,oZ as ne,tZ as oe,C7 as pe,$Y as qe,XY as re,D$ as se,w$ as te,T$ as ue,C$ as ve,x$ as we,b5 as xe,k$ as ye,h0 as ze,h7 as Ae,S$ as Be,P$ as Ce,i7 as De,a7 as Ee,cY as Fe,lY as Ge,aY as He,rY as Ie,sY as Je,nY as Ke,oY as Le,tY as Me,eY as Ne,$J as Oe,XJ as Pe,QJ as Qe,ZJ as Re,
|
|
4470
|
+
${K}`)}return{props:G,validation:W}}function sY($,X){let Q={...$};for(let[Z,Y]of Object.entries(X))if(Q[Z]===void 0)Q[Z]=typeof Y==="function"?Y():Y;return Q}function nY($){return $}function oY($){return{type:$,required:!0}}function tY($,X){return{type:X,default:$}}function eY($,X={}){return{...X,validator:$}}function $J($,X={}){return{...X,validator:(Q)=>$.includes(Q)}}function XJ($,X={}){return{...X,type:Array,validator:(Q)=>{if(!Array.isArray(Q))return!1;return!0}}}function QJ($,X={}){return{...X,type:Object}}function ZJ($,X,Q){if(!X)return $;let Z={};for(let[Y,J]of Object.entries(X)){let G=typeof J==="function"||Array.isArray(J)?{type:J}:J||{},W=$[Y];if(W===void 0&&G.default!==void 0)W=typeof G.default==="function"?G.default():G.default;{let K=n7(Y,W,G,Q);if(K)console.warn(K.message)}Z[Y]=W}for(let[Y,J]of Object.entries($))if(!(Y in Z))Z[Y]=J;return Z}var _B={};
|
|
4471
|
+
export{JK as o,i$ as p,U6 as q,F4 as r,D0 as s,t1 as t,e1 as u,$$ as v,X$ as w,A1 as x,t7 as y,e7 as z,$3 as A,X3 as B,Q3 as C,Z3 as D,WJ as E,KJ as F,_J as G,Y3 as H,UJ as I,J3 as J,BJ as K,LJ as L,FJ as M,zJ as N,jJ as O,OJ as P,HJ as Q,AJ as R,qJ as S,NJ as T,s0 as U,MJ as V,VJ as W,EJ as X,IJ as Y,DJ as Z,wJ as _,W3 as $,K3 as aa,TJ as ba,_3 as ca,CJ as da,xJ as ea,kJ as fa,SJ as ga,PJ as ha,bJ as ia,U3 as ja,B3 as ka,yJ as la,vJ as ma,L3 as na,fJ as oa,mJ as pa,pJ as qa,e5 as ra,q3 as sa,N3 as ta,M3 as ua,V3 as va,m$ as wa,E3 as xa,I3 as ya,R3 as za,D3 as Aa,lJ as Ba,nJ as Ca,oJ as Da,C3 as Ea,tJ as Fa,QG as Ga,M4 as Ha,bW as Ia,E4 as Ja,I4 as Ka,y4 as La,v4 as Ma,g4 as Na,p6 as Oa,f4 as Pa,h4 as Qa,d4 as Ra,u4 as Sa,m4 as Ta,p4 as Ua,c4 as Va,uW as Wa,I1 as Xa,lW as Ya,iW as Za,l4 as _a,i4 as $a,s4 as ab,F$ as bb,aW as cb,rW as db,sW as eb,nW as fb,oW as gb,tW as hb,eW as ib,$2 as jb,X2 as kb,Q2 as lb,Z2 as mb,Y2 as nb,XX as ob,G2 as pb,U2 as qb,B2 as rb,_5 as sb,A2 as tb,q2 as ub,N2 as vb,V2 as wb,T2 as xb,C2 as yb,x2 as zb,k2 as Ab,S2 as Bb,P2 as Cb,c2 as Db,$Q as Eb,l2 as Fb,XQ as Gb,QQ as Hb,G8 as Ib,W8 as Jb,r2 as Kb,s2 as Lb,n2 as Mb,t2 as Nb,e2 as Ob,_Q as Pb,XK as Qb,QK as Rb,ZK as Sb,z6 as Tb,U8 as Ub,WK as Vb,KK as Wb,_K as Xb,UK as Yb,UQ as Zb,BQ as _b,LK as $b,LQ as ac,L8 as bc,FK as cc,FQ as dc,zK as ec,jK as fc,zQ as gc,IK as hc,j8 as ic,OQ as jc,HQ as kc,O8 as lc,qQ as mc,NQ as nc,VQ as oc,h as pc,H8 as qc,H5 as rc,A8 as sc,q8 as tc,N8 as uc,M8 as vc,V8 as wc,E8 as xc,I8 as yc,R8 as zc,D8 as Ac,w8 as Bc,T8 as Cc,C8 as Dc,x8 as Ec,k8 as Fc,S8 as Gc,P8 as Hc,b8 as Ic,y8 as Jc,v8 as Kc,g8 as Lc,A5 as Mc,f8 as Nc,h8 as Oc,d8 as Pc,u8 as Qc,m8 as Rc,c8 as Sc,q5 as Tc,N5 as Uc,l8 as Vc,M5 as Wc,V5 as Xc,E5 as Yc,b1 as Zc,j$ as _c,i8 as $c,a8 as ad,r8 as bd,O$ as cd,n8 as dd,o8 as ed,t8 as fd,e8 as gd,LZ as hd,FZ as id,I5 as jd,R5 as kd,Y7 as ld,v0 as md,J7 as nd,G7 as od,W7 as pd,K7 as qd,_7 as rd,H$ as sd,D5 as td,B7 as ud,A$ as vd,L7 as wd,F7 as xd,z7 as yd,j7 as zd,q$ as Ad,N$ as Bd,w5 as Cd,T5 as Dd,H7 as Ed,A7 as Fd,q7 as Gd,M$ as Hd,N7 as Id,MZ as Jd,m_ as Kd,M7 as Ld,VZ as Md,Y9 as Nd,J9 as Od,W9 as Pd,TZ as Qd,CZ as Rd,C5 as Sd,xZ as Td,kZ as Ud,SZ as Vd,PZ as Wd,bZ as Xd,yZ as Yd,vZ as Zd,gZ as _d,fZ as $d,hZ as ae,_1 as be,U1 as ce,mZ as de,pZ as ee,K1 as fe,lZ as ge,y1 as he,aZ as ie,rZ as je,sZ as ke,nZ as le,w7 as me,oZ as ne,tZ as oe,C7 as pe,$Y as qe,XY as re,D$ as se,w$ as te,T$ as ue,C$ as ve,x$ as we,b5 as xe,k$ as ye,h0 as ze,h7 as Ae,S$ as Be,P$ as Ce,i7 as De,a7 as Ee,cY as Fe,lY as Ge,aY as He,rY as Ie,sY as Je,nY as Ke,oY as Le,tY as Me,eY as Ne,$J as Oe,XJ as Pe,QJ as Qe,ZJ as Re,_B as Se,j4 as Te,q6 as Ue,H4 as Ve,q4 as We};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{ap as V}from"./chunk-
|
|
2
|
+
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{ap as V}from"./chunk-kq4z185m.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-a2yanhxh.js";import"./chunk-9vpqzs8r.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import{Eu as F}from"./chunk-q891e1vj.js";import l from"fs";import R from"path";function m(z,J){let Z=[R.join(z.root,"stx.config.ts"),R.join(z.root,"stx.config.js"),R.join(z.root,"stx.config.mjs")],K=J.debounceMs??300,$=null,X=[];for(let B of Z)try{if(!l.existsSync(B))continue;let Y=l.watch(B,(W)=>{if(W==="change"){if($)clearTimeout($);$=setTimeout(async()=>{d("Config file changed, restarting...");try{await J.onChange()}catch(j){G(`Failed to restart: ${j}`)}},K)}});X.push(Y)}catch{}return{stop(){if($)clearTimeout($);for(let B of X)B.close()}}}import E from"fs";import i from"path";var Gz=".stx/story/analytics.json",Nz=1,c=1e4;class M{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(z){this.storagePath=i.join(z,Gz),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let z=E.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Nz,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let z=i.dirname(this.storagePath);if(await E.promises.mkdir(z,{recursive:!0}),this.storage.events.length>c)this.storage.events=this.storage.events.slice(-c);await E.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Hz(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(z){this.storage.events.push({...z,timestamp:Date.now()}),this.dirty=!0}trackView(z,J){if(this.endViewTiming(z),this.viewStartTimes.set(z,Date.now()),this.track({type:"view",componentId:z,variantId:J}),this.currentSession&&!this.currentSession.componentViews.includes(z))this.currentSession.componentViews.push(z)}endViewTiming(z){let J=this.viewStartTimes.get(z);if(J){let Z=Date.now()-J;this.track({type:"view",componentId:z,metadata:{duration:Z,endView:!0}}),this.viewStartTimes.delete(z)}}trackPropChange(z,J,Z){this.track({type:"prop_change",componentId:z,propName:J,metadata:{value:Z}})}trackVariantSwitch(z,J){this.track({type:"variant_switch",componentId:z,variantId:J})}trackSearch(z,J){this.track({type:"search",query:z,metadata:{resultCount:J}})}getComponentAnalytics(z,J){let Z=this.storage.events.filter((Q)=>Q.componentId===z),K=Z.filter((Q)=>Q.type==="view"&&!Q.metadata?.endView),$=Z.filter((Q)=>Q.type==="prop_change"),X=Z.filter((Q)=>Q.type==="variant_switch"),B={};for(let Q of $)if(Q.propName)B[Q.propName]=(B[Q.propName]||0)+1;let Y={};for(let Q of X)if(Q.variantId)Y[Q.variantId]=(Y[Q.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((Q)=>Q.componentViews.includes(z)).map((Q)=>Q.id)),j=Z.filter((Q)=>Q.metadata?.duration).map((Q)=>Q.metadata.duration),U=j.length>0?j.reduce((Q,D)=>Q+D,0)/j.length:0,_=Object.entries(B).sort((Q,D)=>D[1]-Q[1]).slice(0,5).map(([Q])=>Q);return{componentId:z,componentName:J,viewCount:K.length,uniqueViews:W.size,lastViewed:K[K.length-1]?.timestamp,propChanges:B,topChangedProps:_,variantViews:Y,avgTimeSpent:U}}getMostViewedComponents(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="view"&&Z.componentId&&!Z.metadata?.endView)J.set(Z.componentId,(J.get(Z.componentId)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({componentId:Z,viewCount:K})).sort((Z,K)=>K.viewCount-Z.viewCount).slice(0,z)}getMostChangedProps(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="prop_change"&&Z.propName)J.set(Z.propName,(J.get(Z.propName)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({propName:Z,changeCount:K})).sort((Z,K)=>K.changeCount-Z.changeCount).slice(0,z)}getSearchAnalytics(){let z=this.storage.events.filter(($)=>$.type==="search"),J=new Map,Z=0;for(let $ of z){if($.query)J.set($.query,(J.get($.query)||0)+1);if($.metadata?.resultCount!==void 0)Z+=$.metadata.resultCount}let K=Array.from(J.entries()).map(([$,X])=>({query:$,count:X})).sort(($,X)=>X.count-$.count).slice(0,10);return{totalSearches:z.length,topQueries:K,avgResultCount:z.length>0?Z/z.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Hz(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import P from"fs";import p from"path";var Fz=".stx/story/bookmarks.json",Vz=1;class T{storage;storagePath;dirty=!1;constructor(z){this.storagePath=p.join(z,Fz),this.storage=this.loadStorage()}loadStorage(){try{let z=P.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Vz,bookmarks:[]}}}async save(){if(!this.dirty)return;let z=p.dirname(this.storagePath);await P.promises.mkdir(z,{recursive:!0}),await P.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(z,J,Z,K={}){let $={id:Rz(),name:K.name||`${z}/${J}`,storyId:z,variantId:J,props:Z,created:Date.now(),notes:K.notes,color:K.color};return this.storage.bookmarks.push($),this.dirty=!0,$}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(z){return this.storage.bookmarks.filter((J)=>J.storyId===z)}getBookmark(z){return this.storage.bookmarks.find((J)=>J.id===z)}isBookmarked(z,J){return this.storage.bookmarks.some((Z)=>Z.storyId===z&&Z.variantId===J)}updateBookmark(z,J){let Z=this.getBookmark(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deleteBookmark(z){let J=this.storage.bookmarks.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.bookmarks.splice(J,1),this.dirty=!0,!0}toggleBookmark(z,J,Z){let K=this.storage.bookmarks.find((X)=>X.storyId===z&&X.variantId===J);if(K)return this.deleteBookmark(K.id),{added:!1};return{added:!0,bookmark:this.addBookmark(z,J,Z)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(z,J=!0){let Z=JSON.parse(z),K=0;for(let $ of Z.bookmarks){if(J){let X=this.storage.bookmarks.find((B)=>B.id===$.id);if(X)Object.assign(X,$);else this.storage.bookmarks.push($)}else this.storage.bookmarks.push($);K++}if(K>0)this.dirty=!0;return K}}function Rz(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var N=new Set;function s(){return{open(z){N.add(z),z.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(z){N.delete(z)},message(z,J){}}}function q(z){let J=JSON.stringify({...z,timestamp:z.timestamp||Date.now()});for(let Z of N)try{Z.send(J)}catch{N.delete(Z)}}function n(z,J){q({type:"story-update",data:{storyId:z,...J}})}function a(z,J){q({type:"story-add",data:{storyId:z,...J}})}function o(z){q({type:"story-remove",data:{storyId:z}})}function r(z){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${z}');
|
|
@@ -556,7 +556,7 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-
|
|
559
|
+
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-ejm3bypm.js"),j={},U=A(Y);if(U)try{await V(U,j,J)}catch(O){$.push(`Warning: Could not extract script variables: ${O instanceof Error?O.message:String(O)}`)}if(Z.props)Object.assign(j,Z.props);let Q=await W(Y,j,J,{},new Set),D=Wz(Y),L=A(Y);return Q=jz(Q),Q=Dz(Q,j),{html:Q,css:D,js:L,errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}async function qz(z){try{let J=await S.promises.readFile(z,"utf-8"),Z=A(J);if(!Z)return null;let K={};if(await V(Z,K,z),Array.isArray(K.variants))return K.variants;return null}catch{return null}}async function Bz(z,J,Z,K){let $=J.story?.variants;if(!$){let Y=await qz(J.path);if(Y)$=Y}if(!$&&Z==="default")return H(z,J.path,{props:K||{}});if(!$)return H(z,J.path,{props:K||{}});let X=$.find((Y)=>Y.id===Z);if(!X&&Z==="default")return H(z,J.path,{props:K||{}});if(!X)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Z}' not found`],duration:0};let B={...X.state,...K};if(X.source)return wz(z,X.source,B);return H(z,J.path,{props:B})}async function wz(z,J,Z={}){let K=performance.now(),$=[];try{let{processDirectives:X}=await import("./chunk-ejm3bypm.js"),B={...Z},Y=A(J);if(Y)try{await V(Y,B,"inline-template.stx")}catch{}let j=await X(J,B,"inline-template.stx",{},new Set);return j=jz(j),j=Dz(j,B),{html:j,css:Wz(J),js:A(J),errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}function Wz(z){let J=[],Z=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
560
560
|
`)}function jz(z){return z.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function A(z){let J=[],Z=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
561
561
|
`)}function Dz(z,J){let Z=`<script>window.__stxProps = ${JSON.stringify(J)};</script>`;return z+Z}function Lz(z){return z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function Oz(z,J){let Z=await I(z);f(z,Z);let K=v(z.config,Z);g(z,K),console.log(` Found ${Z.length} story files`);let $=typeof J.host==="string"?J.host:J.host===!0?"0.0.0.0":"localhost",X=new k(z.root),B=new T(z.root),Y=new M(z.root),W=s(),j=Bun.serve({port:J.port,hostname:$,fetch:async(Q,D)=>{let O=new URL(Q.url).pathname;if(O==="/__hmr"){if(D.upgrade(Q,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(O.startsWith("/api/"))return Cz(z,O,Q,{presetsManager:X,bookmarksManager:B,analyticsTracker:Y});return kz(z,O,J.port)},websocket:{open(Q){W.open(Q)},close(Q){W.close(Q)},message(Q,D){W.message(Q,D)}}}),U=`http://${$}:${J.port}`,_=Uz(z,async(Q,D)=>{console.log(` [${Q}] ${D.relativePath}`);let L=await I(z);f(z,L);let O=v(z.config,L);if(g(z,O),Q==="add")a(D.id,{fileName:D.fileName});else if(Q==="unlink")o(D.id);else n(D.id,{fileName:D.fileName})});if(J.open){let Q=U;try{let{exec:D}=await import("child_process"),L=process.platform;D(`${L==="darwin"?"open":L==="win32"?"start":"xdg-open"} ${Q}`)}catch{}}return{server:j,url:U,close:async()=>{_(),j.stop()}}}async function Cz(z,J,Z,K){let{presetsManager:$,bookmarksManager:X,analyticsTracker:B}=K;if(J==="/api/stories")return Response.json({files:z.storyFiles.map((Y)=>({id:Y.id,fileName:Y.fileName,relativePath:Y.relativePath,treePath:Y.treePath})),tree:z.tree});if(J.startsWith("/api/story/")){let Y=J.slice(11),W=z.storyFiles.find((j)=>j.id===Y);if(!W)return new Response("Story not found",{status:404});try{let j=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:j})}catch{return new Response("Error reading story",{status:500})}}if(J==="/api/config")return Response.json({theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets});if(J.startsWith("/api/render/")){let Y=new URL(Z.url),W=J.slice(12).split("/"),j=W[0],U=W[1]||"default",_,Q=Y.searchParams.get("props");if(Q)try{_=JSON.parse(Q)}catch{}let D=z.storyFiles.find((L)=>L.id===j);if(!D)return new Response("Story not found",{status:404});try{let L=await Bz(z,D,U,_);return Response.json({html:L.html,css:L.css,js:L.js,errors:L.errors,duration:L.duration})}catch(L){return Response.json({html:"",css:"",js:"",errors:[L instanceof Error?L.message:String(L)],duration:0},{status:500})}}if(J==="/api/presets"&&Z.method==="GET")return Response.json({presets:$.getAllPresets()});if(J==="/api/presets"&&Z.method==="POST")try{let Y=await Z.json(),W=$.createPreset(Y.name,Y.props,{componentId:Y.componentId,description:Y.description});return await $.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/presets/")&&!J.includes("/use")&&Z.method==="GET"){let Y=J.slice(13),W=$.getPreset(Y);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(J.endsWith("/use")&&Z.method==="POST"){let Y=J.slice(13,-4),W=$.usePreset(Y);if(!W)return new Response("Preset not found",{status:404});return await $.save(),Response.json(W)}if(J.startsWith("/api/presets/")&&Z.method==="DELETE"){let Y=J.slice(13);if(!$.deletePreset(Y))return new Response("Preset not found",{status:404});return await $.save(),Response.json({success:!0})}if(J==="/api/bookmarks"&&Z.method==="GET")return Response.json({bookmarks:X.getAllBookmarks()});if(J==="/api/bookmarks"&&Z.method==="POST")try{let Y=await Z.json(),W=X.addBookmark(Y.storyId,Y.variantId,Y.props,{name:Y.name,notes:Y.notes,color:Y.color});return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/bookmarks/toggle"&&Z.method==="POST")try{let Y=await Z.json(),W=X.toggleBookmark(Y.storyId,Y.variantId,Y.props);return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/bookmarks/")&&J!=="/api/bookmarks/toggle"&&Z.method==="GET"){let Y=J.slice(15),W=X.getBookmark(Y);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(J.startsWith("/api/bookmarks/")&&Z.method==="DELETE"){let Y=J.slice(15);if(!X.deleteBookmark(Y))return new Response("Bookmark not found",{status:404});return await X.save(),Response.json({success:!0})}if(J==="/api/analytics/track"&&Z.method==="POST")try{let Y=await Z.json();if(Y.type==="view"&&Y.componentId)B.trackView(Y.componentId,Y.variantId);else if(Y.type==="prop_change"&&Y.componentId&&Y.propName)B.trackPropChange(Y.componentId,Y.propName,null);else if(Y.type==="variant_switch"&&Y.componentId&&Y.variantId)B.trackVariantSwitch(Y.componentId,Y.variantId);else if(Y.type==="search"&&Y.query)B.trackSearch(Y.query,0);return await B.save(),Response.json({success:!0})}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/analytics/summary"&&Z.method==="GET")return Response.json({mostViewed:B.getMostViewedComponents(10),mostChangedProps:B.getMostChangedProps(10),searchAnalytics:B.getSearchAnalytics()});if(J.startsWith("/api/analytics/component/")&&Z.method==="GET"){let Y=J.slice(25),W=z.storyFiles.find((U)=>U.id===Y),j=B.getComponentAnalytics(Y,W?.fileName||Y);return Response.json(j)}return new Response("Not found",{status:404})}function kz(z,J,Z){let K=Sz(z,Z);return new Response(K,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Sz(z,J){let{theme:Z}=z.config,K=Z.title||"STX Story",$=`ws://localhost:${J}/__hmr`,X=r($);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${Z.darkClass||"dark"}">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{Broadcast as D,BroadcastServer as U}from"ts-broadcasting";import{channel as b}from"ts-broadcasting";import{Broadcast as N,BroadcastServer as p}from"ts-broadcasting";var z=null,H=[];function X(){return z}async function Y(j){if(z)return z;let k=j.driver??"bun",q=j.host??"0.0.0.0",G=j.port??6001,J=j.scheme??"ws",E={verbose:j.verbose??!1,driver:k,default:k,connections:{[k]:{driver:k,host:q,port:G,scheme:J}}};return z=new U(E),D.setServer(z),await z.start(),z}async function Z(){for(let j of H)clearInterval(j);if(H.length=0,!z)return;await z.stop(),z=null}async function $(j){let k=await import(j),q=k.default??k;if(typeof q!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof q}`);let G=0;return q({channel(E,A){if(G++,A.authorize&&z)z.channels.channel(E,A.authorize);if(A.interval&&A.data){let L=A.event??`${E}.updated`,M=A.data,Q=setInterval(async()=>{try{let T=await M();V(E,L,T)}catch{}},A.interval);H.push(Q)}}}),G}var K=!1;function F(){if(z)return!0;if(!K)K=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function V(j,k,q){if(!F())return;D.send(j,k,q)}function x(j,k,q){if(!F())return;D.toUser(j,k,q)}function C(j,k,q){if(!F())return;D.toUsers(j,k,q)}function S(j,k,q){if(!F())return;D.send(`private-${j}`,k,q)}function w(j,k,q){if(!F())return;D.presence(j,k,q)}
|
|
3
|
-
export{X as
|
|
3
|
+
export{X as qf,Y as rf,Z as sf,$ as tf,V as uf,x as vf,C as wf,S as xf,w as yf,b as zf,N as Af,p as Bf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Qq as q,Uq as y}from"./chunk-
|
|
2
|
+
import{Qq as q,Uq as y}from"./chunk-kq4z185m.js";import{Eu as L}from"./chunk-q891e1vj.js";import M from"fs";import X from"path";var T=new Map,Q=new Map;async function A(j){let z;for(let K=0;K<3;K++)try{let V=(await M.promises.stat(j)).mtime.getTime(),J=Q.get(j);if(J&&J.mtime===V)return J.content;let W=await Bun.file(j).text(),U=(await M.promises.stat(j)).mtime.getTime();if(U!==V)continue;return Q.set(j,{content:W,mtime:U}),W}catch(I){z=I;break}throw Q.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function H(j){Q.delete(j)}function v(j){for(let B of Q.keys())if(B.startsWith(j))Q.delete(B)}var Z=null,b=null,N=null;function E(j){N=j}async function F(j=!1){let B=N??await import("./chunk-mjv4ar2y.js");if(j)return B.generateSignalsRuntimeDev();if(Z===null)Z=B.generateSignalsRuntime();return Z}var $=null;async function R(){if($===null){let{getRouterScript:j}=await import("./chunk-0yw0x5qz.js");$=j()}return $}function S(){Q.clear(),y(),Z=null,b=null,$=null}function k(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function _(j,B){try{if(!B.cachePath)return null;let z=X.resolve(B.cachePath),K=X.join(z,`${D(j)}.html`),I=X.join(z,`${D(j)}.meta.json`);if(!await q(K)||!await q(I))return null;let V=await Bun.file(I).text(),J=JSON.parse(V);if(J.cacheVersion!==B.cacheVersion)return null;if(J.optionsSignature!==k(B))return null;if((await M.promises.stat(j)).mtime.getTime()>J.mtime)return null;for(let Y of J.dependencies)if(await q(Y)){if((await M.promises.stat(Y)).mtime.getTime()>J.mtime)return null}else return null;return await Bun.file(K).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function g(j,B,z,K){try{if(!K.cachePath)return;let I=X.resolve(K.cachePath);await M.promises.mkdir(I,{recursive:!0});let V=X.join(I,`${D(j)}.html`),J=X.join(I,`${D(j)}.meta.json`),W=await M.promises.stat(j);await Bun.write(V,B);let Y={sourcePath:j,mtime:W.mtime.getTime(),dependencies:Array.from(z),cacheVersion:K.cacheVersion,optionsSignature:k(K),generatedAt:Date.now()};await Bun.write(J,JSON.stringify(Y,null,2)),T.set(j,{output:B,mtime:W.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var G=16;function D(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,G)}
|
|
3
3
|
export{T as Ni,A as Oi,H as Pi,v as Qi,E as Ri,F as Si,R as Ti,S as Ui,_ as Vi,g as Wi,D as Xi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ci as a,di as b,ei as c,fi as d,gi as e,hi as f,ii as g}from"./chunk-snktca7b.js";import"./chunk-
|
|
2
|
+
import{ci as a,di as b,ei as c,fi as d,gi as e,hi as f,ii as g}from"./chunk-snktca7b.js";import"./chunk-q891e1vj.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-
|
|
2
|
+
import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-q891e1vj.js";import E from"fs";import K from"path";var V=[];function _(U){V=[];for(let A of U.storyFiles)if(V.push({text:A.fileName.toLowerCase(),original:A.fileName,type:"story",storyId:A.id}),V.push({text:A.relativePath.toLowerCase(),original:A.relativePath,type:"story",storyId:A.id}),A.story)for(let z of A.story.variants)V.push({text:z.title.toLowerCase(),original:z.title,type:"story",storyId:A.id,variantId:z.id})}function $(){return JSON.stringify(V)}async function O(U={}){let A=Date.now();N();let z=await k({mode:"build"});if(!z.config.enabled){W("Story feature is disabled in config.");return}let P=await H(z);w(z,P);let Y=J(z.config,P);B(z,Y),R(P.length);let X=U.outDir??z.config.outDir,Q=K.resolve(z.root,X);await E.promises.mkdir(Q,{recursive:!0}),console.log(` Building to ${X}...`);let M=F(z);await E.promises.writeFile(K.join(Q,"index.html"),M);let v={files:P.map((G)=>({id:G.id,fileName:G.fileName,relativePath:G.relativePath,treePath:G.treePath})),tree:Y};await E.promises.writeFile(K.join(Q,"stories.json"),JSON.stringify(v,null,2));let L={theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets};await E.promises.writeFile(K.join(Q,"config.json"),JSON.stringify(L,null,2));let Z=K.join(Q,"stories");await E.promises.mkdir(Z,{recursive:!0});for(let G of P){let g=await E.promises.readFile(G.path,"utf-8");await E.promises.writeFile(K.join(Z,`${G.id}.stx`),g)}_(z);let T=$();await E.promises.writeFile(K.join(Q,"search-index.json"),T);let C=Date.now()-A;j(P.length,X,C)}function F(U){let{theme:A}=U.config,z=A.title||"STX Story";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Eu as Y}from"./chunk-q891e1vj.js";import{mkdir as O,writeFile as q}from"fs/promises";import{join as X}from"path";var T="https://api.iconify.design";async function k(){let E=await fetch(`${T}/collections`);if(!E.ok)throw Error(`Failed to fetch collections: ${E.statusText}`);return await E.json()}async function P(E,z){try{let U=Y.resolve("@iconify/json"),S=`${`${U.substring(0,U.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${E}.json`,M=Bun.file(S);if(await M.exists()){let V=await M.json();if(z&&z.length>0){let Z={};for(let L of z)if(V.icons[L])Z[L]=V.icons[L];return{...V,icons:Z}}return V}}catch{}let K=z&&z.length>0?`${T}/${E}.json?icons=${z.join(",")}`:`${T}/${E}.json`,Q=await fetch(K);if(!Q.ok)throw Error(`Failed to fetch icons for ${E}: ${Q.statusText}`);return await Q.json()}function j(E,z=24,K=24){return{body:E.body,width:E.width||z,height:E.height||K,viewBox:`0 0 ${E.width||z} ${E.height||K}`}}function F(E,z){let K=B(E);return`import type { IconData } from '@stacksjs/iconify-core'
|
|
3
3
|
|
|
4
4
|
export const ${K}: IconData = ${JSON.stringify(z,null,2)}
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Eu as v}from"./chunk-q891e1vj.js";function D4(){if(typeof Notification<"u"&&Notification.permission==="granted")return!0;return!1}function zZ(){return typeof window<"u"&&typeof document<"u"}async function M4(){if(typeof Notification>"u")return!1;if(Notification.permission==="granted")return!0;if(Notification.permission==="denied")return!1;return await Notification.requestPermission()==="granted"}var y=new Map;function T4(){return`alert-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function _4(Z){switch(Z){case"info":return"ℹ";case"success":return"✔";case"warning":return"⚠";case"error":return"✖";default:return"ℹ"}}function N4(Z="top-right"){if(!zZ())throw Error("Toast container requires browser environment");try{let $=document.querySelector(`.stx-toast-container[data-position="${Z}"]`);if($)return $}catch{}let Y=document.createElement("div");Y.className=`stx-toast-container ${Z}`,Y.dataset.position=Z;try{if(document.body)document.body.appendChild(Y)}catch{}return Y}function E4(Z){let{options:Y}=Z,$=_4(Y.type),J=Y.type||"info",G=Y.duration!==0;return`
|
|
3
3
|
<div class="stx-toast ${J}" data-alert-id="${Z.id}" role="alert" aria-live="polite">
|
|
4
4
|
<div class="stx-toast-icon">${$}</div>
|
|
5
5
|
<div class="stx-toast-content">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_r as E}from"./chunk-
|
|
3
|
-
export{M as
|
|
2
|
+
import{_r as E}from"./chunk-kq4z185m.js";import{Eu as D}from"./chunk-q891e1vj.js";import I from"path";async function M(q={}){let G=performance.now(),J=q.root||process.cwd(),j=await E(),y=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${y.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let A,B;if(y==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");A=await z({pagesDir:I.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,...q.ssg})}else{let{buildForProduction:z}=await import("./chunk-gmj16etx.js");B=await z({outputDir:".output",debug:q.debug,...q.ssr})}let H=Math.round(performance.now()-G);return{mode:y,ssg:A,ssr:B,duration:H}}
|
|
3
|
+
export{M as Ef};
|