@stacksjs/stx 0.2.11 → 0.2.13

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/stx.d.ts CHANGED
@@ -301,6 +301,66 @@ declare function $watch<T>(
301
301
  options?: { immediate?: boolean, deep?: boolean },
302
302
  ): StxCleanup
303
303
 
304
+ // ============================================================================
305
+ // Toast notifications
306
+ // ============================================================================
307
+
308
+ interface StxToastOptions {
309
+ /** Auto-dismiss duration in ms. 0 = persistent. Default: 3000 */
310
+ duration?: number
311
+ }
312
+
313
+ interface StxToast {
314
+ /** Show a success toast (green) */
315
+ success: (message: string, options?: StxToastOptions) => number
316
+ /** Show an error toast (red) */
317
+ error: (message: string, options?: StxToastOptions) => number
318
+ /** Show an info toast (blue) */
319
+ info: (message: string, options?: StxToastOptions) => number
320
+ /** Show a warning toast (yellow) */
321
+ warning: (message: string, options?: StxToastOptions) => number
322
+ /** Dismiss a toast by id, or all toasts if no id is given */
323
+ dismiss: (id?: number) => void
324
+ }
325
+
326
+ declare const toast: StxToast
327
+
328
+ // ============================================================================
329
+ // Modal system
330
+ // ============================================================================
331
+
332
+ interface StxModal {
333
+ /** Open a modal by its id */
334
+ open: (id: string) => void
335
+ /** Close a modal by its id */
336
+ close: (id: string) => void
337
+ /** Toggle a modal by its id */
338
+ toggle: (id: string) => void
339
+ }
340
+
341
+ declare const modal: StxModal
342
+
343
+ // ============================================================================
344
+ // Alert & Confirm dialogs
345
+ // ============================================================================
346
+
347
+ interface StxDialogOptions {
348
+ /** Dialog title displayed above the message */
349
+ title?: string
350
+ /** Icon type: 'info' | 'warning' | 'error' | 'success' | 'question' */
351
+ type?: 'info' | 'warning' | 'error' | 'success' | 'question'
352
+ /** Text for the confirm/OK button (default: 'OK') */
353
+ confirmText?: string
354
+ /** Text for the cancel button — confirm only (default: 'Cancel') */
355
+ cancelText?: string
356
+ }
357
+
358
+ /** Styled replacement for window.alert(). Returns a Promise that resolves when dismissed. */
359
+ declare function stxAlert(message: string, options?: StxDialogOptions): Promise<void>
360
+
361
+ /** Styled replacement for window.confirm(). Returns a Promise<boolean>. */
362
+ declare function stxConfirm(message: string, options?: StxDialogOptions): Promise<boolean>
363
+
304
364
  // ============================================================================
305
365
  // Stores (Pinia-inspired, signals-based)
306
366
  // ============================================================================
@@ -412,6 +472,16 @@ interface StxRuntimeRegistry {
412
472
  defineStore: typeof defineStore
413
473
  useStore: typeof useStore
414
474
 
475
+ // Toast
476
+ toast: StxToast
477
+
478
+ // Modal
479
+ modal: StxModal
480
+
481
+ // Dialogs
482
+ alert: typeof stxAlert
483
+ confirm: typeof stxConfirm
484
+
415
485
  // Mount API
416
486
  mount: (setupFn: () => any) => void
417
487
  mountEl: (selector: string, setupFn: () => any) => void
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.11",
4
+ "version": "0.2.13",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -61,12 +61,12 @@
61
61
  "import": "./dist/bundle-analyzer.js"
62
62
  },
63
63
  "./composables": {
64
- "bun": "./src/composables/index.ts",
64
+ "bun": "./dist/composables/index.js",
65
65
  "types": "./dist/composables/index.d.ts",
66
66
  "import": "./dist/composables/index.js"
67
67
  },
68
68
  "./composables/*": {
69
- "bun": "./src/composables/*.ts",
69
+ "bun": "./dist/composables/*.js",
70
70
  "types": "./dist/composables/*.d.ts",
71
71
  "import": "./dist/composables/*.js"
72
72
  },
@@ -74,59 +74,6 @@
74
74
  "import": "./dist/*"
75
75
  }
76
76
  },
77
- "publishConfig": {
78
- "exports": {
79
- ".": {
80
- "types": "./dist/index.d.ts",
81
- "import": "./dist/index.js"
82
- },
83
- "./jsx-runtime": {
84
- "types": "./dist/jsx-runtime.d.ts",
85
- "import": "./dist/jsx-runtime.js"
86
- },
87
- "./jsx-dev-runtime": {
88
- "types": "./dist/jsx-runtime.d.ts",
89
- "import": "./dist/jsx-runtime.js"
90
- },
91
- "./craft": {
92
- "types": "./dist/craft-entry.d.ts",
93
- "import": "./dist/craft.js"
94
- },
95
- "./database": {
96
- "types": "./dist/database.d.ts",
97
- "import": "./dist/database.js"
98
- },
99
- "./ssg": {
100
- "types": "./dist/ssg.d.ts",
101
- "import": "./dist/ssg.js"
102
- },
103
- "./pwa": {
104
- "types": "./dist/pwa.d.ts",
105
- "import": "./dist/pwa.js"
106
- },
107
- "./visual-testing": {
108
- "types": "./dist/visual-testing.d.ts",
109
- "import": "./dist/visual-testing.js"
110
- },
111
- "./bundle-analyzer": {
112
- "types": "./dist/bundle-analyzer.d.ts",
113
- "import": "./dist/bundle-analyzer.js"
114
- },
115
- "./composables": {
116
- "bun": "./dist/composables/index.js",
117
- "types": "./dist/composables/index.d.ts",
118
- "import": "./dist/composables/index.js"
119
- },
120
- "./composables/*": {
121
- "bun": "./dist/composables/*.js",
122
- "types": "./dist/composables/*.d.ts",
123
- "import": "./dist/composables/*.js"
124
- },
125
- "./*": {
126
- "import": "./dist/*"
127
- }
128
- }
129
- },
130
77
  "module": "./dist/index.js",
131
78
  "types": "./dist/index.d.ts",
132
79
  "bin": {
@@ -169,12 +116,12 @@
169
116
  "dependencies": {
170
117
  "@cwcss/crosswind": "^0.2.0",
171
118
  "@stacksjs/clapp": "^0.2.0",
172
- "@stacksjs/desktop": "0.2.11",
173
- "@stacksjs/sanitizer": "0.2.11",
119
+ "@stacksjs/desktop": "0.2.13",
120
+ "@stacksjs/sanitizer": "0.2.13",
174
121
  "@stacksjs/ts-craft": "^0.0.2",
175
- "bun-plugin-stx": "0.2.11",
122
+ "bun-plugin-stx": "0.2.13",
176
123
  "bunfig": "^0.15.6",
177
- "stx-router": "0.2.11",
124
+ "stx-router": "0.2.13",
178
125
  "ts-broadcasting": "^0.0.4",
179
126
  "ts-syntax-highlighter": "^0.2.1"
180
127
  }
package/stx.d.ts CHANGED
@@ -301,6 +301,66 @@ declare function $watch<T>(
301
301
  options?: { immediate?: boolean, deep?: boolean },
302
302
  ): StxCleanup
303
303
 
304
+ // ============================================================================
305
+ // Toast notifications
306
+ // ============================================================================
307
+
308
+ interface StxToastOptions {
309
+ /** Auto-dismiss duration in ms. 0 = persistent. Default: 3000 */
310
+ duration?: number
311
+ }
312
+
313
+ interface StxToast {
314
+ /** Show a success toast (green) */
315
+ success: (message: string, options?: StxToastOptions) => number
316
+ /** Show an error toast (red) */
317
+ error: (message: string, options?: StxToastOptions) => number
318
+ /** Show an info toast (blue) */
319
+ info: (message: string, options?: StxToastOptions) => number
320
+ /** Show a warning toast (yellow) */
321
+ warning: (message: string, options?: StxToastOptions) => number
322
+ /** Dismiss a toast by id, or all toasts if no id is given */
323
+ dismiss: (id?: number) => void
324
+ }
325
+
326
+ declare const toast: StxToast
327
+
328
+ // ============================================================================
329
+ // Modal system
330
+ // ============================================================================
331
+
332
+ interface StxModal {
333
+ /** Open a modal by its id */
334
+ open: (id: string) => void
335
+ /** Close a modal by its id */
336
+ close: (id: string) => void
337
+ /** Toggle a modal by its id */
338
+ toggle: (id: string) => void
339
+ }
340
+
341
+ declare const modal: StxModal
342
+
343
+ // ============================================================================
344
+ // Alert & Confirm dialogs
345
+ // ============================================================================
346
+
347
+ interface StxDialogOptions {
348
+ /** Dialog title displayed above the message */
349
+ title?: string
350
+ /** Icon type: 'info' | 'warning' | 'error' | 'success' | 'question' */
351
+ type?: 'info' | 'warning' | 'error' | 'success' | 'question'
352
+ /** Text for the confirm/OK button (default: 'OK') */
353
+ confirmText?: string
354
+ /** Text for the cancel button — confirm only (default: 'Cancel') */
355
+ cancelText?: string
356
+ }
357
+
358
+ /** Styled replacement for window.alert(). Returns a Promise that resolves when dismissed. */
359
+ declare function stxAlert(message: string, options?: StxDialogOptions): Promise<void>
360
+
361
+ /** Styled replacement for window.confirm(). Returns a Promise<boolean>. */
362
+ declare function stxConfirm(message: string, options?: StxDialogOptions): Promise<boolean>
363
+
304
364
  // ============================================================================
305
365
  // Stores (Pinia-inspired, signals-based)
306
366
  // ============================================================================
@@ -412,6 +472,16 @@ interface StxRuntimeRegistry {
412
472
  defineStore: typeof defineStore
413
473
  useStore: typeof useStore
414
474
 
475
+ // Toast
476
+ toast: StxToast
477
+
478
+ // Modal
479
+ modal: StxModal
480
+
481
+ // Dialogs
482
+ alert: typeof stxAlert
483
+ confirm: typeof stxConfirm
484
+
415
485
  // Mount API
416
486
  mount: (setupFn: () => any) => void
417
487
  mountEl: (selector: string, setupFn: () => any) => void