@stacksjs/desktop 0.2.351 → 0.2.353
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/_bridge.d.ts +1 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/index.js +24 -24
- package/package.json +1 -1
package/dist/_bridge.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export declare interface CraftEventMap {
|
|
|
56
56
|
'craft:location:error': { message: string }
|
|
57
57
|
'craft:location:authChanged': { status: import('./location').LocationAuthStatus }
|
|
58
58
|
'craft:menu:action': import('./menu').MenuActionEvent
|
|
59
|
+
'craft:contextmenu:action': { id: string | null, targetId: string, targetType: string }
|
|
59
60
|
'craft:midi:message': import('./midi').MIDIMessageEvent
|
|
60
61
|
'craft:notification:actionClicked': import('./notifications').NotificationActionEvent
|
|
61
62
|
'craft:notification:reply': import('./notifications').NotificationReplyEvent
|
package/dist/context-menu.d.ts
CHANGED
|
@@ -16,9 +16,11 @@ export declare interface ContextMenuOptions {
|
|
|
16
16
|
}
|
|
17
17
|
export declare interface ContextMenuActionEvent {
|
|
18
18
|
id: string
|
|
19
|
+
targetId: string
|
|
19
20
|
}
|
|
20
21
|
export declare interface ContextMenuAPI {
|
|
21
22
|
show: (options: ContextMenuOptions) => Promise<boolean>
|
|
23
|
+
pick: (options: ContextMenuOptions) => Promise<string | null>
|
|
22
24
|
available: () => boolean
|
|
23
25
|
onAction: (cb: (event: ContextMenuActionEvent) => void) => () => void
|
|
24
26
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as J1,$a as J2,A as f0,Aa as v1,B as S0,Ba as w1,C as g0,Ca as f1,D as b0,Da as S1,E as y0,Ea as g1,F as u0,Fa as b1,G as h0,Ga as y1,H as m0,Ha as u1,I as c0,Ia as h1,J as d0,Ja as m1,K as p0,Ka as c1,L as r0,La as d1,M as n0,Ma as p1,N as o0,Na as r1,O as l0,Oa as n1,P as a0,Pa as o1,Q as i0,Qa as l1,R as s0,Ra as a1,S as t0,Sa as i1,T as e0,Ta as s1,U as Y1,Ua as t1,V as Z1,Va as e1,W as Q1,Wa as Y2,X as X1,Xa as Z2,Y as x,Ya as Q2,Z as OY,Za as X2,_ as $1,_a as $2,a as q0,aa as G1,ab as G2,b as K0,ba as R1,bb as R2,c as U0,ca as q1,cb as q2,d as _0,da as K1,db as K2,e as E0,ea as U1,eb as U2,f as F0,fa as _1,g as j0,ga as E1,h as B0,ha as F1,i as V0,ia as j1,j as O0,ja as B1,k as z0,ka as V1,l as M0,la as O1,m as L0,ma as z1,n as T0,na as M1,o as D0,oa as L1,p as W0,pa as T1,q as P0,qa as D1,r as A0,ra as W1,s as N0,sa as P1,t as k0,ta as A1,u as C0,ua as N1,v as I0,va as k1,w as x0,wa as C1,x as H0,xa as I1,y as v0,ya as x1,z as w0,za as H1}from"./chunk-qmw80h4r.js";import{fb as N}from"./chunk-dr2ba0an.js";function z(Y="stx"){return`${Y}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function F(Y){return Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(...Y){return Y.filter(Boolean).join(" ")}function V(Y){if(!Y)return"";return Object.entries(Y).map(([Z,Q])=>`${Z.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Q}`).join("; ")}function LY(Y){let{text:Z,variant:Q="primary",size:X="medium",disabled:$=!1,loading:J=!1,icon:K,iconPosition:R="left",id:G=z("btn"),className:_,style:U}=Y,E=O("stx-button",`stx-button--${Q}`,`stx-button--${X}`,$&&"stx-button--disabled",J&&"stx-button--loading",_),q=V(U),j=K?`<span class="stx-button-icon">${K}</span>`:"",B=J?'<span class="stx-button-spinner"></span>':"",M=R==="left"?`${j}${B}<span class="stx-button-text">${F(Z)}</span>`:`<span class="stx-button-text">${F(Z)}</span>${j}${B}`;return`<button id="${G}" class="${E}" ${$||J?"disabled":""} ${q?`style='${q}'`:""}>${M}</button>`}function TY(Y){let{value:Z="",placeholder:Q="",type:X="text",disabled:$=!1,readonly:J=!1,maxLength:K,minLength:R,pattern:G,required:_=!1,autocomplete:U,label:E,error:q,hint:j,id:B=z("input"),className:M,style:L}=Y,T=O("stx-input",q&&"stx-input--error",$&&"stx-input--disabled",M),f=V(L),MY=[`type="${X}"`,`id="${B}"`,`class="${T}"`,Z&&`value="${F(Z)}"`,Q&&`placeholder="${F(Q)}"`,$&&"disabled",J&&"readonly",_&&"required",K&&`maxlength="${K}"`,R&&`minlength="${R}"`,G&&`pattern="${F(G)}"`,U&&`autocomplete="${U}"`,f&&`style="${f}"`].filter(Boolean).join(" "),H="";if(E)H+=`<label class="stx-input-label" for="${B}">${F(E)}</label>`;if(H+=`<input ${MY} />`,q)H+=`<div class="stx-input-error">${F(q)}</div>`;else if(j)H+=`<div class="stx-input-hint">${F(j)}</div>`;return`<div class="stx-input-wrapper">${H}</div>`}function DY(Y){let{checked:Z=!1,label:Q,disabled:X=!1,indeterminate:$=!1,id:J=z("checkbox"),className:K,style:R}=Y,G=O("stx-checkbox",X&&"stx-checkbox--disabled",K),_=V(R),U=['type="checkbox"',`id="${J}"`,Z&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
3
3
|
<label class="${G}" ${_?`style="${_}"`:""}>
|
|
4
4
|
<input ${U} />
|
|
5
5
|
<span class="stx-checkbox-box"></span>
|
|
6
6
|
${Q?`<span class="stx-checkbox-label">${F(Q)}</span>`:""}
|
|
7
7
|
</label>
|
|
8
|
-
`}function
|
|
8
|
+
`}function WY(Y){let{value:Z=50,min:Q=0,max:X=100,step:$=1,disabled:J=!1,label:K,showValue:R=!0,id:G=z("slider"),className:_,style:U}=Y,E=O("stx-slider",J&&"stx-slider--disabled",_),q=V(U),j=['type="range"',`id="${G}"`,`value="${Z}"`,`min="${Q}"`,`max="${X}"`,`step="${$}"`,J&&"disabled"].filter(Boolean).join(" "),B="";if(K)B+=`<label class="stx-slider-label" for="${G}">${F(K)}</label>`;if(B+=`<div class="stx-slider-track"><input ${j} /></div>`,R)B+=`<span class="stx-slider-value">${Z}</span>`;return`<div class="${E}" ${q?`style='${q}'`:""}>${B}</div>`}function PY(Y){let{value:Z,max:Q=100,variant:X="default",size:$="medium",showLabel:J=!1,indeterminate:K=!1,id:R=z("progress"),className:G,style:_}=Y,U=Math.min(100,Math.max(0,Z/Q*100)),E=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",G),q=V(_);return`
|
|
9
9
|
<div id="${R}" class="${E}" role="progressbar" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${Q}" ${q?`style="${q}"`:""}>
|
|
10
10
|
<div class="stx-progress-bar" style="width: ${K?"100%":`${U}%`}"></div>
|
|
11
11
|
${J?`<span class="stx-progress-label">${Math.round(U)}%</span>`:""}
|
|
12
12
|
</div>
|
|
13
|
-
`}function
|
|
13
|
+
`}function AY(Y){let{text:Z,variant:Q="default",size:X="medium",id:$=z("badge"),className:J,style:K}=Y,R=O("stx-badge",`stx-badge--${Q}`,`stx-badge--${X}`,J),G=V(K);return`<span id="${$}" class="${R}" ${G?`style='${G}'`:""}>${F(Z)}</span>`}function NY(Y){let{src:Z,alt:Q="",name:X,size:$="medium",shape:J="circle",id:K=z("avatar"),className:R,style:G}=Y,_=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",E=O("stx-avatar",_,`stx-avatar--${J}`,R),q=[U,V(G)].filter(Boolean).join(" "),j=X?X.split(" ").map((B)=>B[0]).join("").toUpperCase().slice(0,2):"";if(Z)return`<div id="${K}" class="${E}" ${q?`style="${q}"`:""}>
|
|
14
14
|
<img src="${F(Z)}" alt="${F(Q)}" class="stx-avatar-img" />
|
|
15
15
|
</div>`;return`<div id="${K}" class="${E}" ${q?`style="${q}"`:""}>
|
|
16
16
|
<span class="stx-avatar-initials">${j}</span>
|
|
17
|
-
</div>`}function
|
|
17
|
+
</div>`}function kY(Y){let{title:Z,subtitle:Q,content:X,image:$,footer:J,variant:K="default",id:R=z("card"),className:G,style:_}=Y,U=O("stx-card",`stx-card--${K}`,G),E=V(_),q="";if($)q+=`<div class="stx-card-image"><img src="${F($)}" alt="" /></div>`;if(q+='<div class="stx-card-body">',Z)q+=`<h3 class="stx-card-title">${F(Z)}</h3>`;if(Q)q+=`<p class="stx-card-subtitle">${F(Q)}</p>`;if(X)q+=`<div class="stx-card-content">${F(X)}</div>`;if(q+="</div>",J)q+=`<div class="stx-card-footer">${F(J)}</div>`;return`<div id="${R}" class="${U}" ${E?`style='${E}'`:""}>${q}</div>`}function CY(Y){let{tabs:Z,activeTab:Q,variant:X="default",id:$=z("tabs"),className:J,style:K}=Y,R=O("stx-tabs",`stx-tabs--${X}`,J),G=V(K),_=Z.map((U,E)=>{let q=Q?U.value===Q:E===0;return`<button class="${O("stx-tab",q&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${F(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${q}">${F(U.label)}</button>`}).join("");return`<div id="${$}" class="${R}" role="tablist" ${G?`style='${G}'`:""}>${_}</div>`}function IY(Y){let{options:Z,value:Q,placeholder:X="Select...",disabled:$=!1,id:J=z("dropdown"),className:K,style:R}=Y,G=O("stx-dropdown",$&&"stx-dropdown--disabled",K),_=V(R),U=Z.map((q)=>{let j=q.value===Q?"selected":"",B=q.disabled?"disabled":"";return`<option value="${F(q.value)}" ${j} ${B}>${F(q.label)}</option>`}).join(""),E=Q?"":`<option value="" disabled selected>${F(X)}</option>`;return`<select id="${J}" class="${G}" ${$?"disabled":""} ${_?`style='${_}'`:""}>${E}${U}</select>`}function xY(Y){let{value:Z=0,max:Q=5,readonly:X=!1,size:$="medium",allowHalf:J=!1,id:K=z("rating"),className:R,style:G}=Y,_=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",R),U=V(G),E="";for(let q=1;q<=Q;q++){let j=q<=Z,B=J&&q-0.5===Z;E+=`<span class="stx-star ${j?"stx-star--filled":B?"stx-star--half":""}" data-value="${q}">\u2605</span>`}return`<div id="${K}" class="${_}" role="slider" aria-valuenow="${Z}" aria-valuemin="0" aria-valuemax="${Q}" ${U?`style='${U}'`:""}>${E}</div>`}function HY(Y){let{value:Z,name:Q,checked:X=!1,label:$,disabled:J=!1,id:K=z("radio"),className:R,style:G}=Y,_=O("stx-radio",J&&"stx-radio--disabled",R),U=V(G),E=['type="radio"',`id="${K}"`,`name="${F(Q)}"`,`value="${F(Z)}"`,X&&"checked",J&&"disabled"].filter(Boolean).join(" ");return`
|
|
18
18
|
<label class="${_}" ${U?`style="${U}"`:""}>
|
|
19
19
|
<input ${E} />
|
|
20
20
|
<span class="stx-radio-circle"></span>
|
|
21
21
|
${$?`<span class="stx-radio-label">${F($)}</span>`:""}
|
|
22
22
|
</label>
|
|
23
|
-
`}function
|
|
23
|
+
`}function vY(Y){let{value:Z="#3498db",disabled:Q=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:J=z("color"),className:K,style:R}=Y,G=O("stx-color-picker",Q&&"stx-color-picker--disabled",K),_=V(R),U="";if(X)U+=`<label class="stx-color-picker-label" for="${J}">${F(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
|
|
24
24
|
<input type="color" id="${J}" value="${F(Z)}" ${Q?"disabled":""} />
|
|
25
25
|
<span class="stx-color-picker-value">${F(Z)}</span>
|
|
26
|
-
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${F(E)}" data-color="${F(E)}" ${Q?"disabled":""}></button>`;U+="</div>"}return`<div class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
26
|
+
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let E of $)U+=`<button class="stx-color-preset" style="background: ${F(E)}" data-color="${F(E)}" ${Q?"disabled":""}></button>`;U+="</div>"}return`<div class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function wY(Y){let{value:Z,min:Q,max:X,disabled:$=!1,label:J,placeholder:K="Select date",showClear:R=!0,id:G=z("date"),className:_,style:U}=Y,E=O("stx-date-picker",$&&"stx-date-picker--disabled",_),q=V(U),j=Z instanceof Date?Z.toISOString().split("T")[0]:Z||"",B=Q instanceof Date?Q.toISOString().split("T")[0]:Q,M=X instanceof Date?X.toISOString().split("T")[0]:X,L=['type="date"',`id="${G}"`,j&&`value="${j}"`,B&&`min="${B}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${F(K)}"`].filter(Boolean).join(" "),T="";if(J)T+=`<label class="stx-date-picker-label" for="${G}">${F(J)}</label>`;return T+=`<div class="stx-date-picker-input">
|
|
27
27
|
<input ${L} />
|
|
28
28
|
${R&&j?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
29
|
-
</div>`,`<div class="${E}" ${q?`style='${q}'`:""}>${T}</div>`}function
|
|
29
|
+
</div>`,`<div class="${E}" ${q?`style='${q}'`:""}>${T}</div>`}function fY(Y){let{value:Z="",disabled:Q=!1,label:X,step:$=60,min:J,max:K,id:R=z("time"),className:G,style:_}=Y,U=O("stx-time-picker",Q&&"stx-time-picker--disabled",G),E=V(_),q=['type="time"',`id="${R}"`,Z&&`value="${F(Z)}"`,`step="${$}"`,J&&`min="${F(J)}"`,K&&`max="${F(K)}"`,Q&&"disabled"].filter(Boolean).join(" "),j="";if(X)j+=`<label class="stx-time-picker-label" for="${R}">${F(X)}</label>`;return j+=`<input ${q} class="stx-time-picker-input" />`,`<div class="${U}" ${E?`style='${E}'`:""}>${j}</div>`}function SY(Y){let{options:Z,value:Q="",placeholder:X="Search...",disabled:$=!1,label:J,loading:K=!1,id:R=z("autocomplete"),className:G,style:_}=Y,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",G),E=V(_),q=Z.find((M)=>M.value===Q),j=q?q.label:Q,B="";if(J)B+=`<label class="stx-autocomplete-label" for="${R}">${F(J)}</label>`;B+=`<div class="stx-autocomplete-input-wrapper">
|
|
30
30
|
<input type="text" id="${R}" value="${F(j)}" placeholder="${F(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
31
31
|
${K?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
32
|
-
</div>`,B+='<ul class="stx-autocomplete-list">';for(let M of Z)B+=`<li class="stx-autocomplete-item ${M.value===Q?"stx-autocomplete-item--selected":""}" data-value="${F(M.value)}">${F(M.label)}</li>`;return B+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${B}</div>`}function
|
|
32
|
+
</div>`,B+='<ul class="stx-autocomplete-list">';for(let M of Z)B+=`<li class="stx-autocomplete-item ${M.value===Q?"stx-autocomplete-item--selected":""}" data-value="${F(M.value)}">${F(M.label)}</li>`;return B+="</ul>",`<div class="${U}" ${E?`style='${E}'`:""}>${B}</div>`}function gY(Y){let{text:Z,htmlFor:Q,required:X=!1,size:$="medium",id:J=z("label"),className:K,style:R}=Y,G=O("stx-label",`stx-label--${$}`,K),_=V(R);return`<label id="${J}" class="${G}" ${Q?`for='${F(Q)}'`:""} ${_?`style='${_}'`:""}>${F(Z)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function bY(Y){let{src:Z,alt:Q="",width:X,height:$,objectFit:J="cover",fallback:K,loading:R="lazy",id:G=z("image"),className:_,style:U}=Y,E=O("stx-image",_),q={objectFit:J};if(X)q.width=typeof X==="number"?`${X}px`:X;if($)q.height=typeof $==="number"?`${$}px`:$;let j=[V(q),V(U)].filter(Boolean).join("; "),B=K?`onerror="this.src='${F(K)}'"`:"";return`<img id="${G}" class="${E}" src="${F(Z)}" alt="${F(Q)}" loading="${R}" ${j?`style='${j}'`:""} ${B} />`}function yY(Y){let{text:Z,variant:Q="default",size:X="medium",removable:$=!1,icon:J,id:K=z("chip"),className:R,style:G}=Y,_=O("stx-chip",`stx-chip--${Q}`,`stx-chip--${X}`,R),U=V(G),E="";if(J)E+=`<span class="stx-chip-icon">${J}</span>`;if(E+=`<span class="stx-chip-text">${F(Z)}</span>`,$)E+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${K}" class="${_}" ${U?`style='${U}'`:""}>${E}</span>`}function uY(Y){let{text:Z,position:Q="top",delay:X=200,children:$,id:J=z("tooltip"),className:K,style:R}=Y,G=O("stx-tooltip-wrapper",K),_=V(R);return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""} data-tooltip="${F(Z)}" data-position="${Q}" data-delay="${X}">
|
|
33
33
|
${$}
|
|
34
34
|
<span class="stx-tooltip stx-tooltip--${Q}">${F(Z)}</span>
|
|
35
|
-
</div>`}function
|
|
35
|
+
</div>`}function hY(Y){let{direction:Z="vertical",showScrollbar:Q=!0,smooth:X=!0,height:$,width:J,children:K,id:R=z("scroll"),className:G,style:_}=Y,U=O("stx-scroll-view",`stx-scroll-view--${Z}`,!Q&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",G),E={};if($)E.height=typeof $==="number"?`${$}px`:$;if(J)E.width=typeof J==="number"?`${J}px`:J;let q=[V(E),V(_)].filter(Boolean).join("; ");return`<div id="${R}" class="${U}" ${q?`style='${q}'`:""}>${K}</div>`}function mY(Y){let{direction:Z="horizontal",sizes:Q=[50,50],resizable:X=!0,children:$,id:J=z("split"),className:K,style:R}=Y,G=O("stx-split-view",`stx-split-view--${Z}`,X&&"stx-split-view--resizable",K),_=V(R),U=Z==="horizontal"?"width":"height";return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
|
|
36
36
|
<div class="stx-split-pane" style="${U}: ${Q[0]}%">${$[0]}</div>
|
|
37
37
|
${X?'<div class="stx-split-divider"></div>':""}
|
|
38
38
|
<div class="stx-split-pane" style="${U}: ${Q[1]}%">${$[1]}</div>
|
|
39
|
-
</div>`}function
|
|
39
|
+
</div>`}function cY(Y){let{items:Z,multiple:Q=!1,defaultOpen:X=[],id:$=z("accordion"),className:J,style:K}=Y,R=O("stx-accordion",J),G=V(K),_="";return Z.forEach((U,E)=>{let q=X.includes(E),j=O("stx-accordion-item",q&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");_+=`<div class="${j}" data-index="${E}">
|
|
40
40
|
<button class="stx-accordion-header" ${U.disabled?"disabled":""} aria-expanded="${q}" data-multiple="${Q}">
|
|
41
41
|
<span class="stx-accordion-title">${F(U.title)}</span>
|
|
42
42
|
<span class="stx-accordion-icon">\u25BC</span>
|
|
@@ -44,7 +44,7 @@ import{$ as $1,$a as $2,A as w0,Aa as H1,B as f0,Ba as v1,C as S0,Ca as w1,D as
|
|
|
44
44
|
<div class="stx-accordion-content" ${q?"":"hidden"}>
|
|
45
45
|
${F(U.content)}
|
|
46
46
|
</div>
|
|
47
|
-
</div>`}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function
|
|
47
|
+
</div>`}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function dY(Y){let{steps:Z,currentStep:Q,orientation:X="horizontal",id:$=z("stepper"),className:J,style:K}=Y,R=O("stx-stepper",`stx-stepper--${X}`,J),G=V(K),_="";return Z.forEach((U,E)=>{let q=O("stx-step",E<Q&&"stx-step--completed",E===Q&&"stx-step--active");if(_+=`<div class="${q}" data-step="${E}">
|
|
48
48
|
<div class="stx-step-indicator">
|
|
49
49
|
${E<Q?"\u2713":E+1}
|
|
50
50
|
</div>
|
|
@@ -52,9 +52,9 @@ import{$ as $1,$a as $2,A as w0,Aa as H1,B as f0,Ba as v1,C as S0,Ca as w1,D as
|
|
|
52
52
|
<div class="stx-step-label">${F(U.label)}</div>
|
|
53
53
|
${U.description?`<div class="stx-step-description">${F(U.description)}</div>`:""}
|
|
54
54
|
</div>
|
|
55
|
-
</div>`,E<Z.length-1)_+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function
|
|
55
|
+
</div>`,E<Z.length-1)_+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${R}" ${G?`style='${G}'`:""}>${_}</div>`}function pY(Y){let{open:Z=!1,title:Q,size:X="medium",closable:$=!0,children:J,footer:K,id:R=z("modal"),className:G,style:_}=Y,U=O("stx-modal-component",`stx-modal-component--${X}`,G),E=V(_);if(!Z)return`<div id="${R}" class="${U} stx-modal-component--hidden" ${E?`style='${E}'`:""}></div>`;let q='<div class="stx-modal-component-overlay">';if(q+='<div class="stx-modal-component-dialog">',Q||$){if(q+='<div class="stx-modal-component-header">',Q)q+=`<h3 class="stx-modal-component-title">${F(Q)}</h3>`;if($)q+='<button class="stx-modal-component-close">×</button>';q+="</div>"}if(q+=`<div class="stx-modal-component-body">${J}</div>`,K)q+=`<div class="stx-modal-component-footer">${K}</div>`;return q+="</div></div>",`<div id="${R}" class="${U}" ${E?`style='${E}'`:""}>${q}</div>`}function rY(Y){let{items:Z,selectable:Q=!1,multiSelect:X=!1,emptyMessage:$="No items",id:J=z("list"),className:K,style:R}=Y,G=O("stx-list-view",Q&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),_=V(R);if(Z.length===0)return`<div id="${J}" class="${G}" ${_?`style="${_}"`:""}>
|
|
56
56
|
<div class="stx-list-view-empty">${F($)}</div>
|
|
57
|
-
</div>`;let U='<ul class="stx-list-view-items">';for(let E of Z){let q=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${q}" data-id="${F(E.id)}" ${Q?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
57
|
+
</div>`;let U='<ul class="stx-list-view-items">';for(let E of Z){let q=O("stx-list-view-item",E.selected&&"stx-list-view-item--selected");U+=`<li class="${q}" data-id="${F(E.id)}" ${Q?'tabindex="0"':""}>${E.content}</li>`}return U+="</ul>",`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function nY(Y){let{columns:Z,data:Q,striped:X=!1,bordered:$=!1,hoverable:J=!0,sortBy:K,sortOrder:R,id:G=z("table"),className:_,style:U}=Y,E=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",J&&"stx-table--hoverable",_),q=V(U),j="<table>";j+="<thead><tr>";for(let B of Z){let L=B.key===K?`stx-table-sorted stx-table-sorted--${R}`:"",T=B.sortable?'data-sortable="true"':"",f=B.width?`style="width: ${B.width}"`:"";j+=`<th class="${L}" ${T} ${f} data-key="${F(B.key)}">${F(B.label)}${B.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}j+="</tr></thead>",j+="<tbody>";for(let B of Q){j+="<tr>";for(let M of Z){let L=B[M.key];j+=`<td>${L!=null?F(String(L)):""}</td>`}j+="</tr>"}return j+="</tbody></table>",`<div id="${G}" class="${E}" ${q?`style='${q}'`:""}>${j}</div>`}function o(Y,Z,Q,X){let $=Z.includes(Y.key),J=Q.includes(Y.key),K=Y.children&&Y.children.length>0,G=`<div class="${O("stx-tree-node",J&&"stx-tree-node--selected",Y.disabled&&"stx-tree-node--disabled")}" data-key="${F(Y.key)}">`;if(G+='<div class="stx-tree-node-content">',K)G+=`<span class="stx-tree-toggle ${$?"stx-tree-toggle--expanded":""}">\u25B6</span>`;else G+='<span class="stx-tree-toggle-placeholder"></span>';if(X)G+=`<input type="checkbox" class="stx-tree-checkbox" ${J?"checked":""} ${Y.disabled?"disabled":""} />`;if(Y.icon)G+=`<span class="stx-tree-icon">${Y.icon}</span>`;if(G+=`<span class="stx-tree-label">${F(Y.label)}</span>`,G+="</div>",K&&$){G+='<div class="stx-tree-children">';for(let _ of Y.children)G+=o(_,Z,Q,X);G+="</div>"}return G+="</div>",G}function oY(Y){let{nodes:Z,expandedKeys:Q=[],selectedKeys:X=[],checkable:$=!1,id:J=z("tree"),className:K,style:R}=Y,G=O("stx-tree-view",$&&"stx-tree-view--checkable",K),_=V(R),U="";for(let E of Z)U+=o(E,Q,X,$);return`<div id="${J}" class="${G}" role="tree" ${_?`style='${_}'`:""}>${U}</div>`}function lY(Y){let{columns:Z,data:Q,pagination:X,selectable:$=!1,id:J=z("datagrid"),className:K,style:R}=Y,G=O("stx-data-grid",$&&"stx-data-grid--selectable",K),_=V(R),U='<div class="stx-data-grid-table-wrapper">';if(U+='<table class="stx-data-grid-table">',U+="<thead><tr>",$)U+='<th class="stx-data-grid-select-all"><input type="checkbox" /></th>';for(let E of Z){let q=E.width?`style="width: ${E.width}"`:"";U+=`<th ${q}>
|
|
58
58
|
<div class="stx-data-grid-header-cell">
|
|
59
59
|
<span>${F(E.label)}</span>
|
|
60
60
|
${E.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
@@ -66,21 +66,21 @@ import{$ as $1,$a as $2,A as w0,Aa as H1,B as f0,Ba as v1,C as S0,Ca as w1,D as
|
|
|
66
66
|
<button class="stx-data-grid-page-btn" ${X.page<=1?"disabled":""}>\u25C0</button>
|
|
67
67
|
<button class="stx-data-grid-page-btn" ${X.page>=E?"disabled":""}>\u25B6</button>
|
|
68
68
|
</div>
|
|
69
|
-
</div>`}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function
|
|
69
|
+
</div>`}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${U}</div>`}function aY(Y){let{type:Z,data:Q,options:X={},width:$="100%",height:J=300,id:K=z("chart"),className:R,style:G}=Y,_=O("stx-chart",`stx-chart--${Z}`,R),U={width:typeof $==="number"?`${$}px`:$,height:typeof J==="number"?`${J}px`:J},E=[V(U),V(G)].filter(Boolean).join("; "),q=JSON.stringify({type:Z,data:Q,options:X});return`<div id="${K}" class="${_}" style="${E}" data-chart='${F(q)}'>
|
|
70
70
|
<div class="stx-chart-placeholder">
|
|
71
71
|
${X.title?`<div class="stx-chart-title">${F(X.title)}</div>`:""}
|
|
72
72
|
<div class="stx-chart-type">${Z.charAt(0).toUpperCase()+Z.slice(1)} Chart</div>
|
|
73
73
|
<div class="stx-chart-info">${Q.datasets.length} dataset(s), ${Q.labels.length} labels</div>
|
|
74
74
|
</div>
|
|
75
|
-
</div>`}function
|
|
76
|
-
`),L="";if($){L+='<div class="stx-code-editor-gutter">';for(let T=1;T<=M.length;T++)L+=`<div class="stx-code-editor-line-number">${T}</div>`;L+="</div>"}return L+=`<pre class="stx-code-editor-content"><code class="language-${F(Q)}">${F(Z)}</code></pre>`,`<div id="${_}" class="${q}" style="${B}" data-language="${F(Q)}" data-tab-size="${R}">${L}</div>`}function
|
|
75
|
+
</div>`}function iY(Y){let{value:Z="",language:Q="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:J=!1,height:K=300,tabSize:R=2,wordWrap:G=!1,id:_=z("code"),className:U,style:E}=Y,q=O("stx-code-editor",`stx-code-editor--${X}`,$&&"stx-code-editor--line-numbers",J&&"stx-code-editor--readonly",G&&"stx-code-editor--wrap",U),j={height:typeof K==="number"?`${K}px`:K},B=[V(j),V(E)].filter(Boolean).join("; "),M=Z.split(`
|
|
76
|
+
`),L="";if($){L+='<div class="stx-code-editor-gutter">';for(let T=1;T<=M.length;T++)L+=`<div class="stx-code-editor-line-number">${T}</div>`;L+="</div>"}return L+=`<pre class="stx-code-editor-content"><code class="language-${F(Q)}">${F(Z)}</code></pre>`,`<div id="${_}" class="${q}" style="${B}" data-language="${F(Q)}" data-tab-size="${R}">${L}</div>`}function sY(Y){let{src:Z,type:Q="video",poster:X,autoplay:$=!1,loop:J=!1,muted:K=!1,controls:R=!0,width:G,height:_,id:U=z("media"),className:E,style:q}=Y,j=O("stx-media-player",`stx-media-player--${Q}`,E),B={};if(G)B.width=typeof G==="number"?`${G}px`:G;if(_)B.height=typeof _==="number"?`${_}px`:_;let M=[V(B),V(q)].filter(Boolean).join("; "),L=[`id="${U}-media"`,`src="${F(Z)}"`,R&&"controls",$&&"autoplay",J&&"loop",K&&"muted",Q==="video"&&X&&`poster="${F(X)}"`].filter(Boolean).join(" "),T=Q==="video"?`<video ${L}>Your browser does not support the video tag.</video>`:`<audio ${L}>Your browser does not support the audio tag.</audio>`;return`<div id="${U}" class="${j}" ${M?`style='${M}'`:""}>${T}</div>`}function tY(Y){if(Y===void 0)return"";let Z=["B","KB","MB","GB"],Q=Y,X=0;while(Q>=1024&&X<Z.length-1)Q/=1024,X++;return`${Q.toFixed(1)} ${Z[X]}`}function eY(Y){let{files:Z,viewMode:Q="list",showHidden:X=!1,selectable:$=!0,id:J=z("files"),className:K,style:R}=Y,G=O("stx-file-explorer",`stx-file-explorer--${Q}`,K),_=V(R),U=X?Z:Z.filter((q)=>!q.name.startsWith(".")),E="";if(Q==="list"){E='<table class="stx-file-explorer-list"><thead><tr><th>Name</th><th>Size</th><th>Modified</th></tr></thead><tbody>';for(let q of U){let j=q.icon||(q.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),B=q.type==="file"?tY(q.size):"",M=q.modified?q.modified.toLocaleDateString():"";E+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(q.path)}" data-type="${q.type}">
|
|
77
77
|
<td><span class="stx-file-explorer-icon">${j}</span>${F(q.name)}</td>
|
|
78
78
|
<td>${B}</td>
|
|
79
79
|
<td>${M}</td>
|
|
80
80
|
</tr>`}E+="</tbody></table>"}else{E='<div class="stx-file-explorer-grid">';for(let q of U){let j=q.icon||(q.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");E+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(q.path)}" data-type="${q.type}">
|
|
81
81
|
<div class="stx-file-explorer-icon">${j}</div>
|
|
82
82
|
<div class="stx-file-explorer-name">${F(q.name)}</div>
|
|
83
|
-
</div>`}E+="</div>"}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${E}</div>`}function
|
|
83
|
+
</div>`}E+="</div>"}return`<div id="${J}" class="${G}" ${_?`style='${_}'`:""}>${E}</div>`}function YZ(Y){let{url:Z,width:Q="100%",height:X=400,sandbox:$=!0,allowScripts:J=!0,id:K=z("webview"),className:R,style:G}=Y,_=O("stx-webview",R),U={width:typeof Q==="number"?`${Q}px`:Q,height:typeof X==="number"?`${X}px`:X},E=[V(U),V(G)].filter(Boolean).join("; "),q=[];if($){if(q.push("allow-same-origin"),J)q.push("allow-scripts")}let j=$?`sandbox="${q.join(" ")}"`:"";return`<iframe id="${K}" class="${_}" src="${F(Z)}" style="${E}" ${j} loading="lazy" frameborder="0"></iframe>`}var ZZ=["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"],QZ=`
|
|
84
84
|
/* Button */
|
|
85
85
|
.stx-button {
|
|
86
86
|
display: inline-flex;
|
|
@@ -437,7 +437,7 @@ import{$ as $1,$a as $2,A as w0,Aa as H1,B as f0,Ba as v1,C as S0,Ca as w1,D as
|
|
|
437
437
|
.stx-chip--warning { background: #3a2a1a; }
|
|
438
438
|
.stx-chip--error { background: #3a1a1a; }
|
|
439
439
|
}
|
|
440
|
-
`;import l from"process";function
|
|
440
|
+
`;import l from"process";function XZ(){if(l.platform)return l.platform;return"unknown"}function i(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function s(Y,Z){if(Y.type==="separator")return{id:`sep-${Z}`,label:"",type:"separator"};let Q={id:`item-${Z}-${Y.label.replace(/\s+/g,"-").toLowerCase()}`,label:Y.label,type:Y.type||"normal",enabled:Y.enabled!==!1};if(Y.accelerator)Q.shortcut=Y.accelerator;if(Y.type==="checkbox")Q.checked=Y.checked||!1;if(Y.type==="submenu"&&Y.submenu)Q.submenu=Y.submenu.map((X,$)=>s(X,$));return Q}function u(Y){return Y.map((Z,Q)=>s(Z,Q))}function t(Y,Z=0){if(Y.type==="separator")return'<hr class="stx-tray-separator" />';let Q=" ".repeat(Z),X=Y.enabled===!1?"disabled":"",$=Y.checked?"\u2713 ":"",J=Y.accelerator?`<span class="accelerator">${Y.accelerator}</span>`:"",K=`${Q}<div class="stx-tray-item ${X}" data-action="${Y.label}">`;if(K+=`<span class="label">${$}${Y.label}</span>${J}`,Y.type==="submenu"&&Y.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let R of Y.submenu)K+=t(R,Z+1);K+="</div>"}return K+="</div>",K}function $Z(Y){let Z='<div class="stx-tray-menu">';for(let Q of Y)Z+=t(Q);return Z+="</div>",Z}var A=new Map;function JZ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var a=!1;function GZ(){if(a||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Y)=>{let{action:Z}=Y.detail;for(let Q of A.values()){let X=Q.handlers.get(Z);if(X){X();break}}}),a=!0}async function e(Y={}){let Z=JZ(),Q=XZ(),X=i(),$={icon:Y.icon||"",tooltip:Y.tooltip||"stx Application",menu:Y.menu||[],visible:!0},J=new Map;for(let R of Y.menu||[]){if(R.type!=="separator"&&R.onClick)J.set(R.label,R.onClick);if(R.type==="submenu"&&R.submenu){for(let G of R.submenu)if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick)}}if(A.set(Z,{state:$,handlers:J}),X){GZ();let R=window;try{if($.tooltip)await R.craft.tray.setTitle({title:$.tooltip}),await R.craft.tray.setTooltip({tooltip:$.tooltip});if($.icon)await R.craft.tray.setIcon({icon:$.icon});let G=u($.menu);await R.craft.tray.setMenu({items:G}),console.log(`[stx-tray] Native tray created for ${Q}`)}catch(G){console.warn("[stx-tray] Failed to create native tray:",G)}}else console.log("[stx-tray] Created simulated tray (not in Craft window)"),console.log(`[stx-tray] ID: ${Z}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Z,setIcon:(R)=>{if($.icon=R,X)window.craft.tray.setIcon({icon:R}).catch((_)=>{console.warn("[stx-tray] Failed to set icon:",_)});console.log(`[stx-tray:${Z}] Icon updated`)},setTooltip:(R)=>{if($.tooltip=R,X)window.craft.tray.setTooltip({tooltip:R}).catch((_)=>{console.warn("[stx-tray] Failed to set tooltip:",_)});console.log(`[stx-tray:${Z}] Tooltip: ${R}`)},setMenu:(R)=>{$.menu=R,J.clear();for(let G of R){if(G.type!=="separator"&&G.onClick)J.set(G.label,G.onClick);if(G.type==="submenu"&&G.submenu){for(let _ of G.submenu)if(_.type!=="separator"&&_.onClick)J.set(_.label,_.onClick)}}if(X){let G=window,_=u(R);G.craft.tray.setMenu({items:_}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Z}] Menu updated (${R.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Z),X)window.craft.tray.destroy?.().catch((G)=>{console.warn("[stx-tray] Failed to destroy tray:",G)});console.log(`[stx-tray:${Z}] Destroyed`)}}}var RZ=e;function qZ(){return Array.from(A.keys())}function KZ(Y){let Z=A.get(Y);if(!Z)return null;let Q=i();return{id:Y,setIcon:(X)=>{if(Z.state.icon=X,Q)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Z.state.tooltip=X,Q)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Z.state.menu=X,Q){let $=window,J=u(X);$.craft.tray.setMenu({items:J}).catch(()=>{})}},destroy:()=>{if(A.delete(Y),Q)window.craft.tray.destroy?.().catch(()=>{})}}}function UZ(Y,Z){let Q=A.get(Y);if(!Q)return!1;let X=Q.handlers.get(Z);if(X)return X(),!0;return!1}function _Z(Y){let Z=A.get(Y);if(!Z)return null;return $Z(Z.state.menu)}function EZ(){return`
|
|
441
441
|
// STX Desktop Tray Bridge
|
|
442
442
|
// Provides convenient wrappers around window.craft.tray APIs
|
|
443
443
|
window.stxTray = {
|
|
@@ -450,7 +450,7 @@ window.stxTray = {
|
|
|
450
450
|
// Check if tray is available
|
|
451
451
|
isAvailable: () => typeof window.craft?.tray !== 'undefined',
|
|
452
452
|
};
|
|
453
|
-
`}var
|
|
453
|
+
`}var FZ=`
|
|
454
454
|
.stx-tray-menu {
|
|
455
455
|
background: #2d2d2d;
|
|
456
456
|
border-radius: 8px;
|
|
@@ -516,7 +516,7 @@ window.stxTray = {
|
|
|
516
516
|
.stx-tray-item:hover > .stx-tray-submenu {
|
|
517
517
|
display: block;
|
|
518
518
|
}
|
|
519
|
-
`;import P from"process";import{existsSync as
|
|
519
|
+
`;import P from"process";import{existsSync as jZ}from"fs";import{dirname as BZ,join as VZ}from"path";import{craftBinaryNotFoundMessage as YY,resolveCraftBinary as OZ}from"craft-native";var k={};function zZ(Y){k={...k,...Y}}function MZ(){return{...k}}function LZ(){k={}}function h(Y){if(!Y.sidebarConfig)return;let Z={...Y.sidebarConfig};if(Z.variant==="desktop")Z.material=Z.material??"sidebar",Z.backgroundEffect=Z.backgroundEffect??"shimmer",Z.allowsVibrancy=Z.allowsVibrancy??!0;return Z}function S(){let Y=BZ(P.execPath),Z=Y.includes(".app/Contents/MacOS")?VZ(Y,"craft"):void 0,Q=[P.env.CRAFT_BINARY_PATH,k.craftBinaryPath,...k.additionalSearchPaths||[],Z];for(let X of Q)if(X&&jZ(X))return X;return OZ()}var D=new Map;function m(Y){let Z=D.get(Y);if(!Z||Z.closed)return;Z.closed=!0;for(let Q of Z.closeListeners??[])try{Q()}catch(X){console.warn(`[stx/desktop] window ${Y} close listener threw:`,X)}Z.closeListeners?.clear()}var TZ=50;async function c(Y,Z){let Q=Z.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Q,new Promise(($)=>setTimeout(()=>$(null),TZ))]);if(X?.failed)throw X.error;Q.then(()=>m(Y))}function DZ(){return Array.from(D.keys())}function WZ(Y){let Z=D.get(Y);if(!Z)return null;return g(Y,Z.app)}function PZ(){for(let[Y,Z]of D)try{Z.app?.close?.()}catch(Q){console.warn(`Failed to close window ${Y}:`,Q)}D.clear()}function g(Y,Z){return{id:Y,show:()=>{console.log(`[stx/desktop] Window ${Y} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let Q=D.get(Y);if(Q?.app)Q.app.close(),m(Y),D.delete(Y),console.log(`[stx/desktop] Window ${Y} closed`)},onClosed:(Q)=>{let X=D.get(Y);if(!X||X.closed)return queueMicrotask(Q),()=>{};return X.closeListeners??=new Set,X.closeListeners.add(Q),()=>X.closeListeners?.delete(Q)},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:(Q)=>{console.log(`[stx/desktop] To set title, use window.craft.window.setTitle({ title: "${Q}" }) from inside the webview`)},loadURL:(Q)=>{console.log(`[stx/desktop] To navigate, use window.location.href = "${Q}" from inside the webview`)},reload:()=>{console.log("[stx/desktop] To reload, use window.craft.window.reload() from inside the webview")}}}function d(Y,Z={}){let Q=["--url",Y,"--title",Z.title||"stx Desktop","--width",String(Z.width??1200),"--height",String(Z.height??800)];if(Z.darkMode)Q.push("--dark");if(Z.hotReload)Q.push("--hot-reload");if(Z.resizable===!1)Q.push("--no-resize");if(Z.frameless)Q.push("--frameless");if(Z.alwaysOnTop)Q.push("--always-on-top");if(Z.titlebarHidden)Q.push("--titlebar-hidden");if(Z.systemTray)Q.push("--system-tray");if(Z.hideDockIcon)Q.push("--hide-dock-icon");if(Z.devTools===!1)Q.push("--no-devtools");if(Z.nativeSidebar)Q.push("--native-sidebar");if(Z.sidebarWidth!==void 0)Q.push("--sidebar-width",String(Z.sidebarWidth));let X=h(Z);if(X)Q.push("--sidebar-config",JSON.stringify(X));return Q}async function AZ(Y,Z={}){let Q=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=S();try{let{createApp:$}=await import("craft-native"),J=$({url:Y,craftPath:X,window:{title:Z.title||"stx Desktop",width:Z.width??1200,height:Z.height??800,darkMode:Z.darkMode??!1,hotReload:Z.hotReload??!1,resizable:Z.resizable??!0,frameless:Z.frameless??!1,alwaysOnTop:Z.alwaysOnTop??!1,titlebarHidden:Z.titlebarHidden??!1,systemTray:Z.systemTray??!1,hideDockIcon:Z.hideDockIcon??!1,devTools:Z.devTools??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth,sidebarConfig:h(Z)}});return D.set(Q,{app:J,url:Y,options:Z}),await c(Q,J),g(Q,J)}catch{try{let{spawn:$}=await import("child_process"),J=$(X,d(Y,Z),{stdio:"inherit"});J.on("error",(R)=>{console.error(R.code==="ENOENT"?YY(X):`craft child error: ${R.message}`)});let K={close:()=>J.kill()};return D.set(Q,{app:K,url:Y,options:Z}),J.on("exit",()=>m(Q)),g(Q,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function NZ(Y,Z={}){let Q=`http://localhost:${Y}/`;if(P.env.NODE_ENV==="test"||P.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:$}=await import("craft-native");console.log("\u26A1 Opening native window via craft-native\u2026");let J=!Z.nativeSidebar,K=h(Z),R=$({url:Q,craftPath:S(),window:{title:Z.title||"stx Development",width:Z.width||1400,height:Z.height||900,resizable:!0,systemTray:J,darkMode:Z.darkMode??!0,hotReload:Z.hotReload??!0,devTools:!0,titlebarHidden:Z.titlebarHidden??!1,nativeSidebar:Z.nativeSidebar??!1,sidebarWidth:Z.sidebarWidth??260,sidebarConfig:K}}),G=`dev-window-${Y}`;return D.set(G,{app:R,url:Q,options:Z}),await c(G,R),console.log(`\u2713 Native window opened at ${Q}`),!0}catch{let $=S();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:J}=await import("child_process"),K=J($,d(Q,{title:"stx Development",width:1400,height:900,hotReload:!0,...Z}),{stdio:"inherit"});K.on("exit",()=>P.exit(0)),K.on("error",(G)=>{console.warn(G.code==="ENOENT"?YY($):`craft child error: ${G.message}`)});let R=`dev-window-${Y}`;return D.set(R,{app:{close:()=>K.kill()},url:Q,options:Z}),console.log(`\u2713 Native window opened at ${Q}`),!0}catch(J){console.warn("\u26A0 Could not spawn craft binary:",J.message)}if(P.env.NODE_ENV==="test"||P.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:J}=await import("child_process"),K=P.platform;return J(K==="darwin"?"open":K==="win32"?"cmd":"xdg-open",K==="win32"?["/c","start",Q]:[Q],{detached:!0,stdio:"ignore"}).unref(),console.log(`\u2713 Browser opened at ${Q}`),!0}catch(J){return console.error("Could not open browser:",J),console.log(`Please open manually: ${Q}`),!1}}}async function kZ(Y,Z={}){let{title:Q="stx Desktop",width:X=1200,height:$=800,darkMode:J=!1,hotReload:K=!1,resizable:R=!0,frameless:G=!1,alwaysOnTop:_=!1}=Z;try{let{createApp:U}=await import("craft-native"),E=S(),q=U({html:Y,craftPath:E,window:{title:Q,width:X,height:$,darkMode:J,hotReload:K,resizable:R,frameless:G,alwaysOnTop:_}}),j=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(j,{app:q,url:"html-content",options:Z}),await c(j,q),g(j,q)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function CZ(){try{return N.resolve("craft-native"),!0}catch{return!1}}function IZ(){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
|
|
560
|
+
`}import{pack as xZ,packageApp as HZ}from"craft-native";import{craftBinaryNotFoundMessage as vZ,resolveCraftBinary as wZ}from"craft-native";import v from"process";import{spawn as fZ}from"child_process";import{AutoUpdater as ZY,canReplaceBundle as SZ,clearQuarantine as gZ,extractBundle as bZ,generateUpdateManifest as QY,readBundleIdentity as p,swapBundle as yZ,verifyBundleTrust as uZ}from"craft-native";var XY="update.json";function $Y(Y,Z){return`https://github.com/${Y}/releases/latest/download/${Z}`}function JY(Y,Z,Q){return`https://github.com/${Y}/releases/download/${Z}/${Q}`}function GY(Y){let{repository:Z,manifestAsset:Q=XY,...X}=Y;return new ZY({...X,updateUrl:$Y(Z,Q)})}function hZ(Y){let Z=Y.tag??`v${Y.version}`,Q={};for(let[X,$]of Object.entries(Y.artifacts)){if(!$)continue;Q[X]={path:$,url:JY(Y.repository,Z,$.split("/").pop())}}return QY({version:Y.version,releaseNotes:Y.releaseNotes,platforms:Q})}function b(Y=v.execPath){let Z=Y.split("/");for(let Q=0;Q<Z.length;Q++)if(Z[Q].endsWith(".app"))return Z.slice(0,Q+1).join("/");return null}async function mZ(){let Y=b();if(!Y)return null;return(await p(Y)).teamId}function RY(){let Y=v.ppid;if(Y>1)try{v.kill(Y,"SIGTERM");return}catch{}v.exit(0)}function qY(Y={}){let Z=Y.appPath??b(),Q=Y.quit??(()=>v.exit(0));if(Z)fZ("/usr/bin/open",["-n",Z],{detached:!0,stdio:"ignore"}).unref();let X=Y.quitDelayMs??0;if(X>0){setTimeout(Q,X).unref?.();return}Q()}async function cZ(Y){let{appPath:Z,requireSameTeam:Q=!0,macos:X,...$}=Y,J=Z??b();if(!J)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 K=X?.teamId??(Q?(await p(J)).teamId??void 0:void 0);return GY({...$,appPath:J,macos:{...X,teamId:K},relaunch:Y.relaunch??((R)=>qY({appPath:R,quit:RY,quitDelayMs:250}))})}import{existsSync as r,mkdirSync as dZ,readFileSync as pZ,watch as rZ,writeFileSync as nZ}from"fs";import{homedir as oZ,platform as lZ}from"os";import{dirname as aZ,join as w}from"path";function iZ(Y){let Z=lZ(),Q=oZ();switch(Z){case"darwin":return w(Q,"Library","Application Support",Y);case"win32":return w(process.env.APPDATA||w(Q,"AppData","Roaming"),Y);default:return w(Q,".config",Y)}}class KY{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Y){this._defaults={...Y.defaults};let Z=Y.path?aZ(Y.path):iZ(Y.name);if(this._path=Y.path||w(Z,"preferences.json"),!r(Z))dZ(Z,{recursive:!0});if(this._data=this._load(),Y.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Y){if(Y in this._data)return this._data[Y];return this._defaults[Y]}set(Y,Z){let Q=this.get(Y);if(JSON.stringify(Q)===JSON.stringify(Z))return;this._data[Y]=Z,this._scheduleSave(),this._notifyChange(Y,Z,Q)}getAll(){return{...this._defaults,...this._data}}has(Y){return Y in this._data}delete(Y){if(!(Y in this._data))return;let Z=this._data[Y];delete this._data[Y],this._scheduleSave(),this._notifyChange(Y,this._defaults[Y],Z)}reset(){let Y={...this._data};this._data={},this._save();for(let Z of Object.keys(Y)){let Q=this._defaults[Z];this._notifyChange(Z,Q,Y[Z])}}onChange(Y,Z){let Q=Y;if(!this._changeHandlers.has(Q))this._changeHandlers.set(Q,new Set);return this._changeHandlers.get(Q).add(Z),()=>{this._changeHandlers.get(Q)?.delete(Z)}}onAnyChange(Y){return this._anyChangeHandlers.add(Y),()=>{this._anyChangeHandlers.delete(Y)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(r(this._path)){let Y=pZ(this._path,"utf-8");return JSON.parse(Y)}}catch{}return{}}_save(){this._writing=!0;try{let Y=JSON.stringify({...this._defaults,...this._data},null,2);nZ(this._path,Y,"utf-8")}catch(Y){console.error(`Failed to save preferences to ${this._path}:`,Y)}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(!r(this._path))this._save();this._watcher=rZ(this._path,()=>{if(this._writing)return;let Y=this._load(),Z={...this._data};this._data=Y;let Q=new Set([...Object.keys(Z),...Object.keys(Y)]);for(let X of Q){let $=X in Z?Z[X]:this._defaults[X],J=X in Y?Y[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(J))this._notifyChange(X,J,$)}})}catch{}}_notifyChange(Y,Z,Q){let X=this._changeHandlers.get(Y);if(X)for(let $ of X)try{$(Z,Q)}catch{}for(let $ of this._anyChangeHandlers)try{$(Y,Z,Q)}catch{}}}function sZ(Y){return new KY(Y)}import{existsSync as C,mkdirSync as UY,readFileSync as tZ,unlinkSync as _Y,writeFileSync as EY}from"fs";import{homedir as y,platform as FY}from"os";import{join as I}from"path";function jY(Y){let Z=Y.toLowerCase().replace(/[^a-z0-9]/g,"-");return I(y(),"Library","LaunchAgents",`com.${Z}.plist`)}function BY(Y){let Z=process.env.XDG_CONFIG_HOME||I(y(),".config");return I(Z,"autostart",`${Y.toLowerCase()}.desktop`)}async function eZ(Y,Z){let Q=Z.appName||"StxApp",X=jY(Q),$=I(y(),"Library","LaunchAgents");if(Y){let J=Z.appPath||process.execPath,K=Z.args||[],R=[J,...K],G=`<?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>
|
|
@@ -565,7 +565,7 @@ window.desktop = window.stxWindow;
|
|
|
565
565
|
<string>com.${Q.toLowerCase().replace(/[^a-z0-9]/g,"-")}</string>
|
|
566
566
|
<key>ProgramArguments</key>
|
|
567
567
|
<array>
|
|
568
|
-
${R.map((_)=>` <string>${
|
|
568
|
+
${R.map((_)=>` <string>${X0(_)}</string>`).join(`
|
|
569
569
|
`)}
|
|
570
570
|
</array>
|
|
571
571
|
<key>RunAtLoad</key>
|
|
@@ -575,7 +575,7 @@ ${R.map((_)=>` <string>${Q0(_)}</string>`).join(`
|
|
|
575
575
|
${Z.isHidden?` <key>ProcessType</key>
|
|
576
576
|
<string>Background</string>`:""}
|
|
577
577
|
</dict>
|
|
578
|
-
</plist>`;if(!C($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(C(X))_Y(X)}async function
|
|
578
|
+
</plist>`;if(!C($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(C(X))_Y(X)}async function Y0(Y,Z){let Q=Z.appName||"StxApp",X=BY(Q),$=I(process.env.XDG_CONFIG_HOME||I(y(),".config"),"autostart");if(Y){let J=Z.appPath||process.execPath,K=Z.args||[],R=[J,...K].join(" "),G=`[Desktop Entry]
|
|
579
579
|
Type=Application
|
|
580
580
|
Name=${Q}
|
|
581
581
|
Exec=${R}
|
|
@@ -583,4 +583,4 @@ Terminal=false
|
|
|
583
583
|
StartupNotify=false
|
|
584
584
|
${Z.isHidden?`X-GNOME-Autostart-enabled=true
|
|
585
585
|
NoDisplay=true`:""}
|
|
586
|
-
`;if(!C($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(C(X))_Y(X)}async function
|
|
586
|
+
`;if(!C($))UY($,{recursive:!0});EY(X,G,"utf-8")}else if(C(X))_Y(X)}async function Z0(Y){return C(jY(Y))}async function Q0(Y){let Z=BY(Y);if(!C(Z))return!1;try{let Q=tZ(Z,"utf-8");if(Q.includes("X-GNOME-Autostart-enabled=false"))return!1;if(Q.includes("Hidden=true"))return!1;return!0}catch{return!1}}function X0(Y){return Y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function $0(Y,Z={}){let Q=FY();switch(Q){case"darwin":return eZ(Y,Z);case"linux":return Y0(Y,Z);default:throw Error(`Auto-launch is not yet supported on ${Q}`)}}async function J0(Y){let Z=Y||"StxApp";switch(FY()){case"darwin":return Z0(Z);case"linux":return Q0(Z);default:return!1}}function zY(Y){if(Y.separator)return{id:Y.id||"",title:"",type:"separator"};return{id:Y.id||"",title:Y.title||"",icon:Y.icon,shortcut:Y.shortcut,enabled:Y.disabled?!1:void 0,type:Y.submenu?"submenu":void 0,submenu:Y.submenu?.map(zY)}}async function VY(Y){if(!Y.items||Y.items.length===0)throw Error("contextMenu.show requires at least one item");if(!x("nativeUI"))return null;let Z=await window.craft.nativeUI.showContextMenu({targetId:Y.targetId||"",targetType:"general",x:Math.round(Y.x),y:Math.round(Y.y),items:Y.items.map(zY)});return{id:typeof Z?.id==="string"?Z.id:null,targetId:Z?.targetId}}var G0={available(){return x("nativeUI")},async show(Y){return await VY(Y)!==null},async pick(Y){return(await VY(Y))?.id??null},onAction(Y){return OY("craft:contextmenu:action",(Z)=>{if(typeof Z.id==="string")Y({id:Z.id,targetId:Z.targetId??""})})}};var R0={accentColor:()=>W("system","accentColor",()=>""),highlightColor:()=>W("system","highlightColor",()=>""),language:()=>W("system","language",()=>{if(typeof navigator>"u")return"";return navigator.language?.split("-")[0]||""}),locale:()=>W("system","locale",()=>{if(typeof navigator>"u")return"";return navigator.language||""}),timezone:()=>W("system","timezone",()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch{return""}}),is24HourTime:()=>W("system","is24HourTime",()=>{try{let Y=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Y.hourCycle==="h23"||Y.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>W("system","reduceMotion",()=>n("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>W("system","reduceTransparency",()=>n("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>W("system","increaseContrast",()=>n("(prefers-contrast: more)")),systemVersion:()=>W("system","systemVersion",()=>""),hostname:()=>W("system","hostname",()=>""),username:()=>W("system","username",()=>""),async openPreferences(){if(x("system"))await window.craft.system.openPreferences()}};async function W(Y,Z,Q){if(x(Y))return await window.craft[Y][Z]();return await Q()}function n(Y){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Y).matches}export{V1 as windowEvents,m1 as watchScreenSharing,Q2 as vision,uZ as verifyBundleTrust,B1 as updater,i0 as unregisterHotkey,s0 as unregisterAllHotkeys,UZ as triggerTrayAction,N1 as touchbar,K1 as theme,i1 as tags,R0 as system,yZ as swapBundle,z1 as standardMenus,Y2 as spotlight,Z2 as speechRecognition,C1 as speech,H1 as signPayload,F0 as showWarningToast,D0 as showWarningModal,u0 as showWarningDialog,U0 as showToast,E0 as showSuccessToast,P0 as showSuccessModal,w0 as showSaveDialog,A0 as showQuestionModal,v0 as showOpenDialog,L0 as showModal,f0 as showMessageBox,_0 as showInfoToast,T0 as showInfoModal,j0 as showErrorToast,W0 as showErrorModal,y0 as showErrorDialog,b0 as showConfirmDialog,S0 as showColorPicker,g0 as showAlertDialog,K0 as showAlert,R1 as shell,zZ as setDesktopConfig,$0 as setAutoLaunch,G2 as serviceMenu,R2 as serial,h1 as screenSharing,g1 as screenCapture,L1 as screen,mZ as runningBundleTeamId,wZ as resolveCraftBinary,LZ as resetDesktopConfig,q0 as requestNotificationPermission,qY as relaunchBundle,a0 as registerHotkey,x1 as redactPII,p as readBundleIdentity,RY as quitLauncher,C0 as prompt,W1 as printing,D1 as permissions,s1 as pdf,o0 as parseShortcut,HZ as packageApp,xZ as pack,NZ as openDevWindow,B0 as notify,J1 as notifications,j1 as network,A1 as nativeWindow,P1 as nativeAutoLaunch,X2 as midi,M1 as menu,t1 as log,S1 as location,r1 as localServer,f1 as liveActivities,T1 as keychain,CZ as isWebviewAvailable,_1 as isDragOutAvailable,d0 as isCaffeinated,U2 as isAvailable,J0 as isAutoLaunchEnabled,v1 as iap,d1 as hasFocusShortcuts,w1 as handoff,q1 as globalShortcuts,JY as githubReleaseAssetUrl,$Y as githubLatestAssetUrl,IZ as getWindowBridgeScript,WZ as getWindow,KZ as getTrayInstance,EZ as getTrayBridgeScript,_Z as getSimulatedTrayHTML,t0 as getRegisteredHotkeys,h0 as getDialogBridgeScript,MZ as getDesktopConfig,K2 as getCapability,q2 as getCapabilities,p0 as getCaffeinateStatus,DZ as getActiveWindowIds,qZ as getActiveTrayInstances,I0 as getActiveModalCount,z0 as getActiveAlertCount,QY as generateUpdateManifest,G1 as fs,Q1 as formatTime,l0 as formatShortcut,r0 as formatRemainingTime,n0 as formatDuration,X1 as formatCompact,p1 as focusShortcutsReady,c1 as focus,a1 as fileAssociations,bZ as extractBundle,U1 as dragOut,O0 as dismissAllAlerts,V0 as dismissAlertById,Z1 as delay,E1 as deepLinks,c0 as decaffeinate,kZ as createWindowWithHTML,AZ as createWindow,YZ as createWebView,oY as createTreeView,uY as createTooltip,e0 as createTimer,fY as createTimePicker,TY as createTextInput,CY as createTabs,nY as createTable,e as createSystemTray,dY as createStepper,mY as createSplitView,WY as createSlider,cZ as createSelfUpdater,hY as createScrollView,xY as createRating,HY as createRadioButton,PY as createProgressBar,sZ as createPreferences,pY as createModalComponent,RZ as createMenubar,sY as createMediaPlayer,rY as createListView,gY as createLabel,Y1 as createInterval,bY as createImageView,GY as createGitHubUpdater,hZ as createGitHubUpdateManifest,eY as createFileExplorer,IY as createDropdown,wY as createDatePicker,lY as createDataGrid,vY as createColorPicker,iY as createCodeEditor,yY as createChip,DY as createCheckbox,aY as createChart,kY as createCard,LY as createButton,AY as createBadge,NY as createAvatar,SY as createAutocomplete,cY as createAccordion,I1 as crashReporter,d as craftWindowArguments,vZ as craftBinaryNotFoundMessage,$2 as coreml,J2 as continuityCamera,G0 as contextMenu,N0 as confirm,PZ as closeAllWindows,x0 as closeAllModals,$1 as clipboard,gZ as clearQuarantine,SZ as canReplaceBundle,m0 as caffeinate,b as bundlePathForExecutable,e1 as bonjour,k1 as bluetooth,n1 as biometric,F1 as battery,o1 as audio,l1 as appleScript,O1 as appInfo,k0 as alert,XY as UPDATE_MANIFEST_ASSET,FZ as TRAY_MENU_STYLES,M0 as TOAST_STYLES,H0 as MODAL_STYLES,b1 as MIN_WATCH_INTERVAL_MS,y1 as MAX_WATCH_INTERVAL_MS,u1 as DEFAULT_WATCH_INTERVAL_MS,QZ as COMPONENT_STYLES,ZY as AutoUpdater,ZZ as AVAILABLE_COMPONENTS};
|
package/package.json
CHANGED