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