@stacksjs/defaults 0.70.357 → 0.70.362

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.
Files changed (55) hide show
  1. package/ai/skills/stacks-browse/SKILL.md +10 -5
  2. package/ai/skills/stacks-browse/scripts/browse.ts +109 -13
  3. package/app/Actions/AI/AskAction.ts +12 -17
  4. package/app/Actions/AI/SummaryAction.ts +12 -17
  5. package/app/Actions/Dashboard/Actions/GetActions.ts +15 -9
  6. package/app/Actions/Dashboard/Analytics/EventStoreAction.ts +21 -9
  7. package/app/Actions/Dashboard/Commerce/ProductUnitDefaultAction.ts +12 -3
  8. package/app/Actions/Dashboard/Commerce/TaxRateDefaultAction.ts +12 -3
  9. package/app/Actions/Dashboard/DashboardHealthAction.ts +34 -14
  10. package/app/Actions/Dashboard/DashboardHomeAction.test.ts +1 -1
  11. package/app/Actions/Dashboard/DashboardHomeAction.ts +31 -4
  12. package/app/Actions/Dashboard/DashboardStatsAction.ts +6 -1
  13. package/app/Actions/Dashboard/Email/InboxSendAction.ts +14 -7
  14. package/app/Actions/Dashboard/Infrastructure/CommandIndexAction.ts +33 -27
  15. package/app/Actions/Dashboard/Infrastructure/EnvironmentIndexAction.ts +10 -4
  16. package/app/Actions/Dashboard/Infrastructure/EnvironmentUpdateAction.ts +8 -1
  17. package/app/Actions/Dashboard/Infrastructure/RequestIndexAction.ts +24 -18
  18. package/app/Actions/Dashboard/Infrastructure/ServerIndexAction.ts +15 -9
  19. package/app/Actions/Dashboard/Infrastructure/ServerShowAction.ts +9 -2
  20. package/app/Actions/Dashboard/Marketing/CampaignCancelAction.ts +23 -5
  21. package/app/Actions/Dashboard/Marketing/CampaignDestroyAction.ts +26 -17
  22. package/app/Actions/Dashboard/Marketing/CampaignIndexAction.ts +49 -43
  23. package/app/Actions/Dashboard/Marketing/CampaignScheduleAction.ts +31 -25
  24. package/app/Actions/Dashboard/Marketing/CampaignSendAction.ts +28 -22
  25. package/app/Actions/Dashboard/Marketing/CampaignStoreAction.ts +15 -10
  26. package/app/Actions/Dashboard/Marketing/CampaignUpdateAction.ts +19 -12
  27. package/app/Actions/Dashboard/Marketing/ListDestroyAction.ts +34 -25
  28. package/app/Actions/Dashboard/Marketing/ListIndexAction.ts +32 -26
  29. package/app/Actions/Dashboard/Marketing/ListStoreAction.ts +31 -18
  30. package/app/Actions/Dashboard/Marketing/ListUpdateAction.ts +35 -19
  31. package/app/Actions/Dashboard/Marketing/SocialPostDestroyAction.ts +15 -5
  32. package/app/Actions/Dashboard/Marketing/SocialPostIndexAction.ts +11 -5
  33. package/app/Actions/Dashboard/Marketing/SocialPostStoreAction.ts +19 -13
  34. package/app/Actions/Dashboard/Marketing/SocialPostUpdateAction.ts +22 -12
  35. package/app/Actions/Dashboard/Marketing/campaign-delivery.ts +34 -0
  36. package/app/Actions/Dashboard/Marketing/marketing-list-records.test.ts +10 -0
  37. package/app/Actions/Dashboard/Marketing/marketing-list-records.ts +10 -0
  38. package/app/Actions/Dashboard/Marketing/marketing-response.ts +28 -0
  39. package/app/Actions/Dashboard/Marketing/social-post-records.test.ts +13 -0
  40. package/app/Actions/Dashboard/Marketing/social-post-records.ts +22 -4
  41. package/app/Actions/Dashboard/Models/GetModels.ts +14 -7
  42. package/app/Actions/Dashboard/Models/GetSubscriberCount.ts +8 -1
  43. package/app/Actions/Dashboard/Models/GetUserCount.ts +8 -1
  44. package/app/Actions/Dashboard/Releases/ReleaseIndexAction.ts +11 -5
  45. package/app/Actions/Dashboard/Settings/MailSettingsGetAction.ts +10 -4
  46. package/app/Actions/Dashboard/Settings/MailSettingsUpdateAction.ts +8 -1
  47. package/app/Actions/LogAction.ts +11 -11
  48. package/ide/vscode/package.json +1 -1
  49. package/package.json +1 -1
  50. package/resources/components/Dashboard/Marketing/CampaignDeleteDialog.stx +11 -12
  51. package/resources/components/Dashboard/Marketing/MarketingListDeleteDialog.stx +15 -15
  52. package/resources/components/Dashboard/Marketing/SocialPostDeleteDialog.stx +11 -12
  53. package/resources/components/Dashboard/UI/ConfirmDialog.stx +51 -53
  54. package/resources/components/Dashboard/UI/Modal.stx +83 -29
  55. package/views/dashboard/stores/auth.ts +18 -2
@@ -8,6 +8,8 @@ const confirmLabel = useReactiveProp('confirmLabel', 'Delete')
8
8
  const cancelLabel = useReactiveProp('cancelLabel', 'Cancel')
9
9
  const variant = useReactiveProp('variant', 'danger' as ConfirmVariant)
10
10
  const busy = useReactiveProp('busy', false)
11
+ const disabled = useReactiveProp('disabled', false)
12
+ const error = useReactiveProp('error', '')
11
13
  const emit = defineEmits()
12
14
 
13
15
  function close(): void {
@@ -16,7 +18,7 @@ function close(): void {
16
18
  }
17
19
 
18
20
  function confirm(): void {
19
- if (!busy())
21
+ if (!busy() && !disabled())
20
22
  emit('confirm')
21
23
  }
22
24
 
@@ -32,57 +34,53 @@ function iconName(): string {
32
34
 
33
35
  </script>
34
36
 
35
- <template :if="open()">
36
- <div class="fixed inset-0 overflow-y-auto z-[55] dashboard-modal-layer" @keydown.escape="close">
37
- <button type="button" class="fixed inset-0 w-full bg-black/50 backdrop-blur-sm cursor-default" aria-label="Close confirmation dialog" @click="close"></button>
38
-
39
- <div class="flex relative items-center justify-center p-4 min-h-full">
40
- <section
41
- role="alertdialog"
42
- aria-modal="true"
43
- :aria-label="title()"
44
- class="relative p-6 max-w-md w-full bg-white dark:bg-neutral-900 rounded-xl shadow-2xl"
45
- >
46
- <div class="flex gap-4 items-start">
47
- <div class="shrink-0 p-2.5 rounded-lg" :class="iconClass()">
48
- <span class="block h-5 w-5" :class="iconName()"></span>
49
- </div>
50
- <div class="flex-1 min-w-0">
51
- <h3 class="font-semibold text-lg text-neutral-900 dark:text-white">
52
- {{ title() }}
53
- </h3>
54
- <p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">
55
- {{ description() }}
56
- </p>
57
- </div>
58
- </div>
37
+ <Modal
38
+ :isOpen="open()"
39
+ :title="title()"
40
+ :description="description()"
41
+ :closable="!busy()"
42
+ role="alertdialog"
43
+ size="sm"
44
+ @close="close"
45
+ >
46
+ <template #header-leading>
47
+ <div class="shrink-0 p-2.5 rounded-lg" :class="iconClass()">
48
+ <span class="block h-5 w-5" :class="iconName()"></span>
49
+ </div>
50
+ </template>
59
51
 
60
- <div class="flex gap-2 items-center justify-end mt-6">
61
- <Button
62
- variant="secondary"
63
- :disabled="busy()"
64
- @click="close"
65
- >
66
- {{ cancelLabel() }}
67
- </Button>
68
- <Button
69
- :if="variant() === 'warning'"
70
- variant="warning"
71
- :loading="busy()"
72
- @click="confirm"
73
- >
74
- {{ confirmLabel() }}
75
- </Button>
76
- <Button
77
- :if="variant() !== 'warning'"
78
- variant="danger"
79
- :loading="busy()"
80
- @click="confirm"
81
- >
82
- {{ confirmLabel() }}
83
- </Button>
84
- </div>
85
- </section>
52
+ <template #footer>
53
+ <div class="w-full">
54
+ <div :if="error()" role="alert" class="mb-4 p-3 text-red-700 text-sm dark:text-red-300 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900">
55
+ {{ error() }}
56
+ </div>
57
+ <div class="flex gap-2 items-center justify-end">
58
+ <Button
59
+ variant="secondary"
60
+ :disabled="busy()"
61
+ @click="close"
62
+ >
63
+ {{ cancelLabel() }}
64
+ </Button>
65
+ <Button
66
+ :if="variant() === 'warning'"
67
+ variant="warning"
68
+ :loading="busy()"
69
+ :disabled="disabled()"
70
+ @click="confirm"
71
+ >
72
+ {{ confirmLabel() }}
73
+ </Button>
74
+ <Button
75
+ :if="variant() !== 'warning'"
76
+ variant="danger"
77
+ :loading="busy()"
78
+ :disabled="disabled()"
79
+ @click="confirm"
80
+ >
81
+ {{ confirmLabel() }}
82
+ </Button>
83
+ </div>
86
84
  </div>
87
- </div>
88
- </template>
85
+ </template>
86
+ </Modal>
@@ -5,9 +5,10 @@ interface ModalProps {
5
5
  description?: string
6
6
  size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'
7
7
  closable?: boolean
8
+ role?: 'dialog' | 'alertdialog'
8
9
  }
9
10
 
10
- const { isOpen = false, title = '', description = '', size = 'md', closable = true } = defineProps<ModalProps>()
11
+ const { isOpen = false, title = '', description = '', size = 'md', closable = true, role = 'dialog' } = defineProps<ModalProps>()
11
12
 
12
13
  const sizeClasses = {
13
14
  sm: 'max-w-sm',
@@ -19,30 +20,75 @@ const sizeClasses = {
19
20
  </script>
20
21
  <script client>
21
22
  const open = useReactiveProp('isOpen', false)
23
+ const liveClosable = useReactiveProp('closable', true)
22
24
  const liveTitle = useReactiveProp('title', '')
23
25
  const liveDescription = useReactiveProp('description', '')
26
+ const liveRole = useReactiveProp('role', 'dialog')
27
+ const dialog = useRef<HTMLDialogElement>('dashboardModalDialog')
28
+ const activeElement = useActiveElement()
29
+ const scrollLocked = useScrollLock()
24
30
  const emit = defineEmits()
31
+ let restoreFocus: HTMLElement | null = null
25
32
 
26
33
  function closeModal(): void {
34
+ if (!liveClosable()) return
27
35
  emit('close')
28
36
  }
29
- </script>
30
- <div :if="open()" class="fixed inset-y-0 overflow-y-auto right-0 z-[55] dashboard-modal-layer">
31
- <!-- Overlay -->
32
- <button type="button" class="absolute inset-0 w-full bg-black/50 backdrop-blur-sm" aria-label="Close modal" @click="closeModal"></button>
33
37
 
38
+ function handleCancel(event: Event): void {
39
+ event.preventDefault()
40
+ closeModal()
41
+ }
42
+
43
+ function handleBackdropClick(event: MouseEvent): void {
44
+ if (event.target === event.currentTarget)
45
+ closeModal()
46
+ }
47
+
48
+ effect(() => {
49
+ const isOpen = open()
50
+ scrollLocked.value = isOpen
51
+
52
+ if (isOpen) {
53
+ const focused = peek(() => activeElement.value)
54
+ if (focused instanceof HTMLElement)
55
+ restoreFocus = focused
56
+ void nextTick(() => {
57
+ const element = dialog.current
58
+ if (!element) return
59
+ if (!element.open)
60
+ element.showModal()
61
+ element.focus()
62
+ })
63
+ return
64
+ }
65
+
66
+ if (dialog.current?.open)
67
+ dialog.current.close()
68
+ const target = restoreFocus
69
+ restoreFocus = null
70
+ if (target)
71
+ void nextTick(() => target.focus())
72
+ })
73
+ </script>
74
+ <dialog
75
+ :if="open()"
76
+ ref="dashboardModalDialog"
77
+ :role="liveRole()"
78
+ aria-modal="true"
79
+ :aria-label="liveTitle() || 'Dialog'"
80
+ class="fixed inset-0 m-0 p-0 h-dvh max-h-none w-screen max-w-none overflow-y-auto z-[55] bg-transparent dashboard-modal-layer dashboard-modal-dialog"
81
+ @cancel="handleCancel"
82
+ >
34
83
  <!-- Modal container -->
35
- <div class="flex items-center justify-center p-4 min-h-full">
84
+ <div class="flex items-center justify-center p-4 min-h-full" @click="handleBackdropClick">
36
85
  <div
37
- role="dialog"
38
- aria-modal="true"
39
- :aria-label="liveTitle() || 'Dialog'"
40
- tabindex="-1"
41
86
  class="relative w-full rounded-xl bg-white dark:bg-neutral-900 shadow-2xl {{ sizeClasses[size] }}"
42
87
  >
43
88
  <!-- Header -->
44
- @if(title || closable)
45
- <div class="flex gap-4 items-start justify-between p-6 border-b border-neutral-200 dark:border-neutral-700">
89
+ <div :if="liveTitle() || liveClosable()" class="flex gap-4 items-start justify-between p-6 border-b border-neutral-200 dark:border-neutral-700">
90
+ <div class="flex gap-3 items-start min-w-0">
91
+ <slot name="header-leading" />
46
92
  <div class="min-w-0">
47
93
  <h3 :if="liveTitle()" class="font-semibold text-lg text-neutral-900 dark:text-white">
48
94
  {{ liveTitle() }}
@@ -51,26 +97,27 @@ function closeModal(): void {
51
97
  {{ liveDescription() }}
52
98
  </p>
53
99
  </div>
54
-
55
- @if(closable)
56
- <Button
57
- variant="ghost"
58
- size="sm"
59
- iconOnly
60
- ariaLabel="Close modal"
61
- @click="closeModal"
62
- >
63
- <div class="h-5 w-5 i-hugeicons-cancel-01"></div>
64
- </Button>
65
- @endif
66
100
  </div>
67
- @endif
68
101
 
69
- <!-- Body -->
70
- <div class="p-6">
71
- <slot />
102
+ <Button
103
+ :if="liveClosable()"
104
+ variant="ghost"
105
+ size="sm"
106
+ iconOnly
107
+ ariaLabel="Close modal"
108
+ @click="closeModal"
109
+ >
110
+ <div class="h-5 w-5 i-hugeicons-cancel-01"></div>
111
+ </Button>
72
112
  </div>
73
113
 
114
+ <!-- Body -->
115
+ @if($slots.default)
116
+ <div class="p-6">
117
+ <slot />
118
+ </div>
119
+ @endif
120
+
74
121
  @if($slots.footer)
75
122
  <div class="flex items-center justify-end px-6 py-4 border-neutral-200 border-t dark:border-neutral-700">
76
123
  <slot name="footer" />
@@ -78,4 +125,11 @@ function closeModal(): void {
78
125
  @endif
79
126
  </div>
80
127
  </div>
81
- </div>
128
+ </dialog>
129
+
130
+ <style>
131
+ .dashboard-modal-dialog::backdrop {
132
+ background: rgb(0 0 0 / 50%);
133
+ backdrop-filter: blur(4px);
134
+ }
135
+ </style>
@@ -33,6 +33,7 @@ export const authStore = defineStore('auth', () => {
33
33
  const loading = state(false)
34
34
  const error = state<string | null>(null)
35
35
  const loaded = state(false)
36
+ let pendingLoad: Promise<void> | null = null
36
37
 
37
38
  const isAdmin = derived(() => {
38
39
  if (!loaded()) return false
@@ -50,8 +51,7 @@ export const authStore = defineStore('auth', () => {
50
51
  return roles().includes('client')
51
52
  })
52
53
 
53
- async function load(): Promise<void> {
54
- if (loading() || loaded()) return
54
+ async function resolveIdentity(): Promise<void> {
55
55
  loading.set(true)
56
56
  error.set(null)
57
57
  try {
@@ -88,7 +88,23 @@ export const authStore = defineStore('auth', () => {
88
88
  }
89
89
  }
90
90
 
91
+ function load(): Promise<void> {
92
+ if (loaded())
93
+ return Promise.resolve()
94
+
95
+ if (pendingLoad)
96
+ return pendingLoad
97
+
98
+ pendingLoad = resolveIdentity().finally(() => {
99
+ pendingLoad = null
100
+ })
101
+ return pendingLoad
102
+ }
103
+
91
104
  async function refresh(): Promise<void> {
105
+ if (pendingLoad)
106
+ await pendingLoad
107
+
92
108
  loaded.set(false)
93
109
  await load()
94
110
  }