@stacksjs/desktop 0.2.245 → 0.2.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/{chunk-ts9f0mxv.js → chunk-de1sp3q7.js} +1 -1
- package/dist/{chunk-rgd4gjkd.js → chunk-xsa4qbf7.js} +1 -1
- package/dist/context-menu.d.ts +24 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -49
- package/dist/test-utils.js +1 -1
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as iq,$a as iz,A as Zq,Aa as Xz,B as _q,Ba as Yz,C as $q,Ca as Zz,D as jq,Da as _z,E as xq,Ea as $z,F as kq,Fa as jz,G as wq,Ga as xz,H as yq,Ha as kz,I as fq,Ia as wz,J as vq,Ja as yz,K as gq,Ka as fz,L as bq,La as vz,M as mq,Ma as gz,N as dq,Na as bz,O as uq,Oa as mz,P as hq,Pa as dz,Q as pq,Qa as uz,R as lq,Ra as hz,S as cq,Sa as pz,T as nq,Ta as lz,U as rq,Ua as cz,V as aq,Va as nz,W as sq,Wa as rz,X as oq,Xa as az,Ya as sz,Za as oz,_ as tq,_a as tz,a as zq,aa as eq,ab as ez,b as Aq,ba as qz,bb as qA,c as Bq,ca as zz,cb as zA,d as Cq,da as Az,e as Dq,ea as Bz,f as Eq,fa as Cz,g as Fq,ga as Dz,h as Gq,ha as Ez,i as Hq,ia as Fz,j as Iq,ja as Gz,k as Jq,ka as Hz,l as Kq,la as Iz,m as Lq,ma as Jz,n as Mq,na as Kz,o as Nq,oa as Lz,p as Oq,pa as Mz,q as Pq,qa as Nz,r as Qq,ra as Oz,s as Rq,sa as Pz,t as Sq,ta as Qz,u as Tq,ua as Rz,v as Uq,va as Sz,w as Vq,wa as Tz,x as Wq,xa as Uz,y as Xq,ya as Vz,z as Yq,za as Wz}from"./chunk-xsa4qbf7.js";import"./chunk-de1sp3q7.js";export{Hz as windowEvents,kz as watchScreenSharing,rz as vision,Gz as updater,pq as unregisterHotkey,lq as unregisterAllHotkeys,Pz as touchbar,Az as theme,uz as tags,cz as spotlight,nz as speechRecognition,Rz as speech,Uz as signPayload,Eq as showWarningToast,Nq as showWarningModal,kq as showWarningDialog,Bq as showToast,Dq as showSuccessToast,Pq as showSuccessModal,Yq as showSaveDialog,Qq as showQuestionModal,Xq as showOpenDialog,Lq as showModal,Zq as showMessageBox,Cq as showInfoToast,Mq as showInfoModal,Fq as showErrorToast,Oq as showErrorModal,xq as showErrorDialog,jq as showConfirmDialog,_q as showColorPicker,$q as showAlertDialog,Aq as showAlert,qz as shell,tz as serviceMenu,iz as serial,xz as screenSharing,Zz as screenCapture,Kz as screen,zq as requestNotificationPermission,hq as registerHotkey,Tz as redactPII,Tq as prompt,Nz as printing,Mz as permissions,hz as pdf,dq as parseShortcut,Gq as notify,iq as notifications,Fz as network,Oz as nativeAutoLaunch,az as midi,Jz as menu,pz as log,Yz as location,vz as localServer,Xz as liveActivities,Lz as keychain,Cz as isDragOutAvailable,vq as isCaffeinated,zA as isAvailable,Vz as iap,yz as hasFocusShortcuts,Wz as handoff,zz as globalShortcuts,cq as getRegisteredHotkeys,wq as getDialogBridgeScript,qA as getCapability,ez as getCapabilities,gq as getCaffeinateStatus,Uq as getActiveModalCount,Jq as getActiveAlertCount,eq as fs,sq as formatTime,uq as formatShortcut,bq as formatRemainingTime,mq as formatDuration,oq as formatCompact,fz as focusShortcutsReady,wz as focus,dz as fileAssociations,Bz as dragOut,Iq as dismissAllAlerts,Hq as dismissAlertById,aq as delay,Dz as deepLinks,fq as decaffeinate,nq as createTimer,rq as createInterval,Sz as crashReporter,sz as coreml,oz as continuityCamera,Rq as confirm,Vq as closeAllModals,tq as clipboard,yq as caffeinate,lz as bonjour,Qz as bluetooth,gz as biometric,Ez as battery,bz as audio,mz as appleScript,Iz as app,Sq as alert,Kq as TOAST_STYLES,Wq as MODAL_STYLES,_z as MIN_WATCH_INTERVAL_MS,$z as MAX_WATCH_INTERVAL_MS,jz as DEFAULT_WATCH_INTERVAL_MS};
|
|
@@ -312,4 +312,4 @@ window.stxDialog = {
|
|
|
312
312
|
<style>body{font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#f5f5f7}</style>
|
|
313
313
|
<div><h1>You can close this tab.</h1><p>Returning to the app\u2026</p></div>
|
|
314
314
|
<script>setTimeout(()=>window.close(),1500)</script>`;this.respond({status:200,body:k,contentType:"text/html; charset=utf-8"}).catch(()=>{}).finally(()=>this.stop().catch(()=>{})),P({url:N,port:Q.port})})})}};var p$={async isAvailable(){if(!J("biometric"))return!1;return await window.craft.biometric.isAvailable()},async getBiometryType(){if(!J("biometric"))return"none";return await window.craft.biometric.getBiometryType()},async evaluate(Z,$){if(!Z)throw Error("biometric.evaluate: reason is required");if(!J("biometric"))return{success:!1,errorCode:-1};return await window.craft.biometric.evaluate(Z,$)}};var K=null,r$={async play(Z,$){if(J("audio"))return await window.craft.audio.play(Z,$);if(typeof window>"u"||typeof Audio>"u")return!1;if(K)K.pause(),K=null;if(K=new Audio(Z),$?.volume!=null)K.volume=$.volume;if($?.loops)K.loop=!0;try{return await K.play(),!0}catch{return!1}},async playSystemSound(Z){if(J("audio"))return await window.craft.audio.playSystemSound(Z);if(typeof window>"u"||typeof Audio>"u")return!1;try{return K=new Audio(`/System/Library/Sounds/${Z}.aiff`),await K.play(),!0}catch{return!1}},async stop(){if(J("audio")){await window.craft.audio.stop();return}if(K)K.pause(),K.currentTime=0,K=null},async isPlaying(){if(J("audio"))return await window.craft.audio.isPlaying();return!!(K&&!K.paused)},async startRecording(Z,$){if(J("audio"))return await window.craft.audio.startRecording(Z,$);return!1},async stopRecording(){if(J("audio"))await window.craft.audio.stopRecording()},async isRecording(){if(J("audio"))return await window.craft.audio.isRecording();return!1}};var i$={async execute(Z){if(!Z)throw Error("appleScript.execute: source is required");if(!J("appleScript"))return{ok:!1};return await window.craft.appleScript.execute(Z)}};var e$={async getDefault(Z){if(!Z)throw Error("fileAssociations.getDefault: uti is required");if(!J("fileAssociations"))return null;let $=await window.craft.fileAssociations.getDefault(Z);return $?String($):null},async setDefault(Z,$){if(!Z||!$)throw Error("fileAssociations.setDefault: uti and bundleId are required");if(!J("fileAssociations"))return!1;return await window.craft.fileAssociations.setDefault(Z,$)}};var JJ={async get(Z){if(!Z)throw Error("tags.get: path is required");if(!J("tags"))return[];return await window.craft.tags.get(Z)},async set(Z,$){if(!Z)throw Error("tags.set: path is required");if(!J("tags"))return!1;let Y=Array.isArray($)?$:[String($)];return await window.craft.tags.set(Z,Y)},async clear(Z){if(!Z)throw Error("tags.clear: path is required");if(!J("tags"))return!1;return await window.craft.tags.clear(Z)}};var GJ={async countPages(Z){if(!Z)throw Error("pdf.countPages: path is required");if(!J("pdf"))return 0;return await window.craft.pdf.countPages(Z)},async extractText(Z){if(!Z)throw Error("pdf.extractText: path is required");if(!J("pdf"))return"";return await window.craft.pdf.extractText(Z)}};var XJ={async debug(Z){if(J("log"))await window.craft.log.debug(Z);else console.debug(Z)},async info(Z){if(J("log"))await window.craft.log.info(Z);else console.info(Z)},async warn(Z){if(J("log"))await window.craft.log.warn(Z);else console.warn(Z)},async error(Z){if(J("log"))await window.craft.log.error(Z);else console.error(Z)}};var FJ={async browse(Z){if(!J("bonjour"))return{started:!1,reason:"bridge unavailable"};return await window.craft.bonjour.browse(Z)},async stop(){if(J("bonjour"))await window.craft.bonjour.stop()},onFound(Z){return O("craft:bonjour:found",Z)},onLost(Z){return O("craft:bonjour:lost",Z)}};var KJ={async index(Z){if(!J("spotlight"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.spotlight.index(Z)},async remove(Z){if(!J("spotlight"))return{ok:!1};return await window.craft.spotlight.remove(Z)},async removeAll(){if(!J("spotlight"))return{ok:!1};return await window.craft.spotlight.removeAll()}};var LJ={async isAvailable(){if(!J("speechRecognition"))return!1;return await window.craft.speechRecognition.isAvailable()},async start(Z){if(!J("speechRecognition"))return{started:!1,reason:"bridge unavailable"};return await window.craft.speechRecognition.start(Z)},async stop(){if(J("speechRecognition"))await window.craft.speechRecognition.stop()},onPartial(Z){return O("craft:speechRecognition:partial",Z)},onFinal(Z){return O("craft:speechRecognition:final",Z)}};var HJ={async recognizeText(Z){if(!Z)throw Error("vision.recognizeText: path is required");if(!J("vision"))return[];return await window.craft.vision.recognizeText(Z)},async detectFaces(Z){if(!Z)throw Error("vision.detectFaces: path is required");if(!J("vision"))return[];return await window.craft.vision.detectFaces(Z)},async detectBarcodes(Z){if(!Z)throw Error("vision.detectBarcodes: path is required");if(!J("vision"))return[];return await window.craft.vision.detectBarcodes(Z)}};var MJ={async listSources(){if(!J("midi"))return[];return await window.craft.midi.listSources()},async listDestinations(){if(!J("midi"))return[];return await window.craft.midi.listDestinations()},async send(Z,$){if(!J("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.send(Z,$)},async subscribe(Z){if(!J("midi"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.midi.subscribe(Z)},async unsubscribe(Z){if(!J("midi"))return{ok:!1};return await window.craft.midi.unsubscribe(Z)},onMessage(Z){return O("craft:midi:message",Z)}};var AJ={async loadModel(Z,$){if(!Z||!$)throw Error("coreml.loadModel: id and path are required");if(!J("coreml"))return!1;return await window.craft.coreml.loadModel(Z,$)},async unloadModel(Z){if(!J("coreml"))return;await window.craft.coreml.unloadModel(Z)},async predict(Z,$){if(!Z)throw Error("coreml.predict: id is required");if(!J("coreml"))return null;return await window.craft.coreml.predict(Z,$)}};var EJ={async listCameras(){if(!J("continuityCamera"))return[];return await window.craft.continuityCamera.listCameras()}};var wJ={async register(Z){if(!Z)throw Error("serviceMenu.register: name is required");if(!J("serviceMenu"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serviceMenu.register(Z)},async unregister(Z){if(!Z)throw Error("serviceMenu.unregister: name is required");if(!J("serviceMenu"))return;await window.craft.serviceMenu.unregister(Z)},onInvoked(Z){return O("craft:serviceMenu:invoked",Z)}};var mJ={async list(){if(!J("serial"))return[];return await window.craft.serial.list()},async open(Z,$=9600){if(!Z)throw Error("serial.open: path is required");if(!J("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.open(Z,$)},async write(Z,$){if(!Z)throw Error("serial.write: id is required");if(!J("serial"))return{ok:!1,reason:"bridge unavailable"};return await window.craft.serial.write(Z,$)},async close(Z){if(!J("serial"))return;await window.craft.serial.close(Z)},onData(Z){return O("craft:serial:data",Z)}};var RZ=[{name:"fs",support:"native"},{name:"shell",support:"native"},{name:"system",support:"all"},{name:"clipboard",support:"all"},{name:"dialog",support:"all"},{name:"window",support:"native"},{name:"tray",support:"native"},{name:"menu",support:"native"},{name:"theme",support:"all"},{name:"screen",support:"all"},{name:"network",support:"all"},{name:"power",support:"all"},{name:"battery",support:"all"},{name:"notifications",support:"all"},{name:"globalShortcuts",support:"native"},{name:"autolaunch",support:"native"},{name:"appInfo",support:"all"},{name:"localServer",support:"native"},{name:"bluetooth",support:"native"},{name:"crashReporter",support:"all"},{name:"updater",support:"native"},{name:"iap",support:"macos"},{name:"keychain",support:"native"},{name:"log",support:"all"},{name:"biometric",support:"macos"},{name:"location",support:"macos"},{name:"audio",support:"macos"},{name:"deepLink",support:"native"},{name:"handoff",support:"macos"},{name:"liveActivities",support:"macos"},{name:"touchbar",support:"macos"},{name:"dragOut",support:"macos"},{name:"appleScript",support:"macos"},{name:"fileAssociations",support:"native"},{name:"tags",support:"macos"},{name:"pdf",support:"macos"},{name:"bonjour",support:"macos"},{name:"spotlight",support:"macos"},{name:"speechRecognition",support:"macos"},{name:"vision",support:"macos"},{name:"midi",support:"macos"},{name:"coreml",support:"macos"},{name:"continuityCamera",support:"macos"},{name:"serviceMenu",support:"macos"},{name:"serial",support:"native"}];function bJ(){return RZ.map(({name:Z,support:$})=>({name:Z,support:$,available:J(Z)}))}function X4(Z){let $=RZ.find((Y)=>Y.name===Z);if(!$)return;return{...$,available:J(Z)}}function lJ(Z){let $=X4(Z);return!!$&&$.available}
|
|
315
|
-
export{P4 as a,e as b,C as c,V4 as d,F4 as e,j4 as f,W4 as g,K4 as h,N4 as i,R4 as j,L4 as k,D4 as l,T as m,EZ as n,H4 as o,q4 as p,U4 as q,CZ as r,M4 as s,T4 as t,S4 as u,A4 as v,x4 as w,_4 as x,C4 as y,I4 as z,y as A,w4 as B,y4 as C,f4 as D,m4 as E,B4 as F,v4 as G,l4 as H,IZ as I,g4 as J,u4 as K,h4 as L,c4 as M,yZ as N,d4 as O,n4 as P,vZ as Q,r4 as R,o4 as S,i4 as T,s4 as U,t4 as V,e4 as W,Z8 as X,J as Y,
|
|
315
|
+
export{P4 as a,e as b,C as c,V4 as d,F4 as e,j4 as f,W4 as g,K4 as h,N4 as i,R4 as j,L4 as k,D4 as l,T as m,EZ as n,H4 as o,q4 as p,U4 as q,CZ as r,M4 as s,T4 as t,S4 as u,A4 as v,x4 as w,_4 as x,C4 as y,I4 as z,y as A,w4 as B,y4 as C,f4 as D,m4 as E,B4 as F,v4 as G,l4 as H,IZ as I,g4 as J,u4 as K,h4 as L,c4 as M,yZ as N,d4 as O,n4 as P,vZ as Q,r4 as R,o4 as S,i4 as T,s4 as U,t4 as V,e4 as W,Z8 as X,J as Y,O as Z,z8 as _,Q8 as $,V8 as aa,W8 as ba,R8 as ca,k8 as da,U8 as ea,M8 as fa,A8 as ga,E8 as ha,w8 as ia,m8 as ja,b8 as ka,u8 as la,p8 as ma,r8 as na,i8 as oa,e8 as pa,J$ as qa,G$ as ra,X$ as sa,F$ as ta,K$ as ua,v as va,Z4 as wa,$4 as xa,H$ as ya,b as za,S$ as Aa,_$ as Ba,I$ as Ca,z4 as Da,G4 as Ea,WZ as Fa,a as Ga,f$ as Ha,NZ as Ia,v$ as Ja,b$ as Ka,u$ as La,p$ as Ma,r$ as Na,i$ as Oa,e$ as Pa,JJ as Qa,GJ as Ra,XJ as Sa,FJ as Ta,KJ as Ua,LJ as Va,HJ as Wa,MJ as Xa,AJ as Ya,EJ as Za,wJ as _a,mJ as $a,bJ as ab,X4 as bb,lJ as cb};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const contextMenu: ContextMenuAPI;
|
|
2
|
+
export declare interface ContextMenuItem {
|
|
3
|
+
id?: string
|
|
4
|
+
title?: string
|
|
5
|
+
separator?: boolean
|
|
6
|
+
icon?: string
|
|
7
|
+
shortcut?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
submenu?: ContextMenuItem[]
|
|
10
|
+
}
|
|
11
|
+
export declare interface ContextMenuOptions {
|
|
12
|
+
items: ContextMenuItem[]
|
|
13
|
+
x: number
|
|
14
|
+
y: number
|
|
15
|
+
targetId?: string
|
|
16
|
+
}
|
|
17
|
+
export declare interface ContextMenuActionEvent {
|
|
18
|
+
id: string
|
|
19
|
+
}
|
|
20
|
+
export declare interface ContextMenuAPI {
|
|
21
|
+
show: (options: ContextMenuOptions) => Promise<boolean>
|
|
22
|
+
available: () => boolean
|
|
23
|
+
onAction: (cb: (event: ContextMenuActionEvent) => void) => () => void
|
|
24
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,12 @@ export type {
|
|
|
151
151
|
export type { WindowEvents, WindowPosition, WindowSize } from './window-events';
|
|
152
152
|
export type { AppAPI, AppInfo, AppNotifyOptions } from './app-info';
|
|
153
153
|
export type { MenuActionEvent, MenuAPI, MenuItem } from './menu';
|
|
154
|
+
export type {
|
|
155
|
+
ContextMenuAPI,
|
|
156
|
+
ContextMenuActionEvent,
|
|
157
|
+
ContextMenuItem,
|
|
158
|
+
ContextMenuOptions,
|
|
159
|
+
} from './context-menu';
|
|
154
160
|
export type { SystemInfo } from './system';
|
|
155
161
|
export type { Display, ScreenAPI } from './screen';
|
|
156
162
|
export type { KeychainAPI } from './keychain';
|
|
@@ -518,6 +524,10 @@ export { app as appInfo } from './app-info';
|
|
|
518
524
|
// =============================================================================
|
|
519
525
|
export { menu } from './menu';
|
|
520
526
|
// =============================================================================
|
|
527
|
+
// Native Context Menu (right-click, at the pointer)
|
|
528
|
+
// =============================================================================
|
|
529
|
+
export { contextMenu } from './context-menu';
|
|
530
|
+
// =============================================================================
|
|
521
531
|
// System / Host Info
|
|
522
532
|
// =============================================================================
|
|
523
533
|
export { system } from './system';
|
package/dist/index.js
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as
|
|
2
|
+
import{$ as rZ,$a as r0,A as TZ,Aa as z0,B as LZ,Ba as M0,C as DZ,Ca as T0,D as PZ,Da as L0,E as WZ,Ea as D0,F as AZ,Fa as P0,G as NZ,Ga as W0,H as xZ,Ha as A0,I as IZ,Ia as N0,J as kZ,Ja as x0,K as CZ,Ka as I0,L as HZ,La as k0,M as vZ,Ma as C0,N as wZ,Na as H0,O as fZ,Oa as v0,P as SZ,Pa as w0,Q as gZ,Qa as f0,R as bZ,Ra as S0,S as uZ,Sa as g0,T as yZ,Ta as b0,U as hZ,Ua as u0,V as mZ,Va as y0,W as cZ,Wa as h0,X as dZ,Xa as m0,Y as C,Ya as c0,Z as UQ,Za as d0,_ as pZ,_a as p0,a as lY,aa as nZ,ab as n0,b as aY,ba as oZ,bb as o0,c as iY,ca as lZ,cb as l0,d as sY,da as aZ,e as tY,ea as iZ,f as eY,fa as sZ,g as QZ,ga as tZ,h as YZ,ha as eZ,i as ZZ,ia as Q0,j as XZ,ja as Y0,k as $Z,ka as Z0,l as JZ,la as X0,m as GZ,ma as $0,n as qZ,na as J0,o as RZ,oa as G0,p as KZ,pa as q0,q as UZ,qa as R0,r as EZ,ra as K0,s as _Z,sa as U0,t as FZ,ta as E0,u as BZ,ua as _0,v as jZ,va as F0,w as VZ,wa as B0,x as OZ,xa as j0,y as zZ,ya as V0,z as MZ,za as O0}from"./chunk-xsa4qbf7.js";import{db as N}from"./chunk-de1sp3q7.js";function z(Q="stx"){return`${Q}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function F(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(...Q){return Q.filter(Boolean).join(" ")}function V(Q){if(!Q)return"";return Object.entries(Q).map(([Y,Z])=>`${Y.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${Z}`).join("; ")}function FQ(Q){let{text:Y,variant:Z="primary",size:X="medium",disabled:$=!1,loading:G=!1,icon:K,iconPosition:q="left",id:J=z("btn"),className:E,style:U}=Q,_=O("stx-button",`stx-button--${Z}`,`stx-button--${X}`,$&&"stx-button--disabled",G&&"stx-button--loading",E),R=V(U),B=K?`<span class="stx-button-icon">${K}</span>`:"",j=G?'<span class="stx-button-spinner"></span>':"",M=q==="left"?`${B}${j}<span class="stx-button-text">${F(Y)}</span>`:`<span class="stx-button-text">${F(Y)}</span>${B}${j}`;return`<button id="${J}" class="${_}" ${$||G?"disabled":""} ${R?`style='${R}'`:""}>${M}</button>`}function BQ(Q){let{value:Y="",placeholder:Z="",type:X="text",disabled:$=!1,readonly:G=!1,maxLength:K,minLength:q,pattern:J,required:E=!1,autocomplete:U,label:_,error:R,hint:B,id:j=z("input"),className:M,style:T}=Q,L=O("stx-input",R&&"stx-input--error",$&&"stx-input--disabled",M),w=V(T),_Q=[`type="${X}"`,`id="${j}"`,`class="${L}"`,Y&&`value="${F(Y)}"`,Z&&`placeholder="${F(Z)}"`,$&&"disabled",G&&"readonly",E&&"required",K&&`maxlength="${K}"`,q&&`minlength="${q}"`,J&&`pattern="${F(J)}"`,U&&`autocomplete="${U}"`,w&&`style="${w}"`].filter(Boolean).join(" "),H="";if(_)H+=`<label class="stx-input-label" for="${j}">${F(_)}</label>`;if(H+=`<input ${_Q} />`,R)H+=`<div class="stx-input-error">${F(R)}</div>`;else if(B)H+=`<div class="stx-input-hint">${F(B)}</div>`;return`<div class="stx-input-wrapper">${H}</div>`}function jQ(Q){let{checked:Y=!1,label:Z,disabled:X=!1,indeterminate:$=!1,id:G=z("checkbox"),className:K,style:q}=Q,J=O("stx-checkbox",X&&"stx-checkbox--disabled",K),E=V(q),U=['type="checkbox"',`id="${G}"`,Y&&"checked",X&&"disabled",$&&'data-indeterminate="true"'].filter(Boolean).join(" ");return`
|
|
3
3
|
<label class="${J}" ${E?`style="${E}"`:""}>
|
|
4
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">${F(Z)}</span>`:""}
|
|
7
7
|
</label>
|
|
8
|
-
`}function
|
|
9
|
-
<div id="${q}" class="${_}" role="progressbar" aria-valuenow="${
|
|
8
|
+
`}function VQ(Q){let{value:Y=50,min:Z=0,max:X=100,step:$=1,disabled:G=!1,label:K,showValue:q=!0,id:J=z("slider"),className:E,style:U}=Q,_=O("stx-slider",G&&"stx-slider--disabled",E),R=V(U),B=['type="range"',`id="${J}"`,`value="${Y}"`,`min="${Z}"`,`max="${X}"`,`step="${$}"`,G&&"disabled"].filter(Boolean).join(" "),j="";if(K)j+=`<label class="stx-slider-label" for="${J}">${F(K)}</label>`;if(j+=`<div class="stx-slider-track"><input ${B} /></div>`,q)j+=`<span class="stx-slider-value">${Y}</span>`;return`<div class="${_}" ${R?`style='${R}'`:""}>${j}</div>`}function OQ(Q){let{value:Y,max:Z=100,variant:X="default",size:$="medium",showLabel:G=!1,indeterminate:K=!1,id:q=z("progress"),className:J,style:E}=Q,U=Math.min(100,Math.max(0,Y/Z*100)),_=O("stx-progress",`stx-progress--${X}`,`stx-progress--${$}`,K&&"stx-progress--indeterminate",J),R=V(E);return`
|
|
9
|
+
<div id="${q}" class="${_}" role="progressbar" aria-valuenow="${Y}" aria-valuemin="0" aria-valuemax="${Z}" ${R?`style="${R}"`:""}>
|
|
10
10
|
<div class="stx-progress-bar" style="width: ${K?"100%":`${U}%`}"></div>
|
|
11
11
|
${G?`<span class="stx-progress-label">${Math.round(U)}%</span>`:""}
|
|
12
12
|
</div>
|
|
13
|
-
`}function
|
|
14
|
-
<img src="${
|
|
13
|
+
`}function zQ(Q){let{text:Y,variant:Z="default",size:X="medium",id:$=z("badge"),className:G,style:K}=Q,q=O("stx-badge",`stx-badge--${Z}`,`stx-badge--${X}`,G),J=V(K);return`<span id="${$}" class="${q}" ${J?`style='${J}'`:""}>${F(Y)}</span>`}function MQ(Q){let{src:Y,alt:Z="",name:X,size:$="medium",shape:G="circle",id:K=z("avatar"),className:q,style:J}=Q,E=typeof $==="number"?"":`stx-avatar--${$}`,U=typeof $==="number"?`width: ${$}px; height: ${$}px;`:"",_=O("stx-avatar",E,`stx-avatar--${G}`,q),R=[U,V(J)].filter(Boolean).join(" "),B=X?X.split(" ").map((j)=>j[0]).join("").toUpperCase().slice(0,2):"";if(Y)return`<div id="${K}" class="${_}" ${R?`style="${R}"`:""}>
|
|
14
|
+
<img src="${F(Y)}" alt="${F(Z)}" class="stx-avatar-img" />
|
|
15
15
|
</div>`;return`<div id="${K}" class="${_}" ${R?`style="${R}"`:""}>
|
|
16
|
-
<span class="stx-avatar-initials">${
|
|
17
|
-
</div>`}function
|
|
16
|
+
<span class="stx-avatar-initials">${B}</span>
|
|
17
|
+
</div>`}function TQ(Q){let{title:Y,subtitle:Z,content:X,image:$,footer:G,variant:K="default",id:q=z("card"),className:J,style:E}=Q,U=O("stx-card",`stx-card--${K}`,J),_=V(E),R="";if($)R+=`<div class="stx-card-image"><img src="${F($)}" alt="" /></div>`;if(R+='<div class="stx-card-body">',Y)R+=`<h3 class="stx-card-title">${F(Y)}</h3>`;if(Z)R+=`<p class="stx-card-subtitle">${F(Z)}</p>`;if(X)R+=`<div class="stx-card-content">${F(X)}</div>`;if(R+="</div>",G)R+=`<div class="stx-card-footer">${F(G)}</div>`;return`<div id="${q}" class="${U}" ${_?`style='${_}'`:""}>${R}</div>`}function LQ(Q){let{tabs:Y,activeTab:Z,variant:X="default",id:$=z("tabs"),className:G,style:K}=Q,q=O("stx-tabs",`stx-tabs--${X}`,G),J=V(K),E=Y.map((U,_)=>{let R=Z?U.value===Z:_===0;return`<button class="${O("stx-tab",R&&"stx-tab--active",U.disabled&&"stx-tab--disabled")}" data-value="${F(U.value)}" ${U.disabled?"disabled":""} role="tab" aria-selected="${R}">${F(U.label)}</button>`}).join("");return`<div id="${$}" class="${q}" role="tablist" ${J?`style='${J}'`:""}>${E}</div>`}function DQ(Q){let{options:Y,value:Z,placeholder:X="Select...",disabled:$=!1,id:G=z("dropdown"),className:K,style:q}=Q,J=O("stx-dropdown",$&&"stx-dropdown--disabled",K),E=V(q),U=Y.map((R)=>{let B=R.value===Z?"selected":"",j=R.disabled?"disabled":"";return`<option value="${F(R.value)}" ${B} ${j}>${F(R.label)}</option>`}).join(""),_=Z?"":`<option value="" disabled selected>${F(X)}</option>`;return`<select id="${G}" class="${J}" ${$?"disabled":""} ${E?`style='${E}'`:""}>${_}${U}</select>`}function PQ(Q){let{value:Y=0,max:Z=5,readonly:X=!1,size:$="medium",allowHalf:G=!1,id:K=z("rating"),className:q,style:J}=Q,E=O("stx-rating",`stx-rating--${$}`,X&&"stx-rating--readonly",q),U=V(J),_="";for(let R=1;R<=Z;R++){let B=R<=Y,j=G&&R-0.5===Y;_+=`<span class="stx-star ${B?"stx-star--filled":j?"stx-star--half":""}" data-value="${R}">\u2605</span>`}return`<div id="${K}" class="${E}" role="slider" aria-valuenow="${Y}" aria-valuemin="0" aria-valuemax="${Z}" ${U?`style='${U}'`:""}>${_}</div>`}function WQ(Q){let{value:Y,name:Z,checked:X=!1,label:$,disabled:G=!1,id:K=z("radio"),className:q,style:J}=Q,E=O("stx-radio",G&&"stx-radio--disabled",q),U=V(J),_=['type="radio"',`id="${K}"`,`name="${F(Z)}"`,`value="${F(Y)}"`,X&&"checked",G&&"disabled"].filter(Boolean).join(" ");return`
|
|
18
18
|
<label class="${E}" ${U?`style="${U}"`:""}>
|
|
19
19
|
<input ${_} />
|
|
20
20
|
<span class="stx-radio-circle"></span>
|
|
21
|
-
${$?`<span class="stx-radio-label">${
|
|
21
|
+
${$?`<span class="stx-radio-label">${F($)}</span>`:""}
|
|
22
22
|
</label>
|
|
23
|
-
`}function
|
|
24
|
-
<input type="color" id="${G}" value="${
|
|
25
|
-
<span class="stx-color-picker-value">${
|
|
26
|
-
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let _ of $)U+=`<button class="stx-color-preset" style="background: ${
|
|
23
|
+
`}function AQ(Q){let{value:Y="#3498db",disabled:Z=!1,label:X,presetColors:$=["#e74c3c","#f39c12","#27ae60","#3498db","#9b59b6","#1abc9c","#34495e","#000000"],id:G=z("color"),className:K,style:q}=Q,J=O("stx-color-picker",Z&&"stx-color-picker--disabled",K),E=V(q),U="";if(X)U+=`<label class="stx-color-picker-label" for="${G}">${F(X)}</label>`;if(U+=`<div class="stx-color-picker-input">
|
|
24
|
+
<input type="color" id="${G}" value="${F(Y)}" ${Z?"disabled":""} />
|
|
25
|
+
<span class="stx-color-picker-value">${F(Y)}</span>
|
|
26
|
+
</div>`,$.length>0){U+='<div class="stx-color-picker-presets">';for(let _ of $)U+=`<button class="stx-color-preset" style="background: ${F(_)}" data-color="${F(_)}" ${Z?"disabled":""}></button>`;U+="</div>"}return`<div class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function NQ(Q){let{value:Y,min:Z,max:X,disabled:$=!1,label:G,placeholder:K="Select date",showClear:q=!0,id:J=z("date"),className:E,style:U}=Q,_=O("stx-date-picker",$&&"stx-date-picker--disabled",E),R=V(U),B=Y instanceof Date?Y.toISOString().split("T")[0]:Y||"",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}"`,B&&`value="${B}"`,j&&`min="${j}"`,M&&`max="${M}"`,$&&"disabled",`placeholder="${F(K)}"`].filter(Boolean).join(" "),L="";if(G)L+=`<label class="stx-date-picker-label" for="${J}">${F(G)}</label>`;return L+=`<div class="stx-date-picker-input">
|
|
27
27
|
<input ${T} />
|
|
28
|
-
${q&&
|
|
29
|
-
</div>`,`<div class="${_}" ${R?`style='${R}'`:""}>${L}</div>`}function
|
|
30
|
-
<input type="text" id="${q}" value="${B
|
|
28
|
+
${q&&B?'<button class="stx-date-picker-clear" type="button">×</button>':""}
|
|
29
|
+
</div>`,`<div class="${_}" ${R?`style='${R}'`:""}>${L}</div>`}function xQ(Q){let{value:Y="",disabled:Z=!1,label:X,step:$=60,min:G,max:K,id:q=z("time"),className:J,style:E}=Q,U=O("stx-time-picker",Z&&"stx-time-picker--disabled",J),_=V(E),R=['type="time"',`id="${q}"`,Y&&`value="${F(Y)}"`,`step="${$}"`,G&&`min="${F(G)}"`,K&&`max="${F(K)}"`,Z&&"disabled"].filter(Boolean).join(" "),B="";if(X)B+=`<label class="stx-time-picker-label" for="${q}">${F(X)}</label>`;return B+=`<input ${R} class="stx-time-picker-input" />`,`<div class="${U}" ${_?`style='${_}'`:""}>${B}</div>`}function IQ(Q){let{options:Y,value:Z="",placeholder:X="Search...",disabled:$=!1,label:G,loading:K=!1,id:q=z("autocomplete"),className:J,style:E}=Q,U=O("stx-autocomplete",$&&"stx-autocomplete--disabled",J),_=V(E),R=Y.find((M)=>M.value===Z),B=R?R.label:Z,j="";if(G)j+=`<label class="stx-autocomplete-label" for="${q}">${F(G)}</label>`;j+=`<div class="stx-autocomplete-input-wrapper">
|
|
30
|
+
<input type="text" id="${q}" value="${F(B)}" placeholder="${F(X)}" ${$?"disabled":""} autocomplete="off" class="stx-autocomplete-input" />
|
|
31
31
|
${K?'<span class="stx-autocomplete-spinner"></span>':""}
|
|
32
|
-
</div>`,j+='<ul class="stx-autocomplete-list">';for(let M of
|
|
32
|
+
</div>`,j+='<ul class="stx-autocomplete-list">';for(let M of Y)j+=`<li class="stx-autocomplete-item ${M.value===Z?"stx-autocomplete-item--selected":""}" data-value="${F(M.value)}">${F(M.label)}</li>`;return j+="</ul>",`<div class="${U}" ${_?`style='${_}'`:""}>${j}</div>`}function kQ(Q){let{text:Y,htmlFor:Z,required:X=!1,size:$="medium",id:G=z("label"),className:K,style:q}=Q,J=O("stx-label",`stx-label--${$}`,K),E=V(q);return`<label id="${G}" class="${J}" ${Z?`for='${F(Z)}'`:""} ${E?`style='${E}'`:""}>${F(Y)}${X?'<span class="stx-label-required">*</span>':""}</label>`}function CQ(Q){let{src:Y,alt:Z="",width:X,height:$,objectFit:G="cover",fallback:K,loading:q="lazy",id:J=z("image"),className:E,style:U}=Q,_=O("stx-image",E),R={objectFit:G};if(X)R.width=typeof X==="number"?`${X}px`:X;if($)R.height=typeof $==="number"?`${$}px`:$;let B=[V(R),V(U)].filter(Boolean).join("; "),j=K?`onerror="this.src='${F(K)}'"`:"";return`<img id="${J}" class="${_}" src="${F(Y)}" alt="${F(Z)}" loading="${q}" ${B?`style='${B}'`:""} ${j} />`}function HQ(Q){let{text:Y,variant:Z="default",size:X="medium",removable:$=!1,icon:G,id:K=z("chip"),className:q,style:J}=Q,E=O("stx-chip",`stx-chip--${Z}`,`stx-chip--${X}`,q),U=V(J),_="";if(G)_+=`<span class="stx-chip-icon">${G}</span>`;if(_+=`<span class="stx-chip-text">${F(Y)}</span>`,$)_+='<button class="stx-chip-remove" type="button">×</button>';return`<span id="${K}" class="${E}" ${U?`style='${U}'`:""}>${_}</span>`}function vQ(Q){let{text:Y,position:Z="top",delay:X=200,children:$,id:G=z("tooltip"),className:K,style:q}=Q,J=O("stx-tooltip-wrapper",K),E=V(q);return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""} data-tooltip="${F(Y)}" data-position="${Z}" data-delay="${X}">
|
|
33
33
|
${$}
|
|
34
|
-
<span class="stx-tooltip stx-tooltip--${Z}">${
|
|
35
|
-
</div>`}function
|
|
34
|
+
<span class="stx-tooltip stx-tooltip--${Z}">${F(Y)}</span>
|
|
35
|
+
</div>`}function wQ(Q){let{direction:Y="vertical",showScrollbar:Z=!0,smooth:X=!0,height:$,width:G,children:K,id:q=z("scroll"),className:J,style:E}=Q,U=O("stx-scroll-view",`stx-scroll-view--${Y}`,!Z&&"stx-scroll-view--hide-scrollbar",X&&"stx-scroll-view--smooth",J),_={};if($)_.height=typeof $==="number"?`${$}px`:$;if(G)_.width=typeof G==="number"?`${G}px`:G;let R=[V(_),V(E)].filter(Boolean).join("; ");return`<div id="${q}" class="${U}" ${R?`style='${R}'`:""}>${K}</div>`}function fQ(Q){let{direction:Y="horizontal",sizes:Z=[50,50],resizable:X=!0,children:$,id:G=z("split"),className:K,style:q}=Q,J=O("stx-split-view",`stx-split-view--${Y}`,X&&"stx-split-view--resizable",K),E=V(q),U=Y==="horizontal"?"width":"height";return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""}>
|
|
36
36
|
<div class="stx-split-pane" style="${U}: ${Z[0]}%">${$[0]}</div>
|
|
37
37
|
${X?'<div class="stx-split-divider"></div>':""}
|
|
38
38
|
<div class="stx-split-pane" style="${U}: ${Z[1]}%">${$[1]}</div>
|
|
39
|
-
</div>`}function
|
|
39
|
+
</div>`}function SQ(Q){let{items:Y,multiple:Z=!1,defaultOpen:X=[],id:$=z("accordion"),className:G,style:K}=Q,q=O("stx-accordion",G),J=V(K),E="";return Y.forEach((U,_)=>{let R=X.includes(_),B=O("stx-accordion-item",R&&"stx-accordion-item--open",U.disabled&&"stx-accordion-item--disabled");E+=`<div class="${B}" data-index="${_}">
|
|
40
40
|
<button class="stx-accordion-header" ${U.disabled?"disabled":""} aria-expanded="${R}" data-multiple="${Z}">
|
|
41
|
-
<span class="stx-accordion-title">${
|
|
41
|
+
<span class="stx-accordion-title">${F(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
|
+
${F(U.content)}
|
|
46
46
|
</div>
|
|
47
|
-
</div>`}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${E}</div>`}function
|
|
47
|
+
</div>`}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${E}</div>`}function gQ(Q){let{steps:Y,currentStep:Z,orientation:X="horizontal",id:$=z("stepper"),className:G,style:K}=Q,q=O("stx-stepper",`stx-stepper--${X}`,G),J=V(K),E="";return Y.forEach((U,_)=>{let R=O("stx-step",_<Z&&"stx-step--completed",_===Z&&"stx-step--active");if(E+=`<div class="${R}" data-step="${_}">
|
|
48
48
|
<div class="stx-step-indicator">
|
|
49
49
|
${_<Z?"\u2713":_+1}
|
|
50
50
|
</div>
|
|
51
51
|
<div class="stx-step-content">
|
|
52
|
-
<div class="stx-step-label">${
|
|
53
|
-
${U.description?`<div class="stx-step-description">${
|
|
52
|
+
<div class="stx-step-label">${F(U.label)}</div>
|
|
53
|
+
${U.description?`<div class="stx-step-description">${F(U.description)}</div>`:""}
|
|
54
54
|
</div>
|
|
55
|
-
</div>`,_<
|
|
56
|
-
<div class="stx-list-view-empty">${
|
|
57
|
-
</div>`;let U='<ul class="stx-list-view-items">';for(let _ of
|
|
55
|
+
</div>`,_<Y.length-1)E+='<div class="stx-step-connector"></div>'}),`<div id="${$}" class="${q}" ${J?`style='${J}'`:""}>${E}</div>`}function bQ(Q){let{open:Y=!1,title:Z,size:X="medium",closable:$=!0,children:G,footer:K,id:q=z("modal"),className:J,style:E}=Q,U=O("stx-modal-component",`stx-modal-component--${X}`,J),_=V(E);if(!Y)return`<div id="${q}" class="${U} stx-modal-component--hidden" ${_?`style='${_}'`:""}></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">${F(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}" ${_?`style='${_}'`:""}>${R}</div>`}function uQ(Q){let{items:Y,selectable:Z=!1,multiSelect:X=!1,emptyMessage:$="No items",id:G=z("list"),className:K,style:q}=Q,J=O("stx-list-view",Z&&"stx-list-view--selectable",X&&"stx-list-view--multi",K),E=V(q);if(Y.length===0)return`<div id="${G}" class="${J}" ${E?`style="${E}"`:""}>
|
|
56
|
+
<div class="stx-list-view-empty">${F($)}</div>
|
|
57
|
+
</div>`;let U='<ul class="stx-list-view-items">';for(let _ of Y){let R=O("stx-list-view-item",_.selected&&"stx-list-view-item--selected");U+=`<li class="${R}" data-id="${F(_.id)}" ${Z?'tabindex="0"':""}>${_.content}</li>`}return U+="</ul>",`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function yQ(Q){let{columns:Y,data:Z,striped:X=!1,bordered:$=!1,hoverable:G=!0,sortBy:K,sortOrder:q,id:J=z("table"),className:E,style:U}=Q,_=O("stx-table",X&&"stx-table--striped",$&&"stx-table--bordered",G&&"stx-table--hoverable",E),R=V(U),B="<table>";B+="<thead><tr>";for(let j of Y){let T=j.key===K?`stx-table-sorted stx-table-sorted--${q}`:"",L=j.sortable?'data-sortable="true"':"",w=j.width?`style="width: ${j.width}"`:"";B+=`<th class="${T}" ${L} ${w} data-key="${F(j.key)}">${F(j.label)}${j.sortable?'<span class="stx-table-sort-icon"></span>':""}</th>`}B+="</tr></thead>",B+="<tbody>";for(let j of Z){B+="<tr>";for(let M of Y){let T=j[M.key];B+=`<td>${T!=null?F(String(T)):""}</td>`}B+="</tr>"}return B+="</tbody></table>",`<div id="${J}" class="${_}" ${R?`style='${R}'`:""}>${B}</div>`}function p(Q,Y,Z,X){let $=Y.includes(Q.key),G=Z.includes(Q.key),K=Q.children&&Q.children.length>0,J=`<div class="${O("stx-tree-node",G&&"stx-tree-node--selected",Q.disabled&&"stx-tree-node--disabled")}" data-key="${F(Q.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":""} ${Q.disabled?"disabled":""} />`;if(Q.icon)J+=`<span class="stx-tree-icon">${Q.icon}</span>`;if(J+=`<span class="stx-tree-label">${F(Q.label)}</span>`,J+="</div>",K&&$){J+='<div class="stx-tree-children">';for(let E of Q.children)J+=p(E,Y,Z,X);J+="</div>"}return J+="</div>",J}function hQ(Q){let{nodes:Y,expandedKeys:Z=[],selectedKeys:X=[],checkable:$=!1,id:G=z("tree"),className:K,style:q}=Q,J=O("stx-tree-view",$&&"stx-tree-view--checkable",K),E=V(q),U="";for(let _ of Y)U+=p(_,Z,X,$);return`<div id="${G}" class="${J}" role="tree" ${E?`style='${E}'`:""}>${U}</div>`}function mQ(Q){let{columns:Y,data:Z,pagination:X,selectable:$=!1,id:G=z("datagrid"),className:K,style:q}=Q,J=O("stx-data-grid",$&&"stx-data-grid--selectable",K),E=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 _ of Y){let R=_.width?`style="width: ${_.width}"`:"";U+=`<th ${R}>
|
|
58
58
|
<div class="stx-data-grid-header-cell">
|
|
59
|
-
<span>${
|
|
59
|
+
<span>${F(_.label)}</span>
|
|
60
60
|
${_.sortable?'<button class="stx-data-grid-sort">\u21C5</button>':""}
|
|
61
61
|
${_.filterable?'<button class="stx-data-grid-filter">\u22BB</button>':""}
|
|
62
62
|
</div>
|
|
63
|
-
</th>`}U+="</tr></thead>",U+="<tbody>";for(let _ of Z){if(U+="<tr>",$)U+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of
|
|
63
|
+
</th>`}U+="</tr></thead>",U+="<tbody>";for(let _ of Z){if(U+="<tr>",$)U+='<td class="stx-data-grid-select"><input type="checkbox" /></td>';for(let R of Y){let B=_[R.key];U+=`<td>${B!=null?F(String(B)):""}</td>`}U+="</tr>"}if(U+="</tbody></table></div>",X){let _=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 ${_} (${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>=_?"disabled":""}>\u25B6</button>
|
|
68
68
|
</div>
|
|
69
|
-
</div>`}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function
|
|
69
|
+
</div>`}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${U}</div>`}function cQ(Q){let{type:Y,data:Z,options:X={},width:$="100%",height:G=300,id:K=z("chart"),className:q,style:J}=Q,E=O("stx-chart",`stx-chart--${Y}`,q),U={width:typeof $==="number"?`${$}px`:$,height:typeof G==="number"?`${G}px`:G},_=[V(U),V(J)].filter(Boolean).join("; "),R=JSON.stringify({type:Y,data:Z,options:X});return`<div id="${K}" class="${E}" style="${_}" data-chart='${F(R)}'>
|
|
70
70
|
<div class="stx-chart-placeholder">
|
|
71
|
-
${X.title?`<div class="stx-chart-title">${
|
|
72
|
-
<div class="stx-chart-type">${
|
|
71
|
+
${X.title?`<div class="stx-chart-title">${F(X.title)}</div>`:""}
|
|
72
|
+
<div class="stx-chart-type">${Y.charAt(0).toUpperCase()+Y.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
|
-
`),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-${
|
|
77
|
-
<td><span class="stx-file-explorer-icon">${
|
|
75
|
+
</div>`}function dQ(Q){let{value:Y="",language:Z="plaintext",theme:X="dark",lineNumbers:$=!0,readOnly:G=!1,height:K=300,tabSize:q=2,wordWrap:J=!1,id:E=z("code"),className:U,style:_}=Q,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),B={height:typeof K==="number"?`${K}px`:K},j=[V(B),V(_)].filter(Boolean).join("; "),M=Y.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-${F(Z)}">${F(Y)}</code></pre>`,`<div id="${E}" class="${R}" style="${j}" data-language="${F(Z)}" data-tab-size="${q}">${T}</div>`}function pQ(Q){let{src:Y,type:Z="video",poster:X,autoplay:$=!1,loop:G=!1,muted:K=!1,controls:q=!0,width:J,height:E,id:U=z("media"),className:_,style:R}=Q,B=O("stx-media-player",`stx-media-player--${Z}`,_),j={};if(J)j.width=typeof J==="number"?`${J}px`:J;if(E)j.height=typeof E==="number"?`${E}px`:E;let M=[V(j),V(R)].filter(Boolean).join("; "),T=[`id="${U}-media"`,`src="${F(Y)}"`,q&&"controls",$&&"autoplay",G&&"loop",K&&"muted",Z==="video"&&X&&`poster="${F(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="${B}" ${M?`style='${M}'`:""}>${L}</div>`}function rQ(Q){if(Q===void 0)return"";let Y=["B","KB","MB","GB"],Z=Q,X=0;while(Z>=1024&&X<Y.length-1)Z/=1024,X++;return`${Z.toFixed(1)} ${Y[X]}`}function nQ(Q){let{files:Y,viewMode:Z="list",showHidden:X=!1,selectable:$=!0,id:G=z("files"),className:K,style:q}=Q,J=O("stx-file-explorer",`stx-file-explorer--${Z}`,K),E=V(q),U=X?Y:Y.filter((R)=>!R.name.startsWith(".")),_="";if(Z==="list"){_='<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 B=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4"),j=R.type==="file"?rQ(R.size):"",M=R.modified?R.modified.toLocaleDateString():"";_+=`<tr class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(R.path)}" data-type="${R.type}">
|
|
77
|
+
<td><span class="stx-file-explorer-icon">${B}</span>${F(R.name)}</td>
|
|
78
78
|
<td>${j}</td>
|
|
79
79
|
<td>${M}</td>
|
|
80
|
-
</tr>`}_+="</tbody></table>"}else{_='<div class="stx-file-explorer-grid">';for(let R of U){let
|
|
81
|
-
<div class="stx-file-explorer-icon">${
|
|
82
|
-
<div class="stx-file-explorer-name">${
|
|
83
|
-
</div>`}_+="</div>"}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${_}</div>`}function
|
|
80
|
+
</tr>`}_+="</tbody></table>"}else{_='<div class="stx-file-explorer-grid">';for(let R of U){let B=R.icon||(R.type==="folder"?"\uD83D\uDCC1":"\uD83D\uDCC4");_+=`<div class="stx-file-explorer-item ${$?"stx-file-explorer-item--selectable":""}" data-path="${F(R.path)}" data-type="${R.type}">
|
|
81
|
+
<div class="stx-file-explorer-icon">${B}</div>
|
|
82
|
+
<div class="stx-file-explorer-name">${F(R.name)}</div>
|
|
83
|
+
</div>`}_+="</div>"}return`<div id="${G}" class="${J}" ${E?`style='${E}'`:""}>${_}</div>`}function oQ(Q){let{url:Y,width:Z="100%",height:X=400,sandbox:$=!0,allowScripts:G=!0,id:K=z("webview"),className:q,style:J}=Q,E=O("stx-webview",q),U={width:typeof Z==="number"?`${Z}px`:Z,height:typeof X==="number"?`${X}px`:X},_=[V(U),V(J)].filter(Boolean).join("; "),R=[];if($){if(R.push("allow-same-origin"),G)R.push("allow-scripts")}let B=$?`sandbox="${R.join(" ")}"`:"";return`<iframe id="${K}" class="${E}" src="${F(Y)}" style="${_}" ${B} loading="lazy" frameborder="0"></iframe>`}var lQ=["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"],aQ=`
|
|
84
84
|
/* Button */
|
|
85
85
|
.stx-button {
|
|
86
86
|
display: inline-flex;
|
|
@@ -437,7 +437,7 @@ 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
|
|
|
437
437
|
.stx-chip--warning { background: #3a2a1a; }
|
|
438
438
|
.stx-chip--error { background: #3a1a1a; }
|
|
439
439
|
}
|
|
440
|
-
`;import r from"process";function
|
|
440
|
+
`;import r from"process";function iQ(){if(r.platform)return r.platform;return"unknown"}function o(){if(typeof window<"u"&&window.craft?.tray)return!0;return!1}function l(Q,Y){if(Q.type==="separator")return{id:`sep-${Y}`,label:"",type:"separator"};let Z={id:`item-${Y}-${Q.label.replace(/\s+/g,"-").toLowerCase()}`,label:Q.label,type:Q.type||"normal",enabled:Q.enabled!==!1};if(Q.accelerator)Z.shortcut=Q.accelerator;if(Q.type==="checkbox")Z.checked=Q.checked||!1;if(Q.type==="submenu"&&Q.submenu)Z.submenu=Q.submenu.map((X,$)=>l(X,$));return Z}function b(Q){return Q.map((Y,Z)=>l(Y,Z))}function a(Q,Y=0){if(Q.type==="separator")return'<hr class="stx-tray-separator" />';let Z=" ".repeat(Y),X=Q.enabled===!1?"disabled":"",$=Q.checked?"\u2713 ":"",G=Q.accelerator?`<span class="accelerator">${Q.accelerator}</span>`:"",K=`${Z}<div class="stx-tray-item ${X}" data-action="${Q.label}">`;if(K+=`<span class="label">${$}${Q.label}</span>${G}`,Q.type==="submenu"&&Q.submenu){K+='<span class="arrow">\u25B8</span>',K+='<div class="stx-tray-submenu">';for(let q of Q.submenu)K+=a(q,Y+1);K+="</div>"}return K+="</div>",K}function sQ(Q){let Y='<div class="stx-tray-menu">';for(let Z of Q)Y+=a(Z);return Y+="</div>",Y}var A=new Map;function tQ(){return`tray-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}var n=!1;function eQ(){if(n||typeof window>"u")return;window.addEventListener("craft:tray:menu",(Q)=>{let{action:Y}=Q.detail;for(let Z of A.values()){let X=Z.handlers.get(Y);if(X){X();break}}}),n=!0}async function i(Q={}){let Y=tQ(),Z=iQ(),X=o(),$={icon:Q.icon||"",tooltip:Q.tooltip||"stx Application",menu:Q.menu||[],visible:!0},G=new Map;for(let q of Q.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(Y,{state:$,handlers:G}),X){eQ();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=b($.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: ${Y}`),console.log(`[stx-tray] Tooltip: ${$.tooltip}`),console.log(`[stx-tray] Menu items: ${$.menu.length}`);return{id:Y,setIcon:(q)=>{if($.icon=q,X)window.craft.tray.setIcon({icon:q}).catch((E)=>{console.warn("[stx-tray] Failed to set icon:",E)});console.log(`[stx-tray:${Y}] Icon updated`)},setTooltip:(q)=>{if($.tooltip=q,X)window.craft.tray.setTooltip({tooltip:q}).catch((E)=>{console.warn("[stx-tray] Failed to set tooltip:",E)});console.log(`[stx-tray:${Y}] 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 E of J.submenu)if(E.type!=="separator"&&E.onClick)G.set(E.label,E.onClick)}}if(X){let J=window,E=b(q);J.craft.tray.setMenu({items:E}).catch((U)=>{console.warn("[stx-tray] Failed to set menu:",U)})}console.log(`[stx-tray:${Y}] Menu updated (${q.length} items)`)},destroy:()=>{if($.visible=!1,A.delete(Y),X)window.craft.tray.destroy?.().catch((J)=>{console.warn("[stx-tray] Failed to destroy tray:",J)});console.log(`[stx-tray:${Y}] Destroyed`)}}}var QY=i;function YY(){return Array.from(A.keys())}function ZY(Q){let Y=A.get(Q);if(!Y)return null;let Z=o();return{id:Q,setIcon:(X)=>{if(Y.state.icon=X,Z)window.craft.tray.setIcon({icon:X}).catch(()=>{})},setTooltip:(X)=>{if(Y.state.tooltip=X,Z)window.craft.tray.setTooltip({tooltip:X}).catch(()=>{})},setMenu:(X)=>{if(Y.state.menu=X,Z){let $=window,G=b(X);$.craft.tray.setMenu({items:G}).catch(()=>{})}},destroy:()=>{if(A.delete(Q),Z)window.craft.tray.destroy?.().catch(()=>{})}}}function XY(Q,Y){let Z=A.get(Q);if(!Z)return!1;let X=Z.handlers.get(Y);if(X)return X(),!0;return!1}function $Y(Q){let Y=A.get(Q);if(!Y)return null;return sQ(Y.state.menu)}function JY(){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 GY=`
|
|
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 W from"process";import{existsSync as
|
|
519
|
+
`;import W from"process";import{existsSync as qY}from"fs";import{dirname as RY,join as KY}from"path";import{craftBinaryNotFoundMessage as s,resolveCraftBinary as UY}from"craft-native";var x={};function EY(Q){x={...x,...Q}}function _Y(){return{...x}}function FY(){x={}}function u(Q){if(!Q.sidebarConfig)return;let Y={...Q.sidebarConfig};if(Y.variant==="desktop")Y.material=Y.material??"sidebar",Y.backgroundEffect=Y.backgroundEffect??"shimmer",Y.allowsVibrancy=Y.allowsVibrancy??!0;return Y}function f(){let Q=RY(W.execPath),Y=Q.includes(".app/Contents/MacOS")?KY(Q,"craft"):void 0,Z=[W.env.CRAFT_BINARY_PATH,x.craftBinaryPath,...x.additionalSearchPaths||[],Y];for(let X of Z)if(X&&qY(X))return X;return UY()}var D=new Map;function y(Q){let Y=D.get(Q);if(!Y||Y.closed)return;Y.closed=!0;for(let Z of Y.closeListeners??[])try{Z()}catch(X){console.warn(`[stx/desktop] window ${Q} close listener threw:`,X)}Y.closeListeners?.clear()}var BY=50;async function h(Q,Y){let Z=Y.show().then(()=>({failed:!1}),($)=>({failed:!0,error:$})),X=await Promise.race([Z,new Promise(($)=>setTimeout(()=>$(null),BY))]);if(X?.failed)throw X.error;Z.then(()=>y(Q))}function jY(){return Array.from(D.keys())}function VY(Q){let Y=D.get(Q);if(!Y)return null;return S(Q,Y.app)}function OY(){for(let[Q,Y]of D)try{Y.app?.close?.()}catch(Z){console.warn(`Failed to close window ${Q}:`,Z)}D.clear()}function S(Q,Y){return{id:Q,show:()=>{console.log(`[stx/desktop] Window ${Q} shown`)},hide:()=>{console.log("[stx/desktop] To hide window, use window.craft.window.hide() from inside the webview")},close:()=>{let Z=D.get(Q);if(Z?.app)Z.app.close(),y(Q),D.delete(Q),console.log(`[stx/desktop] Window ${Q} closed`)},onClosed:(Z)=>{let X=D.get(Q);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 m(Q,Y={}){let Z=["--url",Q,"--title",Y.title||"stx Desktop","--width",String(Y.width??1200),"--height",String(Y.height??800)];if(Y.darkMode)Z.push("--dark");if(Y.hotReload)Z.push("--hot-reload");if(Y.resizable===!1)Z.push("--no-resize");if(Y.frameless)Z.push("--frameless");if(Y.alwaysOnTop)Z.push("--always-on-top");if(Y.titlebarHidden)Z.push("--titlebar-hidden");if(Y.systemTray)Z.push("--system-tray");if(Y.hideDockIcon)Z.push("--hide-dock-icon");if(Y.devTools===!1)Z.push("--no-devtools");if(Y.nativeSidebar)Z.push("--native-sidebar");if(Y.sidebarWidth!==void 0)Z.push("--sidebar-width",String(Y.sidebarWidth));let X=u(Y);if(X)Z.push("--sidebar-config",JSON.stringify(X));return Z}async function zY(Q,Y={}){let Z=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,X=f();try{let{createApp:$}=await import("craft-native"),G=$({url:Q,craftPath:X,window:{title:Y.title||"stx Desktop",width:Y.width??1200,height:Y.height??800,darkMode:Y.darkMode??!1,hotReload:Y.hotReload??!1,resizable:Y.resizable??!0,frameless:Y.frameless??!1,alwaysOnTop:Y.alwaysOnTop??!1,titlebarHidden:Y.titlebarHidden??!1,systemTray:Y.systemTray??!1,hideDockIcon:Y.hideDockIcon??!1,devTools:Y.devTools??!1,nativeSidebar:Y.nativeSidebar??!1,sidebarWidth:Y.sidebarWidth,sidebarConfig:u(Y)}});return D.set(Z,{app:G,url:Q,options:Y}),await h(Z,G),S(Z,G)}catch{try{let{spawn:$}=await import("child_process"),G=$(X,m(Q,Y),{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:Q,options:Y}),G.on("exit",()=>y(Z)),S(Z,K)}catch($){return console.error("Failed to spawn craft binary:",$.message),null}}}async function MY(Q,Y={}){let Z=`http://localhost:${Q}/`;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=!Y.nativeSidebar,K=u(Y),q=$({url:Z,craftPath:f(),window:{title:Y.title||"stx Development",width:Y.width||1400,height:Y.height||900,resizable:!0,systemTray:G,darkMode:Y.darkMode??!0,hotReload:Y.hotReload??!0,devTools:!0,titlebarHidden:Y.titlebarHidden??!1,nativeSidebar:Y.nativeSidebar??!1,sidebarWidth:Y.sidebarWidth??260,sidebarConfig:K}}),J=`dev-window-${Q}`;return D.set(J,{app:q,url:Z,options:Y}),await h(J,q),console.log(`\u2713 Native window opened at ${Z}`),!0}catch{let $=f();try{console.log(`\u26A1 Opening native window via craft binary (${$})\u2026`);let{spawn:G}=await import("child_process"),K=G($,m(Z,{title:"stx Development",width:1400,height:900,hotReload:!0,...Y}),{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-${Q}`;return D.set(q,{app:{close:()=>K.kill()},url:Z,options:Y}),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 TY(Q,Y={}){let{title:Z="stx Desktop",width:X=1200,height:$=800,darkMode:G=!1,hotReload:K=!1,resizable:q=!0,frameless:J=!1,alwaysOnTop:E=!1}=Y;try{let{createApp:U}=await import("craft-native"),_=f(),R=U({html:Q,craftPath:_,window:{title:Z,width:X,height:$,darkMode:G,hotReload:K,resizable:q,frameless:J,alwaysOnTop:E}}),B=`craft-window-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;return D.set(B,{app:R,url:"html-content",options:Y}),await h(B,R),S(B,R)}catch(U){return console.error("Failed to create window with HTML:",U),null}}function LY(){try{return N.resolve("craft-native"),!0}catch{return!1}}function DY(){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 PY,packageApp as WY}from"craft-native";import{craftBinaryNotFoundMessage as AY,resolveCraftBinary as NY}from"craft-native";import{AutoUpdater as t,generateUpdateManifest as e}from"craft-native";var QQ="update.json";function YQ(Q,Y){return`https://github.com/${Q}/releases/latest/download/${Y}`}function ZQ(Q,Y,Z){return`https://github.com/${Q}/releases/download/${Y}/${Z}`}function xY(Q){let{repository:Y,manifestAsset:Z=QQ,...X}=Q;return new t({...X,updateUrl:YQ(Y,Z)})}function IY(Q){let Y=Q.tag??`v${Q.version}`,Z={};for(let[X,$]of Object.entries(Q.artifacts)){if(!$)continue;Z[X]={path:$,url:ZQ(Q.repository,Y,$.split("/").pop())}}return e({version:Q.version,releaseNotes:Q.releaseNotes,platforms:Z})}import{existsSync as c,mkdirSync as kY,readFileSync as CY,watch as HY,writeFileSync as vY}from"fs";import{homedir as wY,platform as fY}from"os";import{dirname as SY,join as v}from"path";function gY(Q){let Y=fY(),Z=wY();switch(Y){case"darwin":return v(Z,"Library","Application Support",Q);case"win32":return v(process.env.APPDATA||v(Z,"AppData","Roaming"),Q);default:return v(Z,".config",Q)}}class XQ{_defaults;_data;_path;_changeHandlers=new Map;_anyChangeHandlers=new Set;_watcher=null;_writeTimer=null;_writing=!1;constructor(Q){this._defaults={...Q.defaults};let Y=Q.path?SY(Q.path):gY(Q.name);if(this._path=Q.path||v(Y,"preferences.json"),!c(Y))kY(Y,{recursive:!0});if(this._data=this._load(),Q.watch!==!1)this._setupWatcher()}get path(){return this._path}get(Q){if(Q in this._data)return this._data[Q];return this._defaults[Q]}set(Q,Y){let Z=this.get(Q);if(JSON.stringify(Z)===JSON.stringify(Y))return;this._data[Q]=Y,this._scheduleSave(),this._notifyChange(Q,Y,Z)}getAll(){return{...this._defaults,...this._data}}has(Q){return Q in this._data}delete(Q){if(!(Q in this._data))return;let Y=this._data[Q];delete this._data[Q],this._scheduleSave(),this._notifyChange(Q,this._defaults[Q],Y)}reset(){let Q={...this._data};this._data={},this._save();for(let Y of Object.keys(Q)){let Z=this._defaults[Y];this._notifyChange(Y,Z,Q[Y])}}onChange(Q,Y){let Z=Q;if(!this._changeHandlers.has(Z))this._changeHandlers.set(Z,new Set);return this._changeHandlers.get(Z).add(Y),()=>{this._changeHandlers.get(Z)?.delete(Y)}}onAnyChange(Q){return this._anyChangeHandlers.add(Q),()=>{this._anyChangeHandlers.delete(Q)}}close(){if(this._watcher)this._watcher.close(),this._watcher=null;if(this._writeTimer)clearTimeout(this._writeTimer),this._writeTimer=null,this._save()}_load(){try{if(c(this._path)){let Q=CY(this._path,"utf-8");return JSON.parse(Q)}}catch{}return{}}_save(){this._writing=!0;try{let Q=JSON.stringify({...this._defaults,...this._data},null,2);vY(this._path,Q,"utf-8")}catch(Q){console.error(`Failed to save preferences to ${this._path}:`,Q)}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(!c(this._path))this._save();this._watcher=HY(this._path,()=>{if(this._writing)return;let Q=this._load(),Y={...this._data};this._data=Q;let Z=new Set([...Object.keys(Y),...Object.keys(Q)]);for(let X of Z){let $=X in Y?Y[X]:this._defaults[X],G=X in Q?Q[X]:this._defaults[X];if(JSON.stringify($)!==JSON.stringify(G))this._notifyChange(X,G,$)}})}catch{}}_notifyChange(Q,Y,Z){let X=this._changeHandlers.get(Q);if(X)for(let $ of X)try{$(Y,Z)}catch{}for(let $ of this._anyChangeHandlers)try{$(Q,Y,Z)}catch{}}}function bY(Q){return new XQ(Q)}import{existsSync as I,mkdirSync as $Q,readFileSync as uY,unlinkSync as JQ,writeFileSync as GQ}from"fs";import{homedir as g,platform as qQ}from"os";import{join as k}from"path";function RQ(Q){let Y=Q.toLowerCase().replace(/[^a-z0-9]/g,"-");return k(g(),"Library","LaunchAgents",`com.${Y}.plist`)}function KQ(Q){let Y=process.env.XDG_CONFIG_HOME||k(g(),".config");return k(Y,"autostart",`${Q.toLowerCase()}.desktop`)}async function yY(Q,Y){let Z=Y.appName||"StxApp",X=RQ(Z),$=k(g(),"Library","LaunchAgents");if(Q){let G=Y.appPath||process.execPath,K=Y.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,22 +565,22 @@ 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((E)=>` <string>${
|
|
568
|
+
${q.map((E)=>` <string>${dY(E)}</string>`).join(`
|
|
569
569
|
`)}
|
|
570
570
|
</array>
|
|
571
571
|
<key>RunAtLoad</key>
|
|
572
572
|
<true/>
|
|
573
573
|
<key>KeepAlive</key>
|
|
574
574
|
<false/>
|
|
575
|
-
${
|
|
575
|
+
${Y.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 hY(Q,Y){let Z=Y.appName||"StxApp",X=KQ(Z),$=k(process.env.XDG_CONFIG_HOME||k(g(),".config"),"autostart");if(Q){let G=Y.appPath||process.execPath,K=Y.args||[],q=[G,...K].join(" "),J=`[Desktop Entry]
|
|
579
579
|
Type=Application
|
|
580
580
|
Name=${Z}
|
|
581
581
|
Exec=${q}
|
|
582
582
|
Terminal=false
|
|
583
583
|
StartupNotify=false
|
|
584
|
-
${
|
|
584
|
+
${Y.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 mY(Q){return I(RQ(Q))}async function cY(Q){let Y=KQ(Q);if(!I(Y))return!1;try{let Z=uY(Y,"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 dY(Q){return Q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}async function pY(Q,Y={}){let Z=qQ();switch(Z){case"darwin":return yY(Q,Y);case"linux":return hY(Q,Y);default:throw Error(`Auto-launch is not yet supported on ${Z}`)}}async function rY(Q){let Y=Q||"StxApp";switch(qQ()){case"darwin":return mY(Y);case"linux":return cY(Y);default:return!1}}function EQ(Q){if(Q.separator)return{id:Q.id||"",title:"",type:"separator"};return{id:Q.id||"",title:Q.title||"",icon:Q.icon,shortcut:Q.shortcut,enabled:Q.disabled?!1:void 0,submenu:Q.submenu?.map(EQ)}}var nY={available(){return C("nativeUI")},async show(Q){if(!Q.items||Q.items.length===0)throw Error("contextMenu.show requires at least one item");if(!C("nativeUI"))return!1;return await window.craft.nativeUI.showContextMenu({targetId:Q.targetId||"",targetType:"general",x:Math.round(Q.x),y:Math.round(Q.y),items:Q.items.map(EQ)}),!0},onAction(Q){return UQ("craft:menu:action",Q)}};var oY={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 Q=new Intl.DateTimeFormat([],{hour:"numeric"}).resolvedOptions();return Q.hourCycle==="h23"||Q.hourCycle==="h24"}catch{return!1}}),reduceMotion:()=>P("system","reduceMotion",()=>d("(prefers-reduced-motion: reduce)")),reduceTransparency:()=>P("system","reduceTransparency",()=>d("(prefers-reduced-transparency: reduce)")),increaseContrast:()=>P("system","increaseContrast",()=>d("(prefers-contrast: more)")),systemVersion:()=>P("system","systemVersion",()=>""),hostname:()=>P("system","hostname",()=>""),username:()=>P("system","username",()=>""),async openPreferences(){if(C("system"))await window.craft.system.openPreferences()}};async function P(Q,Y,Z){if(C(Q))return await window.craft[Q][Y]();return await Z()}function d(Q){if(typeof window>"u"||!window.matchMedia)return!1;return window.matchMedia(Q).matches}export{Z0 as windowEvents,A0 as watchScreenSharing,h0 as vision,Y0 as updater,gZ as unregisterHotkey,bZ as unregisterAllHotkeys,XY as triggerTrayAction,U0 as touchbar,aZ as theme,f0 as tags,oY as system,u0 as spotlight,y0 as speechRecognition,_0 as speech,j0 as signPayload,eY as showWarningToast,RZ as showWarningModal,AZ as showWarningDialog,iY as showToast,tY as showSuccessToast,UZ as showSuccessModal,MZ as showSaveDialog,EZ as showQuestionModal,zZ as showOpenDialog,GZ as showModal,TZ as showMessageBox,sY as showInfoToast,qZ as showInfoModal,QZ as showErrorToast,KZ as showErrorModal,WZ as showErrorDialog,PZ as showConfirmDialog,LZ as showColorPicker,DZ as showAlertDialog,aY as showAlert,oZ as shell,EY as setDesktopConfig,pY as setAutoLaunch,p0 as serviceMenu,r0 as serial,W0 as screenSharing,T0 as screenCapture,J0 as screen,NY as resolveCraftBinary,FY as resetDesktopConfig,lY as requestNotificationPermission,SZ as registerHotkey,B0 as redactPII,BZ as prompt,R0 as printing,q0 as permissions,S0 as pdf,wZ as parseShortcut,WY as packageApp,PY as pack,MY as openDevWindow,YZ as notify,rZ as notifications,Q0 as network,K0 as nativeAutoLaunch,m0 as midi,$0 as menu,g0 as log,M0 as location,k0 as localServer,z0 as liveActivities,G0 as keychain,LY as isWebviewAvailable,sZ as isDragOutAvailable,kZ as isCaffeinated,l0 as isAvailable,rY as isAutoLaunchEnabled,V0 as iap,x0 as hasFocusShortcuts,O0 as handoff,lZ as globalShortcuts,ZQ as githubReleaseAssetUrl,YQ as githubLatestAssetUrl,DY as getWindowBridgeScript,VY as getWindow,ZY as getTrayInstance,JY as getTrayBridgeScript,$Y as getSimulatedTrayHTML,uZ as getRegisteredHotkeys,NZ as getDialogBridgeScript,_Y as getDesktopConfig,o0 as getCapability,n0 as getCapabilities,CZ as getCaffeinateStatus,jY as getActiveWindowIds,YY as getActiveTrayInstances,jZ as getActiveModalCount,$Z as getActiveAlertCount,e as generateUpdateManifest,nZ as fs,cZ as formatTime,fZ as formatShortcut,HZ as formatRemainingTime,vZ as formatDuration,dZ as formatCompact,I0 as focusShortcutsReady,N0 as focus,w0 as fileAssociations,iZ as dragOut,XZ as dismissAllAlerts,ZZ as dismissAlertById,mZ as delay,tZ as deepLinks,IZ as decaffeinate,TY as createWindowWithHTML,zY as createWindow,oQ as createWebView,hQ as createTreeView,vQ as createTooltip,yZ as createTimer,xQ as createTimePicker,BQ as createTextInput,LQ as createTabs,yQ as createTable,i as createSystemTray,gQ as createStepper,fQ as createSplitView,VQ as createSlider,wQ as createScrollView,PQ as createRating,WQ as createRadioButton,OQ as createProgressBar,bY as createPreferences,bQ as createModalComponent,QY as createMenubar,pQ as createMediaPlayer,uQ as createListView,kQ as createLabel,hZ as createInterval,CQ as createImageView,xY as createGitHubUpdater,IY as createGitHubUpdateManifest,nQ as createFileExplorer,DQ as createDropdown,NQ as createDatePicker,mQ as createDataGrid,AQ as createColorPicker,dQ as createCodeEditor,HQ as createChip,jQ as createCheckbox,cQ as createChart,TQ as createCard,FQ as createButton,zQ as createBadge,MQ as createAvatar,IQ as createAutocomplete,SQ as createAccordion,F0 as crashReporter,m as craftWindowArguments,AY as craftBinaryNotFoundMessage,c0 as coreml,d0 as continuityCamera,nY as contextMenu,_Z as confirm,OY as closeAllWindows,VZ as closeAllModals,pZ as clipboard,xZ as caffeinate,b0 as bonjour,E0 as bluetooth,C0 as biometric,eZ as battery,H0 as audio,v0 as appleScript,X0 as appInfo,FZ as alert,QQ as UPDATE_MANIFEST_ASSET,GY as TRAY_MENU_STYLES,JZ as TOAST_STYLES,OZ as MODAL_STYLES,L0 as MIN_WATCH_INTERVAL_MS,D0 as MAX_WATCH_INTERVAL_MS,P0 as DEFAULT_WATCH_INTERVAL_MS,aQ as COMPONENT_STYLES,t as AutoUpdater,lQ as AVAILABLE_COMPONENTS};
|
package/dist/test-utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-de1sp3q7.js";O();function O(){if(typeof window>"u")return;let A=window;if(typeof A.addEventListener==="function"&&typeof A.dispatchEvent==="function")return;let B=new Map;A.addEventListener=(j,q)=>{let D=B.get(j);if(!D)D=new Set,B.set(j,D);D.add(q)},A.removeEventListener=(j,q)=>{B.get(j)?.delete(q)},A.dispatchEvent=(j)=>{let q=B.get(j.type);if(q)for(let D of q)try{D(j)}catch{}return!0}}function P(A=[]){let B=[],j=new Map,q=window.craft,D=q&&q.__craft_bridge_loaded?void 0:q;function I(x,z){return(...C)=>{B.push({ns:x,method:z,args:C});let F=`${x}:${z}`;if(j.has(F)){let G=j.get(F),L=typeof G==="function"?G(...C):G;return Promise.resolve(L)}return Promise.resolve(void 0)}}function J(x){return new Proxy({},{get(z,C){if(typeof C!=="string")return;if(j.has(`${x}:${C}`)){let F=j.get(`${x}:${C}`);if(typeof F==="function"&&F.length===0)return()=>{return B.push({ns:x,method:C,args:[]}),F()}}return I(x,C)}})}let K=new Proxy({},{get(x,z){if(typeof z!=="string")return;return J(z)},has(x,z){if(typeof z!=="string")return!1;if(A.length===0)return!0;return A.includes(z)}});return window.craft=K,{calls:B,whenCalled(x,z,C){j.set(`${x}:${z}`,C)},uninstall(){if(D===void 0)delete window.craft;else window.craft=D}}}function Q(A,B,j){return A.find((q)=>q.ns===B&&q.method===j)}export{P as installMockBridge,Q as findCall};
|
package/package.json
CHANGED