@stacksjs/desktop 0.2.634 → 0.2.635
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/browser.js +1 -1
- package/dist/chunk-r328ytce.js +347 -0
- package/dist/index.js +75 -75
- package/dist/power-native.d.ts +3 -0
- package/dist/power.d.ts +3 -3
- package/package.json +1 -1
- package/dist/chunk-aa3mwv0w.js +0 -347
package/dist/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
<label class="${
|
|
4
|
-
<input ${
|
|
2
|
+
import{u,P,s,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,c,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,l,a,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-r328ytce.js";function Tt(lt="stx"){return`${lt}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function vt(lt){return lt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function St(...lt){return lt.filter(Boolean).join(" ")}function Pt(lt){if(!lt)return"";return Object.entries(lt).map(([dt,ct])=>`${dt.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${ct}`).join("; ")}function Po(lt){let{text:dt,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}=lt,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(dt)}</span>`:`<span class="stx-button-text">${vt(dt)}</span>${$t}${kt}`;return`<button id="${xt}" class="${wt}" ${ut||ft?"disabled":""} ${gt?`style='${gt}'`:""}>${Ct}</button>`}function So(lt){let{value:dt="",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}=lt,It=St("stx-input",gt&&"stx-input--error",ut&&"stx-input--disabled",Ct),Wt=Pt(At),ko=[`type="${pt}"`,`id="${kt}"`,`class="${It}"`,dt&&`value="${vt(dt)}"`,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(lt){let{checked:dt=!1,label:ct,disabled:pt=!1,indeterminate:ut=!1,id:ft=Tt("checkbox"),className:bt,style:mt}=lt,xt=St("stx-checkbox",pt&&"stx-checkbox--disabled",bt),yt=Pt(mt),ht=['type="checkbox"',`id="${ft}"`,dt&&"checked",pt&&"disabled",ut&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
3
|
+
<label class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
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="${
|
|
10
|
-
<div class="stx-progress-bar" style="width: ${
|
|
11
|
-
${
|
|
8
|
+
`}function Co(lt){let{value:dt=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}=lt,wt=St("stx-slider",ft&&"stx-slider--disabled",yt),gt=Pt(ht),$t=['type="range"',`id="${xt}"`,`value="${dt}"`,`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">${dt}</span>`;return`<div class="${wt}" ${gt?`style='${gt}'`:""}>${kt}</div>`}function Ao(lt){let{value:dt,max:ct=100,variant:pt="default",size:ut="medium",showLabel:ft=!1,indeterminate:bt=!1,id:mt=Tt("progress"),className:xt,style:yt}=lt,ht=Math.min(100,Math.max(0,dt/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="${dt}" aria-valuemin="0" aria-valuemax="${ct}" ${gt?`style="${gt}"`:""}>
|
|
10
|
+
<div class="stx-progress-bar" style="width: ${bt?"100%":`${ht}%`}"></div>
|
|
11
|
+
${ft?`<span class="stx-progress-label">${Math.round(ht)}%</span>`:""}
|
|
12
12
|
</div>
|
|
13
|
-
`}function Io(
|
|
14
|
-
<img src="${
|
|
15
|
-
</div>`;return`<div id="${
|
|
16
|
-
<span class="stx-avatar-initials">${
|
|
17
|
-
</div>`}function Oo(
|
|
18
|
-
<label class="${
|
|
19
|
-
<input ${
|
|
13
|
+
`}function Io(lt){let{text:dt,variant:ct="default",size:pt="medium",id:ut=Tt("badge"),className:ft,style:bt}=lt,mt=St("stx-badge",`stx-badge--${ct}`,`stx-badge--${pt}`,ft),xt=Pt(bt);return`<span id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${vt(dt)}</span>`}function Mo(lt){let{src:dt,alt:ct="",name:pt,size:ut="medium",shape:ft="circle",id:bt=Tt("avatar"),className:mt,style:xt}=lt,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(dt)return`<div id="${bt}" class="${wt}" ${gt?`style="${gt}"`:""}>
|
|
14
|
+
<img src="${vt(dt)}" alt="${vt(ct)}" class="stx-avatar-img" />
|
|
15
|
+
</div>`;return`<div id="${bt}" class="${wt}" ${gt?`style="${gt}"`:""}>
|
|
16
|
+
<span class="stx-avatar-initials">${$t}</span>
|
|
17
|
+
</div>`}function Oo(lt){let{title:dt,subtitle:ct,content:pt,image:ut,footer:ft,variant:bt="default",id:mt=Tt("card"),className:xt,style:yt}=lt,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">',dt)gt+=`<h3 class="stx-card-title">${vt(dt)}</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(lt){let{tabs:dt,activeTab:ct,variant:pt="default",id:ut=Tt("tabs"),className:ft,style:bt}=lt,mt=St("stx-tabs",`stx-tabs--${pt}`,ft),xt=Pt(bt),yt=dt.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(lt){let{options:dt,value:ct,placeholder:pt="Select...",disabled:ut=!1,id:ft=Tt("dropdown"),className:bt,style:mt}=lt,xt=St("stx-dropdown",ut&&"stx-dropdown--disabled",bt),yt=Pt(mt),ht=dt.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(lt){let{value:dt=0,max:ct=5,readonly:pt=!1,size:ut="medium",allowHalf:ft=!1,id:bt=Tt("rating"),className:mt,style:xt}=lt,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<=dt,kt=ft&>-0.5===dt;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="${dt}" aria-valuemin="0" aria-valuemax="${ct}" ${ht?`style='${ht}'`:""}>${wt}</div>`}function zo(lt){let{value:dt,name:ct,checked:pt=!1,label:ut,disabled:ft=!1,id:bt=Tt("radio"),className:mt,style:xt}=lt,yt=St("stx-radio",ft&&"stx-radio--disabled",mt),ht=Pt(xt),wt=['type="radio"',`id="${bt}"`,`name="${vt(ct)}"`,`value="${vt(dt)}"`,pt&&"checked",ft&&"disabled"].filter(Boolean).join(" ");return`
|
|
18
|
+
<label class="${yt}" ${ht?`style="${ht}"`:""}>
|
|
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="${
|
|
25
|
-
<span class="stx-color-picker-value">${
|
|
26
|
-
</div>`,
|
|
27
|
-
<input ${
|
|
28
|
-
${
|
|
29
|
-
</div>`,`<div class="${
|
|
30
|
-
<input type="text" id="${
|
|
31
|
-
${
|
|
32
|
-
</div
|
|
33
|
-
${
|
|
34
|
-
<span class="stx-tooltip stx-tooltip--${
|
|
35
|
-
</div>`}function Uo(
|
|
36
|
-
<div class="stx-split-pane" style="${
|
|
37
|
-
${
|
|
38
|
-
<div class="stx-split-pane" style="${
|
|
39
|
-
</div>`}function qo(
|
|
40
|
-
<button class="stx-accordion-header" ${
|
|
41
|
-
<span class="stx-accordion-title">${
|
|
23
|
+
`}function Bo(lt){let{value:dt="#3498db",disabled:ct=!1,label:pt,presetColors:ut=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:ft=Tt("color"),className:bt,style:mt}=lt,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(dt)}" ${ct?"disabled":""} />
|
|
25
|
+
<span class="stx-color-picker-value">${vt(dt)}</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(lt){let{value:dt,min:ct,max:pt,disabled:ut=!1,label:ft,placeholder:bt="Select date",showClear:mt=!0,id:xt=Tt("date"),className:yt,style:ht}=lt,wt=St("stx-date-picker",ut&&"stx-date-picker--disabled",yt),gt=Pt(ht),$t=dt instanceof Date?dt.toISOString().split("T")[0]:dt||"",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
|
+
<input ${At} />
|
|
28
|
+
${mt&&$t?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
29
|
+
</div>`,`<div class="${wt}" ${gt?`style='${gt}'`:""}>${It}</div>`}function Lo(lt){let{value:dt="",disabled:ct=!1,label:pt,step:ut=60,min:ft,max:bt,id:mt=Tt("time"),className:xt,style:yt}=lt,ht=St("stx-time-picker",ct&&"stx-time-picker--disabled",xt),wt=Pt(yt),gt=['type="time"',`id="${mt}"`,dt&&`value="${vt(dt)}"`,`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(lt){let{options:dt,value:ct="",placeholder:pt="Search...",disabled:ut=!1,label:ft,loading:bt=!1,id:mt=Tt("autocomplete"),className:xt,style:yt}=lt,ht=St("stx-autocomplete",ut&&"stx-autocomplete--disabled",xt),wt=Pt(yt),gt=dt.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
|
+
<input type="text" id="${mt}" value="${vt($t)}" placeholder="${vt(pt)}" ${ut?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
31
|
+
${bt?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
32
|
+
</div>`,kt+='<ul class="stx-autocomplete-list">';for(let Ct of dt)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(lt){let{text:dt,htmlFor:ct,required:pt=!1,size:ut="medium",id:ft=Tt("label"),className:bt,style:mt}=lt,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(dt)}${pt?'<span class="stx-label-required">*</span>':""}</label>`}function Vo(lt){let{src:dt,alt:ct="",width:pt,height:ut,objectFit:ft="cover",fallback:bt,loading:mt="lazy",id:xt=Tt("image"),className:yt,style:ht}=lt,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(dt)}" alt="${vt(ct)}" loading="${mt}" ${$t?`style='${$t}'`:""} ${kt} />`}function Ho(lt){let{text:dt,variant:ct="default",size:pt="medium",removable:ut=!1,icon:ft,id:bt=Tt("chip"),className:mt,style:xt}=lt,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(dt)}</span>`,ut)wt+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${bt}" class="${yt}" ${ht?`style='${ht}'`:""}>${wt}</span>`}function Fo(lt){let{text:dt,position:ct="top",delay:pt=200,children:ut,id:ft=Tt("tooltip"),className:bt,style:mt}=lt,xt=St("stx-tooltip-wrapper",bt),yt=Pt(mt);return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""} data-tooltip="${vt(dt)}" data-position="${ct}" data-delay="${pt}">
|
|
33
|
+
${ut}
|
|
34
|
+
<span class="stx-tooltip stx-tooltip--${ct}">${vt(dt)}</span>
|
|
35
|
+
</div>`}function Uo(lt){let{direction:dt="vertical",showScrollbar:ct=!0,smooth:pt=!0,height:ut,width:ft,children:bt,id:mt=Tt("scroll"),className:xt,style:yt}=lt,ht=St("stx-scroll-view",`stx-scroll-view--${dt}`,!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(lt){let{direction:dt="horizontal",sizes:ct=[50,50],resizable:pt=!0,children:ut,id:ft=Tt("split"),className:bt,style:mt}=lt,xt=St("stx-split-view",`stx-split-view--${dt}`,pt&&"stx-split-view--resizable",bt),yt=Pt(mt),ht=dt==="horizontal"?"width":"height";return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
36
|
+
<div class="stx-split-pane" style="${ht}: ${ct[0]}%">${ut[0]}</div>
|
|
37
|
+
${pt?'<div class="stx-split-divider"></div>':""}
|
|
38
|
+
<div class="stx-split-pane" style="${ht}: ${ct[1]}%">${ut[1]}</div>
|
|
39
|
+
</div>`}function qo(lt){let{items:dt,multiple:ct=!1,defaultOpen:pt=[],id:ut=Tt("accordion"),className:ft,style:bt}=lt,mt=St("stx-accordion",ft),xt=Pt(bt),yt="";return dt.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
|
+
<button class="stx-accordion-header" ${ht.disabled?"disabled":""} aria-expanded="${gt}" data-multiple="${ct}">
|
|
41
|
+
<span class="stx-accordion-title">${vt(ht.title)}</span>
|
|
42
42
|
<span class="stx-accordion-icon">\u25BC</span>
|
|
43
43
|
</button>
|
|
44
|
-
<div class="stx-accordion-content" ${
|
|
45
|
-
${
|
|
44
|
+
<div class="stx-accordion-content" ${gt?"":"hidden"}>
|
|
45
|
+
${vt(ht.content)}
|
|
46
46
|
</div>
|
|
47
|
-
</div>`}),`<div id="${
|
|
47
|
+
</div>`}),`<div id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Go(lt){let{steps:dt,currentStep:ct,orientation:pt="horizontal",id:ut=Tt("stepper"),className:ft,style:bt}=lt,mt=St("stx-stepper",`stx-stepper--${pt}`,ft),xt=Pt(bt),yt="";return dt.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>
|
|
51
51
|
<div class="stx-step-content">
|
|
52
|
-
<div class="stx-step-label">${
|
|
53
|
-
${
|
|
52
|
+
<div class="stx-step-label">${vt(ht.label)}</div>
|
|
53
|
+
${ht.description?`<div class="stx-step-description">${vt(ht.description)}</div>`:""}
|
|
54
54
|
</div>
|
|
55
|
-
</div>`,
|
|
56
|
-
<div class="stx-list-view-empty">${
|
|
57
|
-
</div>`;let
|
|
55
|
+
</div>`,wt<dt.length-1)yt+='<div class="stx-step-connector"></div>'}),`<div id="${ut}" class="${mt}" ${xt?`style='${xt}'`:""}>${yt}</div>`}function Ko(lt){let{open:dt=!1,title:ct,size:pt="medium",closable:ut=!0,children:ft,footer:bt,id:mt=Tt("modal"),className:xt,style:yt}=lt,ht=St("stx-modal-component",`stx-modal-component--${pt}`,xt),wt=Pt(yt);if(!dt)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(lt){let{items:dt,selectable:ct=!1,multiSelect:pt=!1,emptyMessage:ut="No items",id:ft=Tt("list"),className:bt,style:mt}=lt,xt=St("stx-list-view",ct&&"stx-list-view--selectable",pt&&"stx-list-view--multi",bt),yt=Pt(mt);if(dt.length===0)return`<div id="${ft}" class="${xt}" ${yt?`style="${yt}"`:""}>
|
|
56
|
+
<div class="stx-list-view-empty">${vt(ut)}</div>
|
|
57
|
+
</div>`;let ht='<ul class="stx-list-view-items">';for(let wt of dt){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(lt){let{columns:dt,data:ct,striped:pt=!1,bordered:ut=!1,hoverable:ft=!0,sortBy:bt,sortOrder:mt,id:xt=Tt("table"),className:yt,style:ht}=lt,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 dt){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 dt){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(lt,dt,ct,pt){let ut=dt.includes(lt.key),ft=ct.includes(lt.key),bt=lt.children&<.children.length>0,xt=`<div class="${St("stx-tree-node",ft&&"stx-tree-node--selected",lt.disabled&&"stx-tree-node--disabled")}" data-key="${vt(lt.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":""} ${lt.disabled?"disabled":""} />`;if(lt.icon)xt+=`<span class="stx-tree-icon">${lt.icon}</span>`;if(xt+=`<span class="stx-tree-label">${vt(lt.label)}</span>`,xt+="</div>",bt&&ut){xt+='<div class="stx-tree-children">';for(let yt of lt.children)xt+=Zt(yt,dt,ct,pt);xt+="</div>"}return xt+="</div>",xt}function Jo(lt){let{nodes:dt,expandedKeys:ct=[],selectedKeys:pt=[],checkable:ut=!1,id:ft=Tt("tree"),className:bt,style:mt}=lt,xt=St("stx-tree-view",ut&&"stx-tree-view--checkable",bt),yt=Pt(mt),ht="";for(let wt of dt)ht+=Zt(wt,ct,pt,ut);return`<div id="${ft}" class="${xt}" role="tree" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Qo(lt){let{columns:dt,data:ct,pagination:pt,selectable:ut=!1,id:ft=Tt("datagrid"),className:bt,style:mt}=lt,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 dt){let gt=wt.width?`style="width: ${wt.width}"`:"";ht+=`<th ${gt}>
|
|
58
58
|
<div class="stx-data-grid-header-cell">
|
|
59
|
-
<span>${wt
|
|
60
|
-
${
|
|
61
|
-
${
|
|
59
|
+
<span>${vt(wt.label)}</span>
|
|
60
|
+
${wt.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
61
|
+
${wt.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
|
|
62
62
|
</div>
|
|
63
|
-
</th>`}
|
|
64
|
-
<span class="stx-data-grid-page-info">Page ${
|
|
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 dt){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
|
+
<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
|
-
<button class="stx-data-grid-page-btn" ${
|
|
67
|
-
<button class="stx-data-grid-page-btn" ${
|
|
66
|
+
<button class="stx-data-grid-page-btn" ${pt.page<=1?"disabled":""}>\u25C0</button>
|
|
67
|
+
<button class="stx-data-grid-page-btn" ${pt.page>=wt?"disabled":""}>\u25B6</button>
|
|
68
68
|
</div>
|
|
69
|
-
</div>`}return`<div id="${
|
|
69
|
+
</div>`}return`<div id="${ft}" class="${xt}" ${yt?`style='${yt}'`:""}>${ht}</div>`}function Zo(lt){let{type:dt,data:ct,options:pt={},width:ut="100%",height:ft=300,id:bt=Tt("chart"),className:mt,style:xt}=lt,yt=St("stx-chart",`stx-chart--${dt}`,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:dt,data:ct,options:pt});return`<div id="${bt}" class="${yt}" style="${wt}" data-chart='${vt(gt)}'>
|
|
70
70
|
<div class="stx-chart-placeholder">
|
|
71
|
-
${
|
|
72
|
-
<div class="stx-chart-type">${
|
|
73
|
-
<div class="stx-chart-info">${
|
|
71
|
+
${pt.title?`<div class="stx-chart-title">${vt(pt.title)}</div>`:""}
|
|
72
|
+
<div class="stx-chart-type">${dt.charAt(0).toUpperCase()+dt.slice(1)} Chart</div>
|
|
73
|
+
<div class="stx-chart-info">${ct.datasets.length} dataset(s), ${ct.labels.length} labels</div>
|
|
74
74
|
</div>
|
|
75
|
-
</div>`}function er(
|
|
76
|
-
`),
|
|
77
|
-
<td><span class="stx-file-explorer-icon">${
|
|
78
|
-
<td>${
|
|
79
|
-
<td>${
|
|
80
|
-
</tr>`}
|
|
81
|
-
<div class="stx-file-explorer-icon">${
|
|
82
|
-
<div class="stx-file-explorer-name">${
|
|
83
|
-
</div>`}
|
|
75
|
+
</div>`}function er(lt){let{value:dt="",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}=lt,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=dt.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(dt)}</code></pre>`,`<div id="${yt}" class="${gt}" style="${kt}" data-language="${vt(ct)}" data-tab-size="${mt}">${At}</div>`}function tr(lt){let{src:dt,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}=lt,$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(dt)}"`,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(lt){if(lt===void 0)return"";let dt=["B","KB","MB","GB"],ct=lt,pt=0;while(ct>=1024&&pt<dt.length-1)ct/=1024,pt++;return`${ct.toFixed(1)} ${dt[pt]}`}function rr(lt){let{files:dt,viewMode:ct="list",showHidden:pt=!1,selectable:ut=!0,id:ft=Tt("files"),className:bt,style:mt}=lt,xt=St("stx-file-explorer",`stx-file-explorer--${ct}`,bt),yt=Pt(mt),ht=pt?dt:dt.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
|
+
<td><span class="stx-file-explorer-icon">${$t}</span>${vt(gt.name)}</td>
|
|
78
|
+
<td>${kt}</td>
|
|
79
|
+
<td>${Ct}</td>
|
|
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
|
+
<div class="stx-file-explorer-icon">${$t}</div>
|
|
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(lt){let{url:dt,width:ct="100%",height:pt=400,sandbox:ut=!0,allowScripts:ft=!0,id:bt=Tt("webview"),className:mt,style:xt}=lt,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(dt)}" 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{v,s,r,P,S,k,A,C,I,T,E,M,t,d,D,B,O,u,L,R,_,N,F,z,W,H,n,U,q,V,j,K,G,Y,p,X,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(
|
|
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,dt){if(lt.type==="separator")return{id:`sep-${dt}`,label:"",type:"separator"};let ct={id:`item-${dt}-${lt.label.replace(/\s+/g,"-").toLowerCase()}`,label:lt.label,type:lt.type||"normal",enabled:lt.enabled!==!1};if(lt.accelerator)ct.shortcut=lt.accelerator;if(lt.type==="checkbox")ct.checked=lt.checked||!1;if(lt.type==="submenu"&<.submenu)ct.submenu=lt.submenu.map((pt,ut)=>ro(pt,ut));return ct}function jt(lt){return lt.map((dt,ct)=>ro(dt,ct))}function so(lt,dt=0){if(lt.type==="separator")return'<hr class="stx-tray-separator" />';let ct=" ".repeat(dt),pt=lt.enabled===!1?"disabled":"",ut=lt.checked?"\u2713 ":"",ft=lt.accelerator?`<span class="accelerator">${lt.accelerator}</span>`:"",bt=`${ct}<div class="stx-tray-item ${pt}" data-action="${lt.label}">`;if(bt+=`<span class="label">${ut}${lt.label}</span>${ft}`,lt.type==="submenu"&<.submenu){bt+='<span class="arrow">\u25B8</span>',bt+='<div class="stx-tray-submenu">';for(let mt of lt.submenu)bt+=so(mt,dt+1);bt+="</div>"}return bt+="</div>",bt}function lr(lt){let dt='<div class="stx-tray-menu">';for(let ct of lt)dt+=so(ct);return dt+="</div>",dt}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",(lt)=>{let{action:dt}=lt.detail;for(let ct of Dt.values()){let pt=ct.handlers.get(dt);if(pt){pt();break}}}),to=!0}async function io(lt={}){let dt=dr(),ct=ar(),pt=oo(),ut={icon:lt.icon||"",tooltip:lt.tooltip||"stx Application",menu:lt.menu||[],visible:!0},ft=new Map;for(let mt of lt.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(dt,{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: ${dt}`),console.log(`[stx-tray] Tooltip: ${ut.tooltip}`),console.log(`[stx-tray] Menu items: ${ut.menu.length}`);return{id:dt,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:${dt}] 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:${dt}] 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:${dt}] Menu updated (${mt.length} items)`)},destroy:()=>{if(ut.visible=!1,Dt.delete(dt),pt)window.craft.tray.destroy?.().catch((xt)=>{console.warn("[stx-tray] Failed to destroy tray:",xt)});console.log(`[stx-tray:${dt}] Destroyed`)}}}var pr=io;function ur(){return Array.from(Dt.keys())}function fr(lt){let dt=Dt.get(lt);if(!dt)return null;let ct=oo();return{id:lt,setIcon:(pt)=>{if(dt.state.icon=pt,ct)window.craft.tray.setIcon({icon:pt}).catch(()=>{})},setTooltip:(pt)=>{if(dt.state.tooltip=pt,ct)window.craft.tray.setTooltip({tooltip:pt}).catch(()=>{})},setMenu:(pt)=>{if(dt.state.menu=pt,ct){let ut=window,ft=jt(pt);ut.craft.tray.setMenu({items:ft}).catch(()=>{})}},destroy:()=>{if(Dt.delete(lt),ct)window.craft.tray.destroy?.().catch(()=>{})}}}function xr(lt,dt){let ct=Dt.get(lt);if(!ct)return!1;let pt=ct.handlers.get(dt);if(pt)return pt(),!0;return!1}function mr(lt){let dt=Dt.get(lt);if(!dt)return null;return lr(dt.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
|
|
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(lt){Nt={...Nt,...lt}}function kr(){return{...Nt}}function Pr(){Nt={}}function qt(lt){if(!lt.sidebarConfig)return;let dt={...lt.sidebarConfig};if(dt.variant==="desktop")dt.material=dt.material??"sidebar",dt.backgroundEffect=dt.backgroundEffect??"shimmer",dt.allowsVibrancy=dt.allowsVibrancy??!0;return dt}function Vt(){let lt=yr(Et.execPath),dt=lt.includes(".app/Contents/MacOS")?wr(lt,"craft"):void 0,ct=[Et.env.CRAFT_BINARY_PATH,Nt.craftBinaryPath,...Nt.additionalSearchPaths||[],dt];for(let pt of ct)if(pt&&hr(pt))return pt;return vr()}var Mt=new Map;function Gt(lt){let dt=Mt.get(lt);if(!dt||dt.closed)return;dt.closed=!0;for(let ct of dt.closeListeners??[])try{ct()}catch(pt){console.warn(`[stx/desktop] window ${lt} close listener threw:`,pt)}dt.closeListeners?.clear()}var Sr=50;async function Kt(lt,dt){let ct=dt.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(lt))}function Tr(){return Array.from(Mt.keys())}function Cr(lt){let dt=Mt.get(lt);if(!dt)return null;return Ht(lt,dt.app)}function Ar(){for(let[lt,dt]of Mt)try{dt.app?.close?.()}catch(ct){console.warn(`Failed to close window ${lt}:`,ct)}Mt.clear()}function Ht(lt,dt){return{id:lt,show:()=>{console.log(`[stx/desktop] Window ${lt} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let ct=Mt.get(lt);if(ct?.app)ct.app.close(),Gt(lt),Mt.delete(lt),console.log(`[stx/desktop] Window ${lt} closed`)},onClosed:(ct)=>{let pt=Mt.get(lt);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(lt,dt={}){let ct=["--url",lt,"--title",dt.title||"stx Desktop","--width",String(dt.width??1200),"--height",String(dt.height??800)];if(dt.darkMode)ct.push("--dark");if(dt.hotReload)ct.push("--hot-reload");if(dt.resizable===!1)ct.push("--no-resize");if(dt.frameless)ct.push("--frameless");if(dt.alwaysOnTop)ct.push("--always-on-top");if(dt.titlebarHidden)ct.push("--titlebar-hidden");if(dt.systemTray)ct.push("--system-tray");if(dt.hideDockIcon)ct.push("--hide-dock-icon");if(dt.devTools===!1)ct.push("--no-devtools");if(dt.nativeSidebar)ct.push("--native-sidebar");if(dt.sidebarWidth!==void 0)ct.push("--sidebar-width",String(dt.sidebarWidth));let pt=qt(dt);if(pt)ct.push("--sidebar-config",JSON.stringify(pt));return ct}async function Ir(lt,dt={}){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:lt,craftPath:pt,window:{title:dt.title||"stx Desktop",width:dt.width??1200,height:dt.height??800,darkMode:dt.darkMode??!1,hotReload:dt.hotReload??!1,resizable:dt.resizable??!0,frameless:dt.frameless??!1,alwaysOnTop:dt.alwaysOnTop??!1,titlebarHidden:dt.titlebarHidden??!1,systemTray:dt.systemTray??!1,hideDockIcon:dt.hideDockIcon??!1,devTools:dt.devTools??!1,nativeSidebar:dt.nativeSidebar??!1,sidebarWidth:dt.sidebarWidth,sidebarConfig:qt(dt)}});return Mt.set(ct,{app:ft,url:lt,options:dt}),await Kt(ct,ft),Ht(ct,ft)}catch{try{let{spawn:ut}=await import("child_process"),ft=ut(pt,Yt(lt,dt),{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:lt,options:dt}),ft.on("exit",()=>Gt(ct)),Ht(ct,bt)}catch(ut){return console.error("Failed to spawn craft binary:",ut.message),null}}}async function Mr(lt,dt={}){let ct=`http://localhost:${lt}/`;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=!dt.nativeSidebar,bt=qt(dt),mt=ut({url:ct,craftPath:Vt(),window:{title:dt.title||"stx Development",width:dt.width||1400,height:dt.height||900,resizable:!0,systemTray:ft,darkMode:dt.darkMode??!0,hotReload:dt.hotReload??!0,devTools:!0,titlebarHidden:dt.titlebarHidden??!1,nativeSidebar:dt.nativeSidebar??!1,sidebarWidth:dt.sidebarWidth??260,sidebarConfig:bt}}),xt=`dev-window-${lt}`;return Mt.set(xt,{app:mt,url:ct,options:dt}),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,...dt}),{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-${lt}`;return Mt.set(mt,{app:{close:()=>bt.kill()},url:ct,options:dt}),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(lt,dt={}){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}=dt;try{let{createApp:ht}=await import("craft-native"),wt=Vt(),gt=ht({html:lt,craftPath:wt,window:{title:ct,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:dt}),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,30 +557,30 @@ 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
|
|
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,dt){return`https://github.com/${lt}/releases/latest/download/${dt}`}function uo(lt,dt,ct){return`https://github.com/${lt}/releases/download/${dt}/${ct}`}function fo(lt){let{repository:dt,manifestAsset:ct=co,...pt}=lt;return new ao({...pt,updateUrl:po(dt,ct)})}function Ur(lt){let dt=lt.tag??`v${lt.version}`,ct={};for(let[pt,ut]of Object.entries(lt.artifacts)){if(!ut)continue;ct[pt]={path:ut,url:uo(lt.repository,dt,ut.split("/").pop())}}return lo({version:lt.version,releaseNotes:lt.releaseNotes,platforms:ct})}function Ft(lt=Lt.execPath){let dt=lt.split("/");for(let ct=0;ct<dt.length;ct++)if(dt[ct].endsWith(".app"))return dt.slice(0,ct+1).join("/");return null}async function jr(){let lt=Ft();if(!lt)return null;return(await Xt(lt)).teamId}function xo(){let lt=Lt.ppid;if(lt>1)try{Lt.kill(lt,"SIGTERM");return}catch{}Lt.exit(0)}function mo(lt={}){let dt=lt.appPath??Ft(),ct=lt.quit??(()=>Lt.exit(0));if(dt)Lr("/usr/bin/open",["-n",dt],{detached:!0,stdio:"ignore"}).unref();let pt=lt.quitDelayMs??0;if(pt>0){setTimeout(ct,pt).unref?.();return}ct()}async function qr(lt){let{appPath:dt,requireSameTeam:ct=!0,macos:pt,...ut}=lt,ft=dt??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:lt.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(lt){let dt=Qr(),ct=Jr();switch(dt){case"darwin":return Rt(ct,"Library","Application Support",lt);case"win32":return Rt(process.env.APPDATA||Rt(ct,"AppData","Roaming"),lt);default:return Rt(ct,".config",lt)}}class go{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(lt){this._defaults={...lt.defaults};let dt=lt.path?Zr(lt.path):es(lt.name);if(this._path=lt.path||Rt(dt,"preferences.json"),!Jt(dt))Gr(dt,{recursive:!0});if(this._data=this._load(),lt.watch!==!1)this._setupWatcher()}get path(){return this._path}get(lt){if(lt in this._data)return this._data[lt];return this._defaults[lt]}set(lt,dt){let ct=this.get(lt);if(JSON.stringify(ct)===JSON.stringify(dt))return;this._data[lt]=dt,this._scheduleSave(),this._notifyChange(lt,dt,ct)}getAll(){return{...this._defaults,...this._data}}has(lt){return lt in this._data}delete(lt){if(!(lt in this._data))return;let dt=this._data[lt];delete this._data[lt],this._scheduleSave(),this._notifyChange(lt,this._defaults[lt],dt)}reset(){let lt={...this._data};this._data={},this._save();for(let dt of Object.keys(lt)){let ct=this._defaults[dt];this._notifyChange(dt,ct,lt[dt])}}onChange(lt,dt){let ct=lt;if(!this._changeHandlers.has(ct))this._changeHandlers.set(ct,new Set);return this._changeHandlers.get(ct).add(dt),()=>{this._changeHandlers.get(ct)?.delete(dt)}}onAnyChange(lt){return this._anyChangeHandlers.add(lt),()=>{this._anyChangeHandlers.delete(lt)}}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 lt=Kr(this._path,"utf-8");return JSON.parse(lt)}}catch{}return{}}_save(){this._writing=!0;try{let lt=JSON.stringify({...this._defaults,...this._data},null,2);Xr(this._path,lt,"utf-8")}catch(lt){console.error(`Failed to save preferences to ${this._path}:`,lt)}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 lt=this._load(),dt={...this._data};this._data=lt;let ct=new Set([...Object.keys(dt),...Object.keys(lt)]);for(let pt of ct){let ut=pt in dt?dt[pt]:this._defaults[pt],ft=pt in lt?lt[pt]:this._defaults[pt];if(JSON.stringify(ut)!==JSON.stringify(ft))this._notifyChange(pt,ft,ut)}})}catch{}}_notifyChange(lt,dt,ct){let pt=this._changeHandlers.get(lt);if(pt)for(let ut of pt)try{ut(dt,ct)}catch{}for(let ut of this._anyChangeHandlers)try{ut(lt,dt,ct)}catch{}}}function ts(lt){return new go(lt)}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(lt){let dt=lt.toLowerCase().replace(/[^a-z0-9]/g,"-");return Bt(Ut(),"Library","LaunchAgents",`com.${dt}.plist`)}function $o(lt){let dt=process.env.XDG_CONFIG_HOME||Bt(Ut(),".config");return Bt(dt,"autostart",`${lt.toLowerCase()}.desktop`)}async function rs(lt,dt){let ct=dt.appName||"StxApp",pt=vo(ct),ut=Bt(Ut(),"Library","LaunchAgents");if(lt){let ft=dt.appPath||process.execPath,bt=dt.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>
|
|
564
564
|
<key>Label</key>
|
|
565
|
-
<string>com.${
|
|
565
|
+
<string>com.${ct.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
|
|
566
566
|
<key>ProgramArguments</key>
|
|
567
567
|
<array>
|
|
568
|
-
${
|
|
568
|
+
${mt.map((yt)=>` <string>${as(yt)}</string>`).join(`
|
|
569
569
|
`)}
|
|
570
570
|
</array>
|
|
571
571
|
<key>RunAtLoad</key>
|
|
572
572
|
<true/>
|
|
573
573
|
<key>KeepAlive</key>
|
|
574
574
|
<false/>
|
|
575
|
-
${
|
|
575
|
+
${dt.isHidden?` <key>ProcessType</key>
|
|
576
576
|
<string>Background</string>`:""}
|
|
577
577
|
</dict>
|
|
578
|
-
</plist>`;if(!
|
|
578
|
+
</plist>`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function ss(lt,dt){let ct=dt.appName||"StxApp",pt=$o(ct),ut=Bt(process.env.XDG_CONFIG_HOME||Bt(Ut(),".config"),"autostart");if(lt){let ft=dt.appPath||process.execPath,bt=dt.args||[],mt=[ft,...bt].join(" "),xt=`[Desktop Entry]
|
|
579
579
|
Type=Application
|
|
580
|
-
Name=${
|
|
581
|
-
Exec=${
|
|
580
|
+
Name=${ct}
|
|
581
|
+
Exec=${mt}
|
|
582
582
|
Terminal=false
|
|
583
583
|
StartupNotify=false
|
|
584
|
-
${
|
|
584
|
+
${dt.isHidden?`X-GNOME-Autostart-enabled=true
|
|
585
585
|
NoDisplay=true`:""}
|
|
586
|
-
`;if(!
|
|
586
|
+
`;if(!zt(ut))bo(ut,{recursive:!0});yo(pt,xt,"utf-8")}else if(zt(pt))ho(pt)}async function is(lt){return zt(vo(lt))}async function ns(lt){let dt=$o(lt);if(!zt(dt))return!1;try{let ct=os(dt,"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(lt){return lt.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function ls(lt,dt={}){let ct=wo();switch(ct){case"darwin":return rs(lt,dt);case"linux":return ss(lt,dt);default:throw Error(`Auto-launch is not yet supported on ${ct}`)}}async function ds(lt){let dt=lt||"StxApp";switch(wo()){case"darwin":return is(dt);case"linux":return ns(dt);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 lt=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return lt.hourCycle==="h23"||lt.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(lt,dt,ct){if(e(lt))return await window.craft[lt][dt]();return await ct()}function Qt(lt){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(lt).matches}export{ir as AVAILABLE_COMPONENTS,ao as AutoUpdater,nr as COMPONENT_STYLES,l 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,c 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,a as screenSharing,it as serial,ot as serviceMenu,ls as setAutoLaunch,$r as setDesktopConfig,fe as shell,s 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};
|