@stacksjs/desktop 0.2.3

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.
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Show a native file open dialog
3
+ *
4
+ * When running in Craft, uses the native OS file picker.
5
+ * In browser, falls back to HTML file input.
6
+ *
7
+ * @param options - Dialog options
8
+ * @returns Promise resolving to selected files or cancellation
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const result = await showOpenDialog({
13
+ * title: 'Select an image',
14
+ * filters: [{ name: 'Images', extensions: ['png', 'jpg', 'gif'] }],
15
+ * multiSelections: true,
16
+ * })
17
+ *
18
+ * if (!result.canceled) {
19
+ * console.log('Selected:', result.filePaths)
20
+ * }
21
+ * ```
22
+ */
23
+ export declare function showOpenDialog(options?: OpenDialogOptions): Promise<OpenDialogResult>;
24
+ /**
25
+ * Show a native file save dialog
26
+ *
27
+ * When running in Craft, uses the native OS save dialog.
28
+ * In browser, this is limited to triggering downloads.
29
+ *
30
+ * @param options - Dialog options
31
+ * @returns Promise resolving to selected path or cancellation
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const result = await showSaveDialog({
36
+ * title: 'Save document',
37
+ * defaultPath: 'document.txt',
38
+ * filters: [{ name: 'Text Files', extensions: ['txt'] }],
39
+ * })
40
+ *
41
+ * if (!result.canceled && result.filePath) {
42
+ * console.log('Save to:', result.filePath)
43
+ * }
44
+ * ```
45
+ */
46
+ export declare function showSaveDialog(options?: SaveDialogOptions): Promise<SaveDialogResult>;
47
+ /**
48
+ * Show a native message box dialog
49
+ *
50
+ * When running in Craft, uses the native OS message box.
51
+ * In browser, falls back to confirm/alert dialogs.
52
+ *
53
+ * @param options - Message box options
54
+ * @returns Promise resolving to button index clicked
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const result = await showMessageBox({
59
+ * type: 'question',
60
+ * title: 'Confirm',
61
+ * message: 'Are you sure you want to delete this file?',
62
+ * buttons: ['Cancel', 'Delete'],
63
+ * defaultButton: 0,
64
+ * cancelButton: 0,
65
+ * })
66
+ *
67
+ * if (result.response === 1) {
68
+ * // User clicked "Delete"
69
+ * }
70
+ * ```
71
+ */
72
+ export declare function showMessageBox(options: MessageBoxOptions): Promise<MessageBoxResult>;
73
+ /**
74
+ * Show a native color picker dialog
75
+ *
76
+ * @param options - Color picker options
77
+ * @returns Promise resolving to selected color or cancellation
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const result = await showColorPicker({
82
+ * color: '#ff0000',
83
+ * showAlpha: true,
84
+ * })
85
+ *
86
+ * if (!result.canceled && result.color) {
87
+ * document.body.style.backgroundColor = result.color
88
+ * }
89
+ * ```
90
+ */
91
+ export declare function showColorPicker(options?: ColorPickerOptions): Promise<ColorPickerResult>;
92
+ /**
93
+ * Show a simple alert message dialog (native)
94
+ *
95
+ * @param message - Message to display
96
+ * @param title - Optional dialog title
97
+ */
98
+ export declare function showAlertDialog(message: string, title?: string): Promise<void>;
99
+ /**
100
+ * Show a confirmation dialog (native)
101
+ *
102
+ * @param message - Message to display
103
+ * @param title - Optional dialog title
104
+ * @returns True if confirmed, false if cancelled
105
+ */
106
+ export declare function showConfirmDialog(message: string, title?: string): Promise<boolean>;
107
+ /**
108
+ * Show an error dialog (native)
109
+ *
110
+ * @param message - Error message
111
+ * @param title - Optional dialog title
112
+ */
113
+ export declare function showErrorDialog(message: string, title?: string): Promise<void>;
114
+ /**
115
+ * Show a warning dialog (native)
116
+ *
117
+ * @param message - Warning message
118
+ * @param title - Optional dialog title
119
+ */
120
+ export declare function showWarningDialog(message: string, title?: string): Promise<void>;
121
+ /**
122
+ * Generate a JavaScript snippet for dialog control from inside a webview.
123
+ * This provides convenient wrappers around the Craft dialog bridge.
124
+ */
125
+ export declare function getDialogBridgeScript(): string;
126
+ /**
127
+ * Native Dialog Integration
128
+ *
129
+ * Provides native file dialogs, message boxes, and other system dialogs
130
+ * using Craft's Dialog Bridge APIs.
131
+ *
132
+ * When running inside a Craft native window, these dialogs use the native
133
+ * OS dialogs (NSOpenPanel on macOS, etc.). When running in a browser,
134
+ * they fall back to web alternatives where possible.
135
+ */
136
+ /**
137
+ * Options for opening a file dialog
138
+ */
139
+ export declare interface OpenDialogOptions {
140
+ title?: string
141
+ defaultPath?: string
142
+ buttonLabel?: string
143
+ filters?: FileFilter[]
144
+ multiSelections?: boolean
145
+ showHiddenFiles?: boolean
146
+ canChooseDirectories?: boolean
147
+ canChooseFiles?: boolean
148
+ canCreateDirectories?: boolean
149
+ }
150
+ /**
151
+ * Options for saving a file dialog
152
+ */
153
+ export declare interface SaveDialogOptions {
154
+ title?: string
155
+ defaultPath?: string
156
+ buttonLabel?: string
157
+ filters?: FileFilter[]
158
+ showHiddenFiles?: boolean
159
+ canCreateDirectories?: boolean
160
+ }
161
+ /**
162
+ * File type filter
163
+ */
164
+ export declare interface FileFilter {
165
+ name: string
166
+ extensions: string[]
167
+ }
168
+ /**
169
+ * Result from open dialog
170
+ */
171
+ export declare interface OpenDialogResult {
172
+ canceled: boolean
173
+ filePaths: string[]
174
+ }
175
+ /**
176
+ * Result from save dialog
177
+ */
178
+ export declare interface SaveDialogResult {
179
+ canceled: boolean
180
+ filePath?: string
181
+ }
182
+ /**
183
+ * Options for message box dialog
184
+ */
185
+ export declare interface MessageBoxOptions {
186
+ type?: 'none' | 'info' | 'warning' | 'error' | 'question'
187
+ title?: string
188
+ message: string
189
+ detail?: string
190
+ buttons?: string[]
191
+ defaultButton?: number
192
+ cancelButton?: number
193
+ }
194
+ /**
195
+ * Result from message box
196
+ */
197
+ export declare interface MessageBoxResult {
198
+ response: number
199
+ }
200
+ /**
201
+ * Options for color picker dialog
202
+ */
203
+ export declare interface ColorPickerOptions {
204
+ color?: string
205
+ showAlpha?: boolean
206
+ }
207
+ /**
208
+ * Result from color picker
209
+ */
210
+ export declare interface ColorPickerResult {
211
+ canceled: boolean
212
+ color?: string
213
+ }
@@ -0,0 +1,183 @@
1
+ export type {
2
+ AccordionProps,
3
+ AutocompleteProps,
4
+ AvatarProps,
5
+ BadgeProps,
6
+ // Input Props
7
+ ButtonProps,
8
+ CardProps,
9
+ ChartData,
10
+ ChartOptions,
11
+ ChartProps,
12
+ CheckboxProps,
13
+ ChipProps,
14
+ CodeEditorProps,
15
+ ColorPickerProps,
16
+ ComponentName,
17
+ DataGridProps,
18
+ DatePickerProps,
19
+ DropdownProps,
20
+ FileExplorerProps,
21
+ FileNode,
22
+ ImageViewProps,
23
+ // Display Props
24
+ LabelProps,
25
+ // Data Props
26
+ ListViewProps,
27
+ MediaPlayerProps,
28
+ ModalComponentProps,
29
+ ProgressBarProps,
30
+ RadioButtonProps,
31
+ // Advanced Props
32
+ RatingProps,
33
+ // Layout Props
34
+ ScrollViewProps,
35
+ SliderProps,
36
+ SplitViewProps,
37
+ StepperProps,
38
+ TableProps,
39
+ TabsProps,
40
+ TextInputProps,
41
+ TimePickerProps,
42
+ TooltipProps,
43
+ TreeNode,
44
+ TreeViewProps,
45
+ WebViewProps,
46
+ } from './components';
47
+ export type {
48
+ ColorPickerOptions,
49
+ ColorPickerResult,
50
+ FileFilter,
51
+ MessageBoxOptions,
52
+ MessageBoxResult,
53
+ OpenDialogOptions,
54
+ OpenDialogResult,
55
+ SaveDialogOptions,
56
+ SaveDialogResult,
57
+ } from './dialogs';
58
+ export type {
59
+ AlertOptions,
60
+ ComponentProps,
61
+ ModalButton,
62
+ ModalOptions,
63
+ ModalResult,
64
+ SidebarConfig,
65
+ SystemTrayInstance,
66
+ SystemTrayMenuItem,
67
+ SystemTrayOptions,
68
+ ToastOptions,
69
+ WindowInstance,
70
+ WindowOptions,
71
+ } from './types';
72
+ export type { DesktopConfig } from './window';
73
+ export {
74
+ dismissAlertById,
75
+ dismissAllAlerts,
76
+ getActiveAlertCount,
77
+ notify,
78
+ requestNotificationPermission,
79
+ showAlert,
80
+ showErrorToast,
81
+ showInfoToast,
82
+ showSuccessToast,
83
+ showToast,
84
+ showWarningToast,
85
+ TOAST_STYLES,
86
+ } from './alerts';
87
+ export {
88
+ // Component list and styles
89
+ AVAILABLE_COMPONENTS,
90
+ COMPONENT_STYLES,
91
+ createAccordion,
92
+ createAutocomplete,
93
+ createAvatar,
94
+ createBadge,
95
+ // Input Components
96
+ createButton,
97
+ createCard,
98
+ createChart,
99
+
100
+ createCheckbox,
101
+ createChip,
102
+ createCodeEditor,
103
+ createColorPicker,
104
+ createDataGrid,
105
+ createDatePicker,
106
+ createDropdown,
107
+ createFileExplorer,
108
+
109
+ createImageView,
110
+ // Display Components
111
+ createLabel,
112
+ // Data Components
113
+ createListView,
114
+ createMediaPlayer,
115
+ createModalComponent,
116
+ createProgressBar,
117
+ createRadioButton,
118
+
119
+ // Advanced Components
120
+ createRating,
121
+ // Layout Components
122
+ createScrollView,
123
+ createSlider,
124
+ createSplitView,
125
+ createStepper,
126
+
127
+ createTable,
128
+ createTabs,
129
+ createTextInput,
130
+ createTimePicker,
131
+ createTooltip,
132
+
133
+ createTreeView,
134
+ createWebView,
135
+ } from './components';
136
+ export {
137
+ alert,
138
+ closeAllModals,
139
+ confirm,
140
+ getActiveModalCount,
141
+ MODAL_STYLES,
142
+ prompt,
143
+ showErrorModal,
144
+ showInfoModal,
145
+ showModal,
146
+ showQuestionModal,
147
+ showSuccessModal,
148
+ showWarningModal,
149
+ } from './modals';
150
+ export {
151
+ createMenubar,
152
+ createSystemTray,
153
+ getActiveTrayInstances,
154
+ getSimulatedTrayHTML,
155
+ getTrayBridgeScript,
156
+ getTrayInstance,
157
+ TRAY_MENU_STYLES,
158
+ triggerTrayAction,
159
+ } from './system-tray';
160
+ export {
161
+ getDialogBridgeScript,
162
+ showAlertDialog,
163
+ showColorPicker,
164
+ showConfirmDialog,
165
+ showErrorDialog,
166
+ showMessageBox,
167
+ showOpenDialog,
168
+ showSaveDialog,
169
+ showWarningDialog,
170
+ } from './dialogs';
171
+ export {
172
+ closeAllWindows,
173
+ createWindow,
174
+ createWindowWithHTML,
175
+ getActiveWindowIds,
176
+ getDesktopConfig,
177
+ getWindow,
178
+ getWindowBridgeScript,
179
+ isWebviewAvailable,
180
+ openDevWindow,
181
+ resetDesktopConfig,
182
+ setDesktopConfig,
183
+ } from './window';