@stacksjs/desktop 0.2.638 → 0.2.639
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/index.js +31 -31
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u,P,c,r,S,k,A,C,I,T,E,M,D,t,p,B,O,R,f,L,_,N,F,W,z,H,U,n,q,V,j,K,G,Y,X,l,J,Q,Z,ee,m,te,re,g,ne,oe,ie,ae,se,ce,le,e,de,ue,pe,fe,me,ge,he,we,be,xe,ye,ve,Pe,Se,ke,Ae,Ce,h,Ie,$e,Te,Ee,Me,De,Be,Oe,Re,o,w,b,Le,i,_e,Ne,Fe,x,y,a,s,We,d,ze,He,Ue,qe,Ve,je,Ke,Ge,Ye,Xe,Je,Qe,Ze,et,tt,rt,nt,ot,it,at,v,st}from"./chunk-tyk2bp3f.js";function Tt(
|
|
2
|
+
import{u,P,c,r,S,k,A,C,I,T,E,M,D,t,p,B,O,R,f,L,_,N,F,W,z,H,U,n,q,V,j,K,G,Y,X,l,J,Q,Z,ee,m,te,re,g,ne,oe,ie,ae,se,ce,le,e,de,ue,pe,fe,me,ge,he,we,be,xe,ye,ve,Pe,Se,ke,Ae,Ce,h,Ie,$e,Te,Ee,Me,De,Be,Oe,Re,o,w,b,Le,i,_e,Ne,Fe,x,y,a,s,We,d,ze,He,Ue,qe,Ve,je,Ke,Ge,Ye,Xe,Je,Qe,Ze,et,tt,rt,nt,ot,it,at,v,st}from"./chunk-tyk2bp3f.js";function Tt(dt="stx"){return`${dt}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function vt(dt){return dt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function St(...dt){return dt.filter(Boolean).join(" ")}function Pt(dt){if(!dt)return"";return Object.entries(dt).map(([lt,ct])=>`${lt.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${ct}`).join("; ")}function Po(dt){let{text:lt,variant:ct="primary",size:pt="medium",disabled:ut=!1,loading:ft=!1,icon:bt,iconPosition:mt="left",id:xt=Tt("btn"),className:yt,style:ht}=dt,wt=St("stx-button",`stx-button--${ct}`,`stx-button--${pt}`,ut&&"stx-button--disabled",ft&&"stx-button--loading",yt),gt=Pt(ht),$t=bt?`<span class="stx-button-icon">${bt}</span>`:"",kt=ft?'<span class="stx-button-spinner"></span>':"",Ct=mt==="left"?`${$t}${kt}<span class="stx-button-text">${vt(lt)}</span>`:`<span class="stx-button-text">${vt(lt)}</span>${$t}${kt}`;return`<button id="${xt}" class="${wt}" ${ut||ft?"disabled":""} ${gt?`style='${gt}'`:""}>${Ct}</button>`}function So(dt){let{value:lt="",placeholder:ct="",type:pt="text",disabled:ut=!1,readonly:ft=!1,maxLength:bt,minLength:mt,pattern:xt,required:yt=!1,autocomplete:ht,label:wt,error:gt,hint:$t,id:kt=Tt("input"),className:Ct,style:At}=dt,It=St("stx-input",gt&&"stx-input--error",ut&&"stx-input--disabled",Ct),Wt=Pt(At),ko=[`type="${pt}"`,`id="${kt}"`,`class="${It}"`,lt&&`value="${vt(lt)}"`,ct&&`placeholder="${vt(ct)}"`,ut&&"disabled",ft&&"readonly",yt&&"required",bt&&`maxlength="${bt}"`,mt&&`minlength="${mt}"`,xt&&`pattern="${vt(xt)}"`,ht&&`autocomplete="${ht}"`,Wt&&`style="${Wt}"`].filter(Boolean).join(" "),_t="";if(wt)_t+=`<label class="stx-input-label" for="${kt}">${vt(wt)}</label>`;if(_t+=`<input ${ko} />`,gt)_t+=`<div class="stx-input-error">${vt(gt)}</div>`;else if($t)_t+=`<div class="stx-input-hint">${vt($t)}</div>`;return`<div class="stx-input-wrapper">${_t}</div>`}function To(dt){let{checked:lt=!1,label:ct,disabled:pt=!1,indeterminate:ut=!1,id:ft=Tt("checkbox"),className:bt,style:mt}=dt,xt=St("stx-checkbox",pt&&"stx-checkbox--disabled",bt),yt=Pt(mt),ht=['type="checkbox"',`id="${ft}"`,lt&&"checked",pt&&"disabled",ut&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
3
3
|
<label class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
4
4
|
<input ${ht} />
|
|
5
5
|
<span class="stx-checkbox-box"></span>
|
|
6
6
|
${ct?`<span class="stx-checkbox-label">${vt(ct)}</span>`:""}
|
|
7
7
|
</label>
|
|
8
|
-
`}function Co(
|
|
9
|
-
<div id="${mt}" class="${wt}" role="progressbar" aria-valuenow="${
|
|
8
|
+
`}function Co(dt){let{value:lt=50,min:ct=0,max:pt=100,step:ut=1,disabled:ft=!1,label:bt,showValue:mt=!0,id:xt=Tt("slider"),className:yt,style:ht}=dt,wt=St("stx-slider",ft&&"stx-slider--disabled",yt),gt=Pt(ht),$t=['type="range"',`id="${xt}"`,`value="${lt}"`,`min="${ct}"`,`max="${pt}"`,`step="${ut}"`,ft&&"disabled"].filter(Boolean).join(" "),kt="";if(bt)kt+=`<label class="stx-slider-label" for="${xt}">${vt(bt)}</label>`;if(kt+=`<div class="stx-slider-track"><input ${$t} /></div>`,mt)kt+=`<span class="stx-slider-value">${lt}</span>`;return`<div class="${wt}" ${gt?`style='${gt}'`:""}>${kt}</div>`}function Ao(dt){let{value:lt,max:ct=100,variant:pt="default",size:ut="medium",showLabel:ft=!1,indeterminate:bt=!1,id:mt=Tt("progress"),className:xt,style:yt}=dt,ht=Math.min(100,Math.max(0,lt/ct*100)),wt=St("stx-progress",`stx-progress--${pt}`,`stx-progress--${ut}`,bt&&"stx-progress--indeterminate",xt),gt=Pt(yt);return`
|
|
9
|
+
<div id="${mt}" class="${wt}" role="progressbar" aria-valuenow="${lt}" aria-valuemin="0" aria-valuemax="${ct}" ${gt?`style="${gt}"`:""}>
|
|
10
10
|
<div class="stx-progress-bar" style="width: ${bt?"100%":`${ht}%`}"></div>
|
|
11
11
|
${ft?`<span class="stx-progress-label">${Math.round(ht)}%</span>`:""}
|
|
12
12
|
</div>
|
|
13
|
-
`}function Io(
|
|
14
|
-
<img src="${vt(
|
|
13
|
+
`}function Io(dt){let{text:lt,variant:ct="default",size:pt="medium",id:ut=Tt("badge"),className:ft,style:bt}=dt,mt=St("stx-badge",`stx-badge--${ct}`,`stx-badge--${pt}`,ft),xt=Pt(bt);return`<span id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${vt(lt)}</span>`}function Mo(dt){let{src:lt,alt:ct="",name:pt,size:ut="medium",shape:ft="circle",id:bt=Tt("avatar"),className:mt,style:xt}=dt,yt=typeof ut==="number"?"":`stx-avatar--${ut}`,ht=typeof ut==="number"?`width: ${ut}px; height: ${ut}px;`:"",wt=St("stx-avatar",yt,`stx-avatar--${ft}`,mt),gt=[ht,Pt(xt)].filter(Boolean).join(" "),$t=pt?pt.split(" ").map((kt)=>kt[0]).join("").toUpperCase().slice(0,2):"";if(lt)return`<div id="${bt}" class="${wt}" ${gt?`style="${gt}"`:""}>
|
|
14
|
+
<img src="${vt(lt)}" alt="${vt(ct)}" class="stx-avatar-img" />
|
|
15
15
|
</div>`;return`<div id="${bt}" class="${wt}" ${gt?`style="${gt}"`:""}>
|
|
16
16
|
<span class="stx-avatar-initials">${$t}</span>
|
|
17
|
-
</div>`}function Oo(
|
|
17
|
+
</div>`}function Oo(dt){let{title:lt,subtitle:ct,content:pt,image:ut,footer:ft,variant:bt="default",id:mt=Tt("card"),className:xt,style:yt}=dt,ht=St("stx-card",`stx-card--${bt}`,xt),wt=Pt(yt),gt="";if(ut)gt+=`<div class="stx-card-image"><img src="${vt(ut)}" alt="" /></div>`;if(gt+='<div class="stx-card-body">',lt)gt+=`<h3 class="stx-card-title">${vt(lt)}</h3>`;if(ct)gt+=`<p class="stx-card-subtitle">${vt(ct)}</p>`;if(pt)gt+=`<div class="stx-card-content">${vt(pt)}</div>`;if(gt+="</div>",ft)gt+=`<div class="stx-card-footer">${vt(ft)}</div>`;return`<div id="${mt}" class="${ht}" ${wt?`style='${wt}'`:""}>${gt}</div>`}function Do(dt){let{tabs:lt,activeTab:ct,variant:pt="default",id:ut=Tt("tabs"),className:ft,style:bt}=dt,mt=St("stx-tabs",`stx-tabs--${pt}`,ft),xt=Pt(bt),yt=lt.map((ht,wt)=>{let gt=ct?ht.value===ct:wt===0;return`<button class="${St("stx-tab",gt&&"stx-tab--active",ht.disabled&&"stx-tab--disabled")}" data-value="${vt(ht.value)}" ${ht.disabled?"disabled":""} role="tab" aria-selected="${gt}">${vt(ht.label)}</button>`}).join("");return`<div id="${ut}" class="${mt}" role="tablist" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Eo(dt){let{options:lt,value:ct,placeholder:pt="Select...",disabled:ut=!1,id:ft=Tt("dropdown"),className:bt,style:mt}=dt,xt=St("stx-dropdown",ut&&"stx-dropdown--disabled",bt),yt=Pt(mt),ht=lt.map((gt)=>{let $t=gt.value===ct?"selected":"",kt=gt.disabled?"disabled":"";return`<option value="${vt(gt.value)}" ${$t} ${kt}>${vt(gt.label)}</option>`}).join(""),wt=ct?"":`<option value="" disabled selected>${vt(pt)}</option>`;return`<select id="${ft}" class="${xt}" ${ut?"disabled":""} ${yt?`style='${yt}'`:""}>${wt}${ht}</select>`}function No(dt){let{value:lt=0,max:ct=5,readonly:pt=!1,size:ut="medium",allowHalf:ft=!1,id:bt=Tt("rating"),className:mt,style:xt}=dt,yt=St("stx-rating",`stx-rating--${ut}`,pt&&"stx-rating--readonly",mt),ht=Pt(xt),wt="";for(let gt=1;gt<=ct;gt++){let $t=gt<=lt,kt=ft&>-0.5===lt;wt+=`<span class="stx-star ${$t?"stx-star--filled":kt?"stx-star--half":""}" data-value="${gt}">\u2605</span>`}return`<div id="${bt}" class="${yt}" role="slider" aria-valuenow="${lt}" aria-valuemin="0" aria-valuemax="${ct}" ${ht?`style='${ht}'`:""}>${wt}</div>`}function zo(dt){let{value:lt,name:ct,checked:pt=!1,label:ut,disabled:ft=!1,id:bt=Tt("radio"),className:mt,style:xt}=dt,yt=St("stx-radio",ft&&"stx-radio--disabled",mt),ht=Pt(xt),wt=['type="radio"',`id="${bt}"`,`name="${vt(ct)}"`,`value="${vt(lt)}"`,pt&&"checked",ft&&"disabled"].filter(Boolean).join(" ");return`
|
|
18
18
|
<label class="${yt}" ${ht?`style="${ht}"`:""}>
|
|
19
19
|
<input ${wt} />
|
|
20
20
|
<span class="stx-radio-circle"></span>
|
|
21
21
|
${ut?`<span class="stx-radio-label">${vt(ut)}</span>`:""}
|
|
22
22
|
</label>
|
|
23
|
-
`}function Bo(
|
|
24
|
-
<input type="color" id="${ft}" value="${vt(
|
|
25
|
-
<span class="stx-color-picker-value">${vt(
|
|
26
|
-
</div>`,ut.length>0){ht+='<div class="stx-color-picker-presets">';for(let wt of ut)ht+=`<button class="stx-color-preset" style="background: ${vt(wt)}" data-color="${vt(wt)}" ${ct?"disabled":""}></button>`;ht+="</div>"}return`<div class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function _o(
|
|
23
|
+
`}function Bo(dt){let{value:lt="#3498db",disabled:ct=!1,label:pt,presetColors:ut=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:ft=Tt("color"),className:bt,style:mt}=dt,xt=St("stx-color-picker",ct&&"stx-color-picker--disabled",bt),yt=Pt(mt),ht="";if(pt)ht+=`<label class="stx-color-picker-label" for="${ft}">${vt(pt)}</label>`;if(ht+=`<div class="stx-color-picker-input">
|
|
24
|
+
<input type="color" id="${ft}" value="${vt(lt)}" ${ct?"disabled":""} />
|
|
25
|
+
<span class="stx-color-picker-value">${vt(lt)}</span>
|
|
26
|
+
</div>`,ut.length>0){ht+='<div class="stx-color-picker-presets">';for(let wt of ut)ht+=`<button class="stx-color-preset" style="background: ${vt(wt)}" data-color="${vt(wt)}" ${ct?"disabled":""}></button>`;ht+="</div>"}return`<div class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function _o(dt){let{value:lt,min:ct,max:pt,disabled:ut=!1,label:ft,placeholder:bt="Select date",showClear:mt=!0,id:xt=Tt("date"),className:yt,style:ht}=dt,wt=St("stx-date-picker",ut&&"stx-date-picker--disabled",yt),gt=Pt(ht),$t=lt instanceof Date?lt.toISOString().split("T")[0]:lt||"",kt=ct instanceof Date?ct.toISOString().split("T")[0]:ct,Ct=pt instanceof Date?pt.toISOString().split("T")[0]:pt,At=['type="date"',`id="${xt}"`,$t&&`value="${$t}"`,kt&&`min="${kt}"`,Ct&&`max="${Ct}"`,ut&&"disabled",`placeholder="${vt(bt)}"`].filter(Boolean).join(" "),It="";if(ft)It+=`<label class="stx-date-picker-label" for="${xt}">${vt(ft)}</label>`;return It+=`<div class="stx-date-picker-input">
|
|
27
27
|
<input ${At} />
|
|
28
28
|
${mt&&$t?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
29
|
-
</div>`,`<div class="${wt}" ${gt?`style='${gt}'`:""}>${It}</div>`}function Lo(
|
|
29
|
+
</div>`,`<div class="${wt}" ${gt?`style='${gt}'`:""}>${It}</div>`}function Lo(dt){let{value:lt="",disabled:ct=!1,label:pt,step:ut=60,min:ft,max:bt,id:mt=Tt("time"),className:xt,style:yt}=dt,ht=St("stx-time-picker",ct&&"stx-time-picker--disabled",xt),wt=Pt(yt),gt=['type="time"',`id="${mt}"`,lt&&`value="${vt(lt)}"`,`step="${ut}"`,ft&&`min="${vt(ft)}"`,bt&&`max="${vt(bt)}"`,ct&&"disabled"].filter(Boolean).join(" "),$t="";if(pt)$t+=`<label class="stx-time-picker-label" for="${mt}">${vt(pt)}</label>`;return $t+=`<input ${gt} class="stx-time-picker-input" />`,`<div class="${ht}" ${wt?`style='${wt}'`:""}>${$t}</div>`}function Ro(dt){let{options:lt,value:ct="",placeholder:pt="Search...",disabled:ut=!1,label:ft,loading:bt=!1,id:mt=Tt("autocomplete"),className:xt,style:yt}=dt,ht=St("stx-autocomplete",ut&&"stx-autocomplete--disabled",xt),wt=Pt(yt),gt=lt.find((Ct)=>Ct.value===ct),$t=gt?gt.label:ct,kt="";if(ft)kt+=`<label class="stx-autocomplete-label" for="${mt}">${vt(ft)}</label>`;kt+=`<div class="stx-autocomplete-input-wrapper">
|
|
30
30
|
<input type="text" id="${mt}" value="${vt($t)}" placeholder="${vt(pt)}" ${ut?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
31
31
|
${bt?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
32
|
-
</div>`,kt+='<ul class="stx-autocomplete-list">';for(let Ct of
|
|
32
|
+
</div>`,kt+='<ul class="stx-autocomplete-list">';for(let Ct of lt)kt+=`<li class="stx-autocomplete-item ${Ct.value===ct?"stx-autocomplete-item--selected":""}" data-value="${vt(Ct.value)}">${vt(Ct.label)}</li>`;return kt+="</ul>",`<div class="${ht}" ${wt?`style='${wt}'`:""}>${kt}</div>`}function Wo(dt){let{text:lt,htmlFor:ct,required:pt=!1,size:ut="medium",id:ft=Tt("label"),className:bt,style:mt}=dt,xt=St("stx-label",`stx-label--${ut}`,bt),yt=Pt(mt);return`<label id="${ft}" class="${xt}" ${ct?`for='${vt(ct)}'`:""} ${yt?`style='${yt}'`:""}>${vt(lt)}${pt?'<span class="stx-label-required">*</span>':""}</label>`}function Vo(dt){let{src:lt,alt:ct="",width:pt,height:ut,objectFit:ft="cover",fallback:bt,loading:mt="lazy",id:xt=Tt("image"),className:yt,style:ht}=dt,wt=St("stx-image",yt),gt={objectFit:ft};if(pt)gt.width=typeof pt==="number"?`${pt}px`:pt;if(ut)gt.height=typeof ut==="number"?`${ut}px`:ut;let $t=[Pt(gt),Pt(ht)].filter(Boolean).join("; "),kt=bt?`onerror="this.src='${vt(bt)}'"`:"";return`<img id="${xt}" class="${wt}" src="${vt(lt)}" alt="${vt(ct)}" loading="${mt}" ${$t?`style='${$t}'`:""} ${kt} />`}function Ho(dt){let{text:lt,variant:ct="default",size:pt="medium",removable:ut=!1,icon:ft,id:bt=Tt("chip"),className:mt,style:xt}=dt,yt=St("stx-chip",`stx-chip--${ct}`,`stx-chip--${pt}`,mt),ht=Pt(xt),wt="";if(ft)wt+=`<span class="stx-chip-icon">${ft}</span>`;if(wt+=`<span class="stx-chip-text">${vt(lt)}</span>`,ut)wt+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${bt}" class="${yt}" ${ht?`style='${ht}'`:""}>${wt}</span>`}function Fo(dt){let{text:lt,position:ct="top",delay:pt=200,children:ut,id:ft=Tt("tooltip"),className:bt,style:mt}=dt,xt=St("stx-tooltip-wrapper",bt),yt=Pt(mt);return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""} data-tooltip="${vt(lt)}" data-position="${ct}" data-delay="${pt}">
|
|
33
33
|
${ut}
|
|
34
|
-
<span class="stx-tooltip stx-tooltip--${ct}">${vt(
|
|
35
|
-
</div>`}function Uo(
|
|
34
|
+
<span class="stx-tooltip stx-tooltip--${ct}">${vt(lt)}</span>
|
|
35
|
+
</div>`}function Uo(dt){let{direction:lt="vertical",showScrollbar:ct=!0,smooth:pt=!0,height:ut,width:ft,children:bt,id:mt=Tt("scroll"),className:xt,style:yt}=dt,ht=St("stx-scroll-view",`stx-scroll-view--${lt}`,!ct&&"stx-scroll-view--hide-scrollbar",pt&&"stx-scroll-view--smooth",xt),wt={};if(ut)wt.height=typeof ut==="number"?`${ut}px`:ut;if(ft)wt.width=typeof ft==="number"?`${ft}px`:ft;let gt=[Pt(wt),Pt(yt)].filter(Boolean).join("; ");return`<div id="${mt}" class="${ht}" ${gt?`style='${gt}'`:""}>${bt}</div>`}function jo(dt){let{direction:lt="horizontal",sizes:ct=[50,50],resizable:pt=!0,children:ut,id:ft=Tt("split"),className:bt,style:mt}=dt,xt=St("stx-split-view",`stx-split-view--${lt}`,pt&&"stx-split-view--resizable",bt),yt=Pt(mt),ht=lt==="horizontal"?"width":"height";return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
36
36
|
<div class="stx-split-pane" style="${ht}: ${ct[0]}%">${ut[0]}</div>
|
|
37
37
|
${pt?'<div class="stx-split-divider"></div>':""}
|
|
38
38
|
<div class="stx-split-pane" style="${ht}: ${ct[1]}%">${ut[1]}</div>
|
|
39
|
-
</div>`}function qo(
|
|
39
|
+
</div>`}function qo(dt){let{items:lt,multiple:ct=!1,defaultOpen:pt=[],id:ut=Tt("accordion"),className:ft,style:bt}=dt,mt=St("stx-accordion",ft),xt=Pt(bt),yt="";return lt.forEach((ht,wt)=>{let gt=pt.includes(wt),$t=St("stx-accordion-item",gt&&"stx-accordion-item--open",ht.disabled&&"stx-accordion-item--disabled");yt+=`<div class="${$t}" data-index="${wt}">
|
|
40
40
|
<button class="stx-accordion-header" ${ht.disabled?"disabled":""} aria-expanded="${gt}" data-multiple="${ct}">
|
|
41
41
|
<span class="stx-accordion-title">${vt(ht.title)}</span>
|
|
42
42
|
<span class="stx-accordion-icon">\u25BC</span>
|
|
@@ -44,7 +44,7 @@ import{u,P,c,r,S,k,A,C,I,T,E,M,D,t,p,B,O,R,f,L,_,N,F,W,z,H,U,n,q,V,j,K,G,Y,X,l,J
|
|
|
44
44
|
<div class="stx-accordion-content" ${gt?"":"hidden"}>
|
|
45
45
|
${vt(ht.content)}
|
|
46
46
|
</div>
|
|
47
|
-
</div>`}),`<div id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Go(
|
|
47
|
+
</div>`}),`<div id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Go(dt){let{steps:lt,currentStep:ct,orientation:pt="horizontal",id:ut=Tt("stepper"),className:ft,style:bt}=dt,mt=St("stx-stepper",`stx-stepper--${pt}`,ft),xt=Pt(bt),yt="";return lt.forEach((ht,wt)=>{let gt=St("stx-step",wt<ct&&"stx-step--completed",wt===ct&&"stx-step--active");if(yt+=`<div class="${gt}" data-step="${wt}">
|
|
48
48
|
<div class="stx-step-indicator">
|
|
49
49
|
${wt<ct?"\u2713":wt+1}
|
|
50
50
|
</div>
|
|
@@ -52,35 +52,35 @@ import{u,P,c,r,S,k,A,C,I,T,E,M,D,t,p,B,O,R,f,L,_,N,F,W,z,H,U,n,q,V,j,K,G,Y,X,l,J
|
|
|
52
52
|
<div class="stx-step-label">${vt(ht.label)}</div>
|
|
53
53
|
${ht.description?`<div class="stx-step-description">${vt(ht.description)}</div>`:""}
|
|
54
54
|
</div>
|
|
55
|
-
</div>`,wt<
|
|
55
|
+
</div>`,wt<lt.length-1)yt+='<div class="stx-step-connector"></div>'}),`<div id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Ko(dt){let{open:lt=!1,title:ct,size:pt="medium",closable:ut=!0,children:ft,footer:bt,id:mt=Tt("modal"),className:xt,style:yt}=dt,ht=St("stx-modal-component",`stx-modal-component--${pt}`,xt),wt=Pt(yt);if(!lt)return`<div id="${mt}" class="${ht} stx-modal-component--hidden" ${wt?`style='${wt}'`:""}></div>`;let gt='<div class="stx-modal-component-overlay">';if(gt+='<div class="stx-modal-component-dialog">',ct||ut){if(gt+='<div class="stx-modal-component-header">',ct)gt+=`<h3 class="stx-modal-component-title">${vt(ct)}</h3>`;if(ut)gt+='<button class="stx-modal-component-close">×</button>';gt+="</div>"}if(gt+=`<div class="stx-modal-component-body">${ft}</div>`,bt)gt+=`<div class="stx-modal-component-footer">${bt}</div>`;return gt+="</div></div>",`<div id="${mt}" class="${ht}" ${wt?`style='${wt}'`:""}>${gt}</div>`}function Yo(dt){let{items:lt,selectable:ct=!1,multiSelect:pt=!1,emptyMessage:ut="No items",id:ft=Tt("list"),className:bt,style:mt}=dt,xt=St("stx-list-view",ct&&"stx-list-view--selectable",pt&&"stx-list-view--multi",bt),yt=Pt(mt);if(lt.length===0)return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
56
56
|
<div class="stx-list-view-empty">${vt(ut)}</div>
|
|
57
|
-
</div>`;let ht='<ul class="stx-list-view-items">';for(let wt of
|
|
57
|
+
</div>`;let ht='<ul class="stx-list-view-items">';for(let wt of lt){let gt=St("stx-list-view-item",wt.selected&&"stx-list-view-item--selected");ht+=`<li class="${gt}" data-id="${vt(wt.id)}" ${ct?'tabindex="0"':""}>${wt.content}</li>`}return ht+="</ul>",`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Xo(dt){let{columns:lt,data:ct,striped:pt=!1,bordered:ut=!1,hoverable:ft=!0,sortBy:bt,sortOrder:mt,id:xt=Tt("table"),className:yt,style:ht}=dt,wt=St("stx-table",pt&&"stx-table--striped",ut&&"stx-table--bordered",ft&&"stx-table--hoverable",yt),gt=Pt(ht),$t="<table>";$t+="<thead><tr>";for(let kt of lt){let At=kt.key===bt?`stx-table-sorted stx-table-sorted--${mt}`:"",It=kt.sortable?'data-sortable="true"':"",Wt=kt.width?`style="width: ${kt.width}"`:"";$t+=`<th class="${At}" ${It} ${Wt} data-key="${vt(kt.key)}">${vt(kt.label)}${kt.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}$t+="</tr></thead>",$t+="<tbody>";for(let kt of ct){$t+="<tr>";for(let Ct of lt){let At=kt[Ct.key];$t+=`<td>${At!=null?vt(String(At)):""}</td>`}$t+="</tr>"}return $t+="</tbody></table>",`<div id="${xt}" class="${wt}" ${gt?`style='${gt}'`:""}>${$t}</div>`}function Zt(dt,lt,ct,pt){let ut=lt.includes(dt.key),ft=ct.includes(dt.key),bt=dt.children&&dt.children.length>0,xt=`<div class="${St("stx-tree-node",ft&&"stx-tree-node--selected",dt.disabled&&"stx-tree-node--disabled")}" data-key="${vt(dt.key)}">`;if(xt+='<div class="stx-tree-node-content">',bt)xt+=`<span class="stx-tree-toggle ${ut?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else xt+='<span class="stx-tree-toggle-placeholder"></span>';if(pt)xt+=`<input type="checkbox" class="stx-tree-checkbox" ${ft?"checked":""} ${dt.disabled?"disabled":""} />`;if(dt.icon)xt+=`<span class="stx-tree-icon">${dt.icon}</span>`;if(xt+=`<span class="stx-tree-label">${vt(dt.label)}</span>`,xt+="</div>",bt&&ut){xt+='<div class="stx-tree-children">';for(let yt of dt.children)xt+=Zt(yt,lt,ct,pt);xt+="</div>"}return xt+="</div>",xt}function Jo(dt){let{nodes:lt,expandedKeys:ct=[],selectedKeys:pt=[],checkable:ut=!1,id:ft=Tt("tree"),className:bt,style:mt}=dt,xt=St("stx-tree-view",ut&&"stx-tree-view--checkable",bt),yt=Pt(mt),ht="";for(let wt of lt)ht+=Zt(wt,ct,pt,ut);return`<div id="${ft}" class="${xt}" role="tree" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Qo(dt){let{columns:lt,data:ct,pagination:pt,selectable:ut=!1,id:ft=Tt("datagrid"),className:bt,style:mt}=dt,xt=St("stx-data-grid",ut&&"stx-data-grid--selectable",bt),yt=Pt(mt),ht='<div class="stx-data-grid-table-wrapper">';if(ht+='<table class="stx-data-grid-table">',ht+="<thead><tr>",ut)ht+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let wt of lt){let gt=wt.width?`style="width: ${wt.width}"`:"";ht+=`<th ${gt}>
|
|
58
58
|
<div class="stx-data-grid-header-cell">
|
|
59
59
|
<span>${vt(wt.label)}</span>
|
|
60
60
|
${wt.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
61
61
|
${wt.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
|
|
62
62
|
</div>
|
|
63
|
-
</th>`}ht+="</tr></thead>",ht+="<tbody>";for(let wt of ct){if(ht+="<tr>",ut)ht+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let gt of
|
|
63
|
+
</th>`}ht+="</tr></thead>",ht+="<tbody>";for(let wt of ct){if(ht+="<tr>",ut)ht+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let gt of lt){let $t=wt[gt.key];ht+=`<td>${$t!=null?vt(String($t)):""}</td>`}ht+="</tr>"}if(ht+="</tbody></table></div>",pt){let wt=Math.ceil(pt.total/pt.pageSize);ht+=`<div class="stx-data-grid-pagination">
|
|
64
64
|
<span class="stx-data-grid-page-info">Page ${pt.page} of ${wt} (${pt.total} items)</span>
|
|
65
65
|
<div class="stx-data-grid-page-buttons">
|
|
66
66
|
<button class="stx-data-grid-page-btn" ${pt.page<=1?"disabled":""}>\u25C0</button>
|
|
67
67
|
<button class="stx-data-grid-page-btn" ${pt.page>=wt?"disabled":""}>\u25B6</button>
|
|
68
68
|
</div>
|
|
69
|
-
</div>`}return`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Zo(
|
|
69
|
+
</div>`}return`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Zo(dt){let{type:lt,data:ct,options:pt={},width:ut="100%",height:ft=300,id:bt=Tt("chart"),className:mt,style:xt}=dt,yt=St("stx-chart",`stx-chart--${lt}`,mt),ht={width:typeof ut==="number"?`${ut}px`:ut,height:typeof ft==="number"?`${ft}px`:ft},wt=[Pt(ht),Pt(xt)].filter(Boolean).join("; "),gt=JSON.stringify({type:lt,data:ct,options:pt});return`<div id="${bt}" class="${yt}" style="${wt}" data-chart='${vt(gt)}'>
|
|
70
70
|
<div class="stx-chart-placeholder">
|
|
71
71
|
${pt.title?`<div class="stx-chart-title">${vt(pt.title)}</div>`:""}
|
|
72
|
-
<div class="stx-chart-type">${
|
|
72
|
+
<div class="stx-chart-type">${lt.charAt(0).toUpperCase()+lt.slice(1)} Chart</div>
|
|
73
73
|
<div class="stx-chart-info">${ct.datasets.length} dataset(s), ${ct.labels.length} labels</div>
|
|
74
74
|
</div>
|
|
75
|
-
</div>`}function er(
|
|
76
|
-
`),At="";if(ut){At+='<div class="stx-code-editor-gutter">';for(let It=1;It<=Ct.length;It++)At+=`<div class="stx-code-editor-line-number">${It}</div>`;At+="</div>"}return At+=`<pre class="stx-code-editor-content"><code class="language-${vt(ct)}">${vt(
|
|
75
|
+
</div>`}function er(dt){let{value:lt="",language:ct="plaintext",theme:pt="dark",lineNumbers:ut=!0,readOnly:ft=!1,height:bt=300,tabSize:mt=2,wordWrap:xt=!1,id:yt=Tt("code"),className:ht,style:wt}=dt,gt=St("stx-code-editor",`stx-code-editor--${pt}`,ut&&"stx-code-editor--line-numbers",ft&&"stx-code-editor--readonly",xt&&"stx-code-editor--wrap",ht),$t={height:typeof bt==="number"?`${bt}px`:bt},kt=[Pt($t),Pt(wt)].filter(Boolean).join("; "),Ct=lt.split(`
|
|
76
|
+
`),At="";if(ut){At+='<div class="stx-code-editor-gutter">';for(let It=1;It<=Ct.length;It++)At+=`<div class="stx-code-editor-line-number">${It}</div>`;At+="</div>"}return At+=`<pre class="stx-code-editor-content"><code class="language-${vt(ct)}">${vt(lt)}</code></pre>`,`<div id="${yt}" class="${gt}" style="${kt}" data-language="${vt(ct)}" data-tab-size="${mt}">${At}</div>`}function tr(dt){let{src:lt,type:ct="video",poster:pt,autoplay:ut=!1,loop:ft=!1,muted:bt=!1,controls:mt=!0,width:xt,height:yt,id:ht=Tt("media"),className:wt,style:gt}=dt,$t=St("stx-media-player",`stx-media-player--${ct}`,wt),kt={};if(xt)kt.width=typeof xt==="number"?`${xt}px`:xt;if(yt)kt.height=typeof yt==="number"?`${yt}px`:yt;let Ct=[Pt(kt),Pt(gt)].filter(Boolean).join("; "),At=[`id="${ht}-media"`,`src="${vt(lt)}"`,mt&&"controls",ut&&"autoplay",ft&&"loop",bt&&"muted",ct==="video"&&pt&&`poster="${vt(pt)}"`].filter(Boolean).join(" "),It=ct==="video"?`<video ${At}>Your browser does not support the video tag.</video>`:`<audio ${At}>Your browser does not support the audio tag.</audio>`;return`<div id="${ht}" class="${$t}" ${Ct?`style='${Ct}'`:""}>${It}</div>`}function or(dt){if(dt===void 0)return"";let lt=["B","KB","MB","GB"],ct=dt,pt=0;while(ct>=1024&&pt<lt.length-1)ct/=1024,pt++;return`${ct.toFixed(1)} ${lt[pt]}`}function rr(dt){let{files:lt,viewMode:ct="list",showHidden:pt=!1,selectable:ut=!0,id:ft=Tt("files"),className:bt,style:mt}=dt,xt=St("stx-file-explorer",`stx-file-explorer--${ct}`,bt),yt=Pt(mt),ht=pt?lt:lt.filter((gt)=>!gt.name.startsWith(".")),wt="";if(ct==="list"){wt='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let gt of ht){let $t=gt.icon||(gt.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),kt=gt.type==="file"?or(gt.size):"",Ct=gt.modified?gt.modified.toLocaleDateString():"";wt+=`<tr class="stx-file-explorer-item ${ut?"stx-file-explorer-item--selectable":""}" data-path="${vt(gt.path)}" data-type="${gt.type}">
|
|
77
77
|
<td><span class="stx-file-explorer-icon">${$t}</span>${vt(gt.name)}</td>
|
|
78
78
|
<td>${kt}</td>
|
|
79
79
|
<td>${Ct}</td>
|
|
80
80
|
</tr>`}wt+="</tbody></table>"}else{wt='<div class="stx-file-explorer-grid">';for(let gt of ht){let $t=gt.icon||(gt.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");wt+=`<div class="stx-file-explorer-item ${ut?"stx-file-explorer-item--selectable":""}" data-path="${vt(gt.path)}" data-type="${gt.type}">
|
|
81
81
|
<div class="stx-file-explorer-icon">${$t}</div>
|
|
82
82
|
<div class="stx-file-explorer-name">${vt(gt.name)}</div>
|
|
83
|
-
</div>`}wt+="</div>"}return`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${wt}</div>`}function sr(
|
|
83
|
+
</div>`}wt+="</div>"}return`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${wt}</div>`}function sr(dt){let{url:lt,width:ct="100%",height:pt=400,sandbox:ut=!0,allowScripts:ft=!0,id:bt=Tt("webview"),className:mt,style:xt}=dt,yt=St("stx-webview",mt),ht={width:typeof ct==="number"?`${ct}px`:ct,height:typeof pt==="number"?`${pt}px`:pt},wt=[Pt(ht),Pt(xt)].filter(Boolean).join("; "),gt=[];if(ut){if(gt.push("allow-same-origin"),ft)gt.push("allow-scripts")}let $t=ut?`sandbox="${gt.join(" ")}"`:"";return`<iframe id="${bt}" class="${yt}" src="${vt(lt)}" style="${wt}" ${$t} loading="lazy" frameborder="0"></iframe>`}var ir=["Button","TextInput","Checkbox","RadioButton","Slider","ColorPicker","DatePicker","TimePicker","Autocomplete","Label","ImageView","ProgressBar","Avatar","Badge","Chip","Card","Tooltip","Toast","ScrollView","SplitView","Accordion","Stepper","Modal","Tabs","Dropdown","ListView","Table","TreeView","DataGrid","Chart","Rating","CodeEditor","MediaPlayer","FileExplorer","WebView"],nr=`
|
|
84
84
|
/* Button */
|
|
85
85
|
.stx-button {
|
|
86
86
|
display: inline-flex;
|
|
@@ -437,7 +437,7 @@ import{u,P,c,r,S,k,A,C,I,T,E,M,D,t,p,B,O,R,f,L,_,N,F,W,z,H,U,n,q,V,j,K,G,Y,X,l,J
|
|
|
437
437
|
.stx-chip--warning { background: #3a2a1a; }
|
|
438
438
|
.stx-chip--error { background: #3a1a1a; }
|
|
439
439
|
}
|
|
440
|
-
`;import eo from"process";function ar(){if(eo.platform)return eo.platform;return"unknown"}function oo(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function ro(lt
|
|
440
|
+
`;import eo from"process";function ar(){if(eo.platform)return eo.platform;return"unknown"}function oo(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function ro(dt,lt){if(dt.type==="separator")return{id:`sep-${lt}`,label:"",type:"separator"};let ct={id:`item-${lt}-${dt.label.replace(/\s+/g,"-").toLowerCase()}`,label:dt.label,type:dt.type||"normal",enabled:dt.enabled!==!1};if(dt.accelerator)ct.shortcut=dt.accelerator;if(dt.type==="checkbox")ct.checked=dt.checked||!1;if(dt.type==="submenu"&&dt.submenu)ct.submenu=dt.submenu.map((pt,ut)=>ro(pt,ut));return ct}function jt(dt){return dt.map((lt,ct)=>ro(lt,ct))}function so(dt,lt=0){if(dt.type==="separator")return'<hr class="stx-tray-separator" />';let ct=" ".repeat(lt),pt=dt.enabled===!1?"disabled":"",ut=dt.checked?"\u2713 ":"",ft=dt.accelerator?`<span class="accelerator">${dt.accelerator}</span>`:"",bt=`${ct}<div class="stx-tray-item ${pt}" data-action="${dt.label}">`;if(bt+=`<span class="label">${ut}${dt.label}</span>${ft}`,dt.type==="submenu"&&dt.submenu){bt+='<span class="arrow">\u25B8</span>',bt+='<div class="stx-tray-submenu">';for(let mt of dt.submenu)bt+=so(mt,lt+1);bt+="</div>"}return bt+="</div>",bt}function lr(dt){let lt='<div class="stx-tray-menu">';for(let ct of dt)lt+=so(ct);return lt+="</div>",lt}var Dt=new Map;function dr(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var to=!1;function cr(){if(to||typeof window>"u")return;window.addEventListener("craft:tray:menu",(dt)=>{let{action:lt}=dt.detail;for(let ct of Dt.values()){let pt=ct.handlers.get(lt);if(pt){pt();break}}}),to=!0}async function io(dt={}){let lt=dr(),ct=ar(),pt=oo(),ut={icon:dt.icon||"",tooltip:dt.tooltip||"stx Application",menu:dt.menu||[],visible:!0},ft=new Map;for(let mt of dt.menu||[]){if(mt.type!=="separator"&&mt.onClick)ft.set(mt.label,mt.onClick);if(mt.type==="submenu"&&mt.submenu){for(let xt of mt.submenu)if(xt.type!=="separator"&&xt.onClick)ft.set(xt.label,xt.onClick)}}if(Dt.set(lt,{state:ut,handlers:ft}),pt){cr();let mt=window;try{if(ut.tooltip)await mt.craft.tray.setTitle({title:ut.tooltip}),await mt.craft.tray.setTooltip({tooltip:ut.tooltip});if(ut.icon)await mt.craft.tray.setIcon({icon:ut.icon});let xt=jt(ut.menu);await mt.craft.tray.setMenu({items:xt}),console.log(`[stx-tray] Native tray created for ${ct}`)}catch(xt){console.warn("[stx-tray] Failed to create native tray:",xt)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${lt}`),console.log(`[stx-tray] Tooltip: ${ut.tooltip}`),console.log(`[stx-tray] Menu items: ${ut.menu.length}`);return{id:lt,setIcon:(mt)=>{if(ut.icon=mt,pt)window.craft.tray.setIcon({icon:mt}).catch((yt)=>{console.warn("[stx-tray] Failed to set icon:",yt)});console.log(`[stx-tray:${lt}] Icon updated`)},setTooltip:(mt)=>{if(ut.tooltip=mt,pt)window.craft.tray.setTooltip({tooltip:mt}).catch((yt)=>{console.warn("[stx-tray] Failed to set tooltip:",yt)});console.log(`[stx-tray:${lt}] Tooltip: ${mt}`)},setMenu:(mt)=>{ut.menu=mt,ft.clear();for(let xt of mt){if(xt.type!=="separator"&&xt.onClick)ft.set(xt.label,xt.onClick);if(xt.type==="submenu"&&xt.submenu){for(let yt of xt.submenu)if(yt.type!=="separator"&&yt.onClick)ft.set(yt.label,yt.onClick)}}if(pt){let xt=window,yt=jt(mt);xt.craft.tray.setMenu({items:yt}).catch((ht)=>{console.warn("[stx-tray] Failed to set menu:",ht)})}console.log(`[stx-tray:${lt}] Menu updated (${mt.length} items)`)},destroy:()=>{if(ut.visible=!1,Dt.delete(lt),pt)window.craft.tray.destroy?.().catch((xt)=>{console.warn("[stx-tray] Failed to destroy tray:",xt)});console.log(`[stx-tray:${lt}] Destroyed`)}}}var pr=io;function ur(){return Array.from(Dt.keys())}function fr(dt){let lt=Dt.get(dt);if(!lt)return null;let ct=oo();return{id:dt,setIcon:(pt)=>{if(lt.state.icon=pt,ct)window.craft.tray.setIcon({icon:pt}).catch(()=>{})},setTooltip:(pt)=>{if(lt.state.tooltip=pt,ct)window.craft.tray.setTooltip({tooltip:pt}).catch(()=>{})},setMenu:(pt)=>{if(lt.state.menu=pt,ct){let ut=window,ft=jt(pt);ut.craft.tray.setMenu({items:ft}).catch(()=>{})}},destroy:()=>{if(Dt.delete(dt),ct)window.craft.tray.destroy?.().catch(()=>{})}}}function xr(dt,lt){let ct=Dt.get(dt);if(!ct)return!1;let pt=ct.handlers.get(lt);if(pt)return pt(),!0;return!1}function mr(dt){let lt=Dt.get(dt);if(!lt)return null;return lr(lt.state.menu)}function gr(){return`
|
|
441
441
|
// STX Desktop Tray Bridge
|
|
442
442
|
// Provides convenient wrappers around window.craft.tray APIs
|
|
443
443
|
window.stxTray = {
|
|
@@ -516,7 +516,7 @@ window.stxTray = {
|
|
|
516
516
|
.stx-tray-item:hover > .stx-tray-submenu {
|
|
517
517
|
display: block;
|
|
518
518
|
}
|
|
519
|
-
`;import Et from"process";import{existsSync as hr}from"fs";import{dirname as yr,join as wr}from"path";import{craftBinaryNotFoundMessage as no,resolveCraftBinary as vr}from"craft-native";var Nt={};function $r(
|
|
519
|
+
`;import Et from"process";import{existsSync as hr}from"fs";import{dirname as yr,join as wr}from"path";import{craftBinaryNotFoundMessage as no,resolveCraftBinary as vr}from"craft-native";var Nt={};function $r(dt){Nt={...Nt,...dt}}function kr(){return{...Nt}}function Pr(){Nt={}}function qt(dt){if(!dt.sidebarConfig)return;let lt={...dt.sidebarConfig};if(lt.variant==="desktop")lt.material=lt.material??"sidebar",lt.backgroundEffect=lt.backgroundEffect??"shimmer",lt.allowsVibrancy=lt.allowsVibrancy??!0;return lt}function Vt(){let dt=yr(Et.execPath),lt=dt.includes(".app/Contents/MacOS")?wr(dt,"craft"):void 0,ct=[Et.env.CRAFT_BINARY_PATH,Nt.craftBinaryPath,...Nt.additionalSearchPaths||[],lt];for(let pt of ct)if(pt&&hr(pt))return pt;return vr()}var Mt=new Map;function Gt(dt){let lt=Mt.get(dt);if(!lt||lt.closed)return;lt.closed=!0;for(let ct of lt.closeListeners??[])try{ct()}catch(pt){console.warn(`[stx/desktop] window ${dt} close listener threw:`,pt)}lt.closeListeners?.clear()}var Sr=50;async function Kt(dt,lt){let ct=lt.show().then(()=>({failed:!1}),(ut)=>({failed:!0,error:ut})),pt=await Promise.race([ct,new Promise((ut)=>setTimeout(()=>ut(null),Sr))]);if(pt?.failed)throw pt.error;ct.then(()=>Gt(dt))}function Tr(){return Array.from(Mt.keys())}function Cr(dt){let lt=Mt.get(dt);if(!lt)return null;return Ht(dt,lt.app)}function Ar(){for(let[dt,lt]of Mt)try{lt.app?.close?.()}catch(ct){console.warn(`Failed to close window ${dt}:`,ct)}Mt.clear()}function Ht(dt,lt){return{id:dt,show:()=>{console.log(`[stx/desktop] Window ${dt} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let ct=Mt.get(dt);if(ct?.app)ct.app.close(),Gt(dt),Mt.delete(dt),console.log(`[stx/desktop] Window ${dt} closed`)},onClosed:(ct)=>{let pt=Mt.get(dt);if(!pt||pt.closed)return queueMicrotask(ct),()=>{};return pt.closeListeners??=new Set,pt.closeListeners.add(ct),()=>pt.closeListeners?.delete(ct)},focus:()=>{console.log("[stx/desktop] To focus window, use window.craft.window.focus() from inside the webview")},minimize:()=>{console.log("[stx/desktop] To minimize window, use window.craft.window.minimize() from inside the webview")},maximize:()=>{console.log("[stx/desktop] To maximize window, use window.craft.window.maximize() from inside the webview")},restore:()=>{console.log("[stx/desktop] To restore window, use window.craft.window.show() from inside the webview")},setTitle:(ct)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${ct}" }) from inside the webview`)},loadURL:(ct)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${ct}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function Yt(dt,lt={}){let ct=["--url",dt,"--title",lt.title||"stx Desktop","--width",String(lt.width??1200),"--height",String(lt.height??800)];if(lt.headless)ct.push("--headless");if(lt.darkMode)ct.push("--dark");if(lt.hotReload)ct.push("--hot-reload");if(lt.resizable===!1)ct.push("--no-resize");if(lt.frameless)ct.push("--frameless");if(lt.alwaysOnTop)ct.push("--always-on-top");if(lt.titlebarHidden)ct.push("--titlebar-hidden");if(lt.systemTray)ct.push("--system-tray");if(lt.hideDockIcon)ct.push("--hide-dock-icon");if(lt.devTools===!1)ct.push("--no-devtools");if(lt.nativeSidebar)ct.push("--native-sidebar");if(lt.sidebarWidth!==void 0)ct.push("--sidebar-width",String(lt.sidebarWidth));let pt=qt(lt);if(pt)ct.push("--sidebar-config",JSON.stringify(pt));return ct}async function Ir(dt,lt={}){let ct=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,pt=Vt();try{let{createApp:ut}=await import("craft-native"),ft=ut({url:dt,craftPath:pt,window:{title:lt.title||"stx Desktop",headless:lt.headless??!1,width:lt.width??1200,height:lt.height??800,darkMode:lt.darkMode??!1,hotReload:lt.hotReload??!1,resizable:lt.resizable??!0,frameless:lt.frameless??!1,alwaysOnTop:lt.alwaysOnTop??!1,titlebarHidden:lt.titlebarHidden??!1,systemTray:lt.systemTray??!1,hideDockIcon:lt.hideDockIcon??!1,devTools:lt.devTools??!1,nativeSidebar:lt.nativeSidebar??!1,sidebarWidth:lt.sidebarWidth,sidebarConfig:qt(lt)}});return Mt.set(ct,{app:ft,url:dt,options:lt}),await Kt(ct,ft),Ht(ct,ft)}catch{try{let{spawn:ut}=await import("child_process"),ft=ut(pt,Yt(dt,lt),{stdio:"inherit"});ft.on("error",(mt)=>{console.error(mt.code==="ENOENT"?no(pt):`craft child error: ${mt.message}`)});let bt={close:()=>ft.kill()};return Mt.set(ct,{app:bt,url:dt,options:lt}),ft.on("exit",()=>Gt(ct)),Ht(ct,bt)}catch(ut){return console.error("Failed to spawn craft binary:",ut.message),null}}}async function Mr(dt,lt={}){let ct=`http://localhost:${dt}/`;if(Et.env.NODE_ENV==="test"||Et.env.BUN_TEST)return console.warn("\u26A0 Skipping native window in test environment"),console.log("(Skipping browser fallback in test environment)"),!1;try{let{createApp:ut}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let ft=!lt.nativeSidebar,bt=qt(lt),mt=ut({url:ct,craftPath:Vt(),window:{title:lt.title||"stx Development",width:lt.width||1400,height:lt.height||900,resizable:!0,systemTray:ft,darkMode:lt.darkMode??!0,hotReload:lt.hotReload??!0,headless:lt.headless??!1,devTools:!0,titlebarHidden:lt.titlebarHidden??!1,nativeSidebar:lt.nativeSidebar??!1,sidebarWidth:lt.sidebarWidth??260,sidebarConfig:bt}}),xt=`dev-window-${dt}`;return Mt.set(xt,{app:mt,url:ct,options:lt}),await Kt(xt,mt),console.log(`\u2713 Native window opened at ${ct}`),!0}catch{let ut=Vt();try{console.log(`\u26A1 Opening native window via craft binary (${ut})\u2026`);let{spawn:ft}=await import("child_process"),bt=ft(ut,Yt(ct,{title:"stx Development",width:1400,height:900,hotReload:!0,...lt}),{stdio:"inherit"});bt.on("exit",()=>Et.exit(0)),bt.on("error",(xt)=>{console.warn(xt.code==="ENOENT"?no(ut):`craft child error: ${xt.message}`)});let mt=`dev-window-${dt}`;return Mt.set(mt,{app:{close:()=>bt.kill()},url:ct,options:lt}),console.log(`\u2713 Native window opened at ${ct}`),!0}catch(ft){console.warn("\u26A0 Could not spawn craft binary:",ft.message)}if(Et.env.NODE_ENV==="test"||Et.env.BUN_TEST)return console.log("(Skipping browser fallback in test environment)"),!1;console.log("\uD83D\uDCF1 Opening in browser instead\u2026");try{let{spawn:ft}=await import("child_process"),bt=Et.platform;return ft(bt==="darwin"?"open":bt==="win32"?"cmd":"xdg-open",bt==="win32"?["/c","start",ct]:[ct],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${ct}`),!0}catch(ft){return console.error("Could not open browser:",ft),console.log(`Please open manually: ${ct}`),!1}}}async function Or(dt,lt={}){let{title:ct="stx Desktop",width:pt=1200,height:ut=800,darkMode:ft=!1,hotReload:bt=!1,resizable:mt=!0,frameless:xt=!1,alwaysOnTop:yt=!1}=lt;try{let{createApp:ht}=await import("craft-native"),wt=Vt(),gt=ht({html:dt,craftPath:wt,window:{title:ct,headless:lt.headless??!1,width:pt,height:ut,darkMode:ft,hotReload:bt,resizable:mt,frameless:xt,alwaysOnTop:yt}}),$t=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return Mt.set($t,{app:gt,url:"html-content",options:lt}),await Kt($t,gt),Ht($t,gt)}catch(ht){return console.error("Failed to create window with HTML:",ht),null}}function Dr(){try{return u.resolve("craft-native"),!0}catch{return!1}}function Er(){return`
|
|
520
520
|
// STX Desktop Window Bridge
|
|
521
521
|
// Provides convenient wrappers around window.craft APIs
|
|
522
522
|
window.stxWindow = {
|
|
@@ -557,7 +557,7 @@ window.stxWindow = {
|
|
|
557
557
|
|
|
558
558
|
// Expose as global for backwards compatibility
|
|
559
559
|
window.desktop = window.stxWindow;
|
|
560
|
-
`}import{pack as Nr,packageApp as zr}from"craft-native";import{craftBinaryNotFoundMessage as Br,resolveCraftBinary as _r}from"craft-native";import Lt from"process";import{spawn as Lr}from"child_process";import{AutoUpdater as ao,canReplaceBundle as Rr,clearQuarantine as Wr,extractBundle as Vr,generateUpdateManifest as lo,readBundleIdentity as Xt,swapBundle as Hr,verifyBundleTrust as Fr}from"craft-native";var co="update.json";function po(lt
|
|
560
|
+
`}import{pack as Nr,packageApp as zr}from"craft-native";import{craftBinaryNotFoundMessage as Br,resolveCraftBinary as _r}from"craft-native";import Lt from"process";import{spawn as Lr}from"child_process";import{AutoUpdater as ao,canReplaceBundle as Rr,clearQuarantine as Wr,extractBundle as Vr,generateUpdateManifest as lo,readBundleIdentity as Xt,swapBundle as Hr,verifyBundleTrust as Fr}from"craft-native";var co="update.json";function po(dt,lt){return`https://github.com/${dt}/releases/latest/download/${lt}`}function uo(dt,lt,ct){return`https://github.com/${dt}/releases/download/${lt}/${ct}`}function fo(dt){let{repository:lt,manifestAsset:ct=co,...pt}=dt;return new ao({...pt,updateUrl:po(lt,ct)})}function Ur(dt){let lt=dt.tag??`v${dt.version}`,ct={};for(let[pt,ut]of Object.entries(dt.artifacts)){if(!ut)continue;ct[pt]={path:ut,url:uo(dt.repository,lt,ut.split("/").pop())}}return lo({version:dt.version,releaseNotes:dt.releaseNotes,platforms:ct})}function Ft(dt=Lt.execPath){let lt=dt.split("/");for(let ct=0;ct<lt.length;ct++)if(lt[ct].endsWith(".app"))return lt.slice(0,ct+1).join("/");return null}async function jr(){let dt=Ft();if(!dt)return null;return(await Xt(dt)).teamId}function xo(){let dt=Lt.ppid;if(dt>1)try{Lt.kill(dt,"SIGTERM");return}catch{}Lt.exit(0)}function mo(dt={}){let lt=dt.appPath??Ft(),ct=dt.quit??(()=>Lt.exit(0));if(lt)Lr("/usr/bin/open",["-n",lt],{detached:!0,stdio:"ignore"}).unref();let pt=dt.quitDelayMs??0;if(pt>0){setTimeout(ct,pt).unref?.();return}ct()}async function qr(dt){let{appPath:lt,requireSameTeam:ct=!0,macos:pt,...ut}=dt,ft=lt??Ft();if(!ft)throw Error("createSelfUpdater: this process is not running from an .app bundle, so there is nothing to update. Pass `appPath` explicitly, or skip the updater in development.");let bt=pt?.teamId??(ct?(await Xt(ft)).teamId??void 0:void 0);return fo({...ut,appPath:ft,macos:{...pt,teamId:bt},relaunch:dt.relaunch??((mt)=>mo({appPath:mt,quit:xo,quitDelayMs:250}))})}import{existsSync as Jt,mkdirSync as Gr,readFileSync as Kr,watch as Yr,writeFileSync as Xr}from"fs";import{homedir as Jr,platform as Qr}from"os";import{dirname as Zr,join as Rt}from"path";function es(dt){let lt=Qr(),ct=Jr();switch(lt){case"darwin":return Rt(ct,"Library","Application Support",dt);case"win32":return Rt(process.env.APPDATA||Rt(ct,"AppData","Roaming"),dt);default:return Rt(ct,".config",dt)}}class go{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(dt){this._defaults={...dt.defaults};let lt=dt.path?Zr(dt.path):es(dt.name);if(this._path=dt.path||Rt(lt,"preferences.json"),!Jt(lt))Gr(lt,{recursive:!0});if(this._data=this._load(),dt.watch!==!1)this._setupWatcher()}get path(){return this._path}get(dt){if(dt in this._data)return this._data[dt];return this._defaults[dt]}set(dt,lt){let ct=this.get(dt);if(JSON.stringify(ct)===JSON.stringify(lt))return;this._data[dt]=lt,this._scheduleSave(),this._notifyChange(dt,lt,ct)}getAll(){return{...this._defaults,...this._data}}has(dt){return dt in this._data}delete(dt){if(!(dt in this._data))return;let lt=this._data[dt];delete this._data[dt],this._scheduleSave(),this._notifyChange(dt,this._defaults[dt],lt)}reset(){let dt={...this._data};this._data={},this._save();for(let lt of Object.keys(dt)){let ct=this._defaults[lt];this._notifyChange(lt,ct,dt[lt])}}onChange(dt,lt){let ct=dt;if(!this._changeHandlers.has(ct))this._changeHandlers.set(ct,new Set);return this._changeHandlers.get(ct).add(lt),()=>{this._changeHandlers.get(ct)?.delete(lt)}}onAnyChange(dt){return this._anyChangeHandlers.add(dt),()=>{this._anyChangeHandlers.delete(dt)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(Jt(this._path)){let dt=Kr(this._path,"utf-8");return JSON.parse(dt)}}catch{}return{}}_save(){this._writing=!0;try{let dt=JSON.stringify({...this._defaults,...this._data},null,2);Xr(this._path,dt,"utf-8")}catch(dt){console.error(`Failed to save preferences to ${this._path}:`,dt)}finally{setTimeout(()=>{this._writing=!1},100)}}_scheduleSave(){if(this._writeTimer)clearTimeout(this._writeTimer);this._writeTimer=setTimeout(()=>{this._writeTimer=null,this._save()},50)}_setupWatcher(){try{if(!Jt(this._path))this._save();this._watcher=Yr(this._path,()=>{if(this._writing)return;let dt=this._load(),lt={...this._data};this._data=dt;let ct=new Set([...Object.keys(lt),...Object.keys(dt)]);for(let pt of ct){let ut=pt in lt?lt[pt]:this._defaults[pt],ft=pt in dt?dt[pt]:this._defaults[pt];if(JSON.stringify(ut)!==JSON.stringify(ft))this._notifyChange(pt,ft,ut)}})}catch{}}_notifyChange(dt,lt,ct){let pt=this._changeHandlers.get(dt);if(pt)for(let ut of pt)try{ut(lt,ct)}catch{}for(let ut of this._anyChangeHandlers)try{ut(dt,lt,ct)}catch{}}}function ts(dt){return new go(dt)}import{existsSync as zt,mkdirSync as bo,readFileSync as os,unlinkSync as ho,writeFileSync as yo}from"fs";import{homedir as Ut,platform as wo}from"os";import{join as Bt}from"path";function vo(dt){let lt=dt.toLowerCase().replace(/[^a-z0-9]/g,"-");return Bt(Ut(),"Library","LaunchAgents",`com.${lt}.plist`)}function $o(dt){let lt=process.env.XDG_CONFIG_HOME||Bt(Ut(),".config");return Bt(lt,"autostart",`${dt.toLowerCase()}.desktop`)}async function rs(dt,lt){let ct=lt.appName||"StxApp",pt=vo(ct),ut=Bt(Ut(),"Library","LaunchAgents");if(dt){let ft=lt.appPath||process.execPath,bt=lt.args||[],mt=[ft,...bt],xt=`<?xml version="1.0" encoding="UTF-8"?>
|
|
561
561
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
562
562
|
<plist version="1.0">
|
|
563
563
|
<dict>
|
|
@@ -572,15 +572,15 @@ ${mt.map((yt)=>` <string>${as(yt)}</string>`).join(`
|
|
|
572
572
|
<true/>
|
|
573
573
|
<key>KeepAlive</key>
|
|
574
574
|
<false/>
|
|
575
|
-
${
|
|
575
|
+
${lt.isHidden?` <key>ProcessType</key>
|
|
576
576
|
<string>Background</string>`:""}
|
|
577
577
|
</dict>
|
|
578
|
-
</plist>`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function ss(lt
|
|
578
|
+
</plist>`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function ss(dt,lt){let ct=lt.appName||"StxApp",pt=$o(ct),ut=Bt(process.env.XDG_CONFIG_HOME||Bt(Ut(),".config"),"autostart");if(dt){let ft=lt.appPath||process.execPath,bt=lt.args||[],mt=[ft,...bt].join(" "),xt=`[Desktop Entry]
|
|
579
579
|
Type=Application
|
|
580
580
|
Name=${ct}
|
|
581
581
|
Exec=${mt}
|
|
582
582
|
Terminal=false
|
|
583
583
|
StartupNotify=false
|
|
584
|
-
${
|
|
584
|
+
${lt.isHidden?`X-GNOME-Autostart-enabled=true
|
|
585
585
|
NoDisplay=true`:""}
|
|
586
|
-
`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function is(
|
|
586
|
+
`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function is(dt){return zt(vo(dt))}async function ns(dt){let lt=$o(dt);if(!zt(lt))return!1;try{let ct=os(lt,"utf-8");if(ct.includes("X-GNOME-Autostart-enabled=false"))return!1;if(ct.includes("Hidden=true"))return!1;return!0}catch{return!1}}function as(dt){return dt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function ls(dt,lt={}){let ct=wo();switch(ct){case"darwin":return rs(dt,lt);case"linux":return ss(dt,lt);default:throw Error(`Auto-launch is not yet supported on ${ct}`)}}async function ds(dt){let lt=dt||"StxApp";switch(wo()){case"darwin":return is(lt);case"linux":return ns(lt);default:return!1}}var cs={accentColor:()=>Ot("system","accentColor",()=>""),highlightColor:()=>Ot("system","highlightColor",()=>""),language:()=>Ot("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>Ot("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>Ot("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>Ot("system","is24HourTime",()=>{try{let dt=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return dt.hourCycle==="h23"||dt.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>Ot("system","reduceMotion",()=>Qt("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>Ot("system","reduceTransparency",()=>Qt("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>Ot("system","increaseContrast",()=>Qt("(prefers-contrast: more)")),systemVersion:()=>Ot("system","systemVersion",()=>""),hostname:()=>Ot("system","hostname",()=>""),username:()=>Ot("system","username",()=>""),async openPreferences(){if(e("system"))await window.craft.system.openPreferences()}};async function Ot(dt,lt,ct){if(e(dt))return await window.craft[dt][lt]();return await ct()}function Qt(dt){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(dt).matches}export{ir as AVAILABLE_COMPONENTS,ao as AutoUpdater,nr as COMPONENT_STYLES,a as DEFAULT_WATCH_INTERVAL_MS,y as MAX_WATCH_INTERVAL_MS,x as MIN_WATCH_INTERVAL_MS,z as MODAL_STYLES,D as TOAST_STYLES,br as TRAY_MENU_STYLES,co as UPDATE_MANIFEST_ASSET,_ as alert,Se as appInfo,je as appleScript,Ve as audio,xe as battery,qe as biometric,Oe as bluetooth,Je as bonjour,Ft as bundlePathForExecutable,X as caffeinate,Rr as canReplaceBundle,Wr as clearQuarantine,de as clipboard,W as closeAllModals,Ar as closeAllWindows,L as confirm,Ce as contextMenu,nt as continuityCamera,rt as coreml,Br as craftBinaryNotFoundMessage,Yt as craftWindowArguments,o as crashReporter,qo as createAccordion,Ro as createAutocomplete,Mo as createAvatar,Io as createBadge,Po as createButton,Oo as createCard,Zo as createChart,To as createCheckbox,Ho as createChip,er as createCodeEditor,Bo as createColorPicker,Qo as createDataGrid,_o as createDatePicker,Eo as createDropdown,rr as createFileExplorer,Ur as createGitHubUpdateManifest,fo as createGitHubUpdater,Vo as createImageView,ae as createInterval,Wo as createLabel,Yo as createListView,tr as createMediaPlayer,pr as createMenubar,Ko as createModalComponent,ts as createPreferences,Ao as createProgressBar,zo as createRadioButton,No as createRating,Uo as createScrollView,qr as createSelfUpdater,Co as createSlider,jo as createSplitView,Go as createStepper,io as createSystemTray,Xo as createTable,Do as createTabs,So as createTextInput,Lo as createTimePicker,ie as createTimer,Fo as createTooltip,Jo as createTreeView,sr as createWebView,Ir as createWindow,Or as createWindowWithHTML,l as decaffeinate,be as deepLinks,se as delay,T as dismissAlertById,E as dismissAllAlerts,he as dragOut,Vr as extractBundle,Ke as fileAssociations,d as focus,He as focusShortcutsReady,le as formatCompact,ee as formatDuration,Z as formatRemainingTime,te as formatShortcut,ce as formatTime,pe as fs,lo as generateUpdateManifest,M as getActiveAlertCount,F as getActiveModalCount,ur as getActiveTrayInstances,Tr as getActiveWindowIds,Q as getCaffeinateStatus,at as getCapabilities,v as getCapability,kr as getDesktopConfig,Y as getDialogBridgeScript,oe as getRegisteredHotkeys,mr as getSimulatedTrayHTML,gr as getTrayBridgeScript,fr as getTrayInstance,Cr as getWindow,Er as getWindowBridgeScript,po as githubLatestAssetUrl,uo as githubReleaseAssetUrl,me as globalShortcuts,i as handoff,ze as hasFocusShortcuts,Le as iap,ds as isAutoLaunchEnabled,st as isAvailable,J as isCaffeinated,we as isDragOutAvailable,Dr as isWebviewAvailable,$e as keychain,_e as liveActivities,Ue as localServer,Ne as location,Xe as log,Ae as menu,tt as midi,Me as nativeAutoLaunch,De as nativeWindow,ye as network,ue as notifications,I as notify,Mr as openDevWindow,Nr as pack,zr as packageApp,m as parseShortcut,Ye as pdf,Te as permissions,Ee as printing,N as prompt,xo as quitLauncher,Xt as readBundleIdentity,w as redactPII,re as registerHotkey,mo as relaunchBundle,P as requestNotificationPermission,Pr as resetDesktopConfig,_r as resolveCraftBinary,jr as runningBundleTeamId,Ie as screen,Fe as screenCapture,s as screenSharing,it as serial,ot as serviceMenu,ls as setAutoLaunch,$r as setDesktopConfig,fe as shell,c as showAlert,V as showAlertDialog,q as showColorPicker,j as showConfirmDialog,K as showErrorDialog,O as showErrorModal,C as showErrorToast,p as showInfoModal,S as showInfoToast,n as showMessageBox,t as showModal,H as showOpenDialog,f as showQuestionModal,U as showSaveDialog,R as showSuccessModal,k as showSuccessToast,r as showToast,G as showWarningDialog,B as showWarningModal,A as showWarningToast,h as sidebar,b as signPayload,Re as speech,Ze as speechRecognition,Qe as spotlight,ke as standardMenus,Hr as swapBundle,cs as system,Ge as tags,ge as theme,Be as touchbar,xr as triggerTrayAction,ne as unregisterAllHotkeys,g as unregisterHotkey,ve as updater,Fr as verifyBundleTrust,et as vision,We as watchScreenSharing,Pe as windowEvents};
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED