@stacksjs/defaults 0.75.672 → 0.75.683

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 (69) hide show
  1. package/ai/skills/stacks-ai/SKILL.md +7 -2
  2. package/ai/skills/stacks-api/SKILL.md +1 -1
  3. package/ai/skills/stacks-dashboard/SKILL.md +26 -5
  4. package/ai/skills/stacks-deploy/SKILL.md +8 -0
  5. package/ai/skills/stacks-desktop/SKILL.md +31 -0
  6. package/ai/skills/stacks-development/SKILL.md +5 -7
  7. package/ai/skills/stacks-health/SKILL.md +19 -9
  8. package/ai/skills/stacks-native/CATALOG.md +24 -24
  9. package/ai/skills/stacks-newsletter/SKILL.md +10 -4
  10. package/ai/skills/stacks-router/SKILL.md +2 -2
  11. package/ai/skills/stacks-routes/SKILL.md +2 -2
  12. package/ai/skills/stacks-scheduler/SKILL.md +16 -2
  13. package/ai/skills/stacks-security/SKILL.md +24 -0
  14. package/ai/skills/stacks-socials/SKILL.md +17 -1
  15. package/ai/skills/stacks-storage/SKILL.md +34 -15
  16. package/app/Actions/SubscriberEmailAction.ts +26 -10
  17. package/app/Jobs/Inspire.ts +33 -0
  18. package/functions/dashboard-sidebar-order.ts +3 -0
  19. package/ide/vscode/package.json +1 -1
  20. package/package.json +8 -7
  21. package/project/storage/framework/types/request-context.d.ts +3 -0
  22. package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +3 -10
  23. package/resources/components/Dashboard/Billing/BillingPlanSummary.stx +3 -10
  24. package/resources/components/Dashboard/Billing/BillingSettings.stx +13 -15
  25. package/resources/components/Dashboard/Billing/BillingTransactionHistory.stx +2 -9
  26. package/resources/components/Dashboard/DashboardSectionLanding.stx +72 -0
  27. package/resources/components/Dashboard/DashboardSectionSidebar.stx +78 -0
  28. package/resources/components/Dashboard/GlobalSearch.stx +3 -1
  29. package/resources/components/Dashboard/Home/DashboardHome.stx +22 -9
  30. package/resources/components/Dashboard/MobileSidebar.stx +1 -1
  31. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +37 -92
  32. package/resources/components/Dashboard/Settings/DashboardSettingsFrame.stx +98 -0
  33. package/resources/components/Dashboard/Settings/DashboardThemePicker.stx +213 -0
  34. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +162 -167
  35. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +34 -30
  36. package/resources/components/Dashboard/Settings/SoftwareUpdateDashboard.stx +229 -0
  37. package/resources/components/Dashboard/UI/ActivityTable.stx +7 -7
  38. package/resources/components/Dashboard/UI/Button.stx +6 -3
  39. package/resources/components/Dashboard/UI/Card.stx +1 -1
  40. package/resources/components/Dashboard/UI/DashboardNavigationCards.stx +44 -0
  41. package/resources/components/Dashboard/UI/Drawer.stx +1 -1
  42. package/resources/components/Dashboard/UI/Input.stx +1 -0
  43. package/resources/components/Dashboard/UI/Modal.stx +1 -0
  44. package/resources/components/Dashboard/UI/PageHeader.stx +1 -1
  45. package/resources/components/Dashboard/UI/QuickLinks.stx +7 -5
  46. package/resources/components/Dashboard/UI/Select.stx +1 -0
  47. package/resources/components/Dashboard/UI/ServiceHealth.stx +6 -6
  48. package/resources/components/Dashboard/UI/StatsCard.stx +5 -5
  49. package/resources/components/Dashboard/UI/Table.stx +2 -1
  50. package/resources/components/Dashboard/UI/Textarea.stx +1 -0
  51. package/resources/components/Marketing/SubscribeForm.stx +29 -8
  52. package/resources/functions/dashboard/section-landing.ts +201 -0
  53. package/resources/functions/dashboard/section-navigation.ts +95 -0
  54. package/styles/dashboard-theme.css +1017 -0
  55. package/views/dashboard/composables/dashboard-theme-bootstrap.ts +11 -0
  56. package/views/dashboard/composables/dashboard-themes.ts +180 -0
  57. package/views/dashboard/composables/settings-window.ts +116 -0
  58. package/views/dashboard/composables/useAppearance.ts +34 -13
  59. package/views/dashboard/composables/useDashboardThemes.ts +80 -0
  60. package/views/dashboard/composables/useSettingsWindow.ts +23 -0
  61. package/views/dashboard/layouts/default.stx +74 -59
  62. package/views/dashboard/layouts/guest.stx +11 -1
  63. package/views/dashboard/layouts/settings.stx +48 -0
  64. package/views/dashboard/sections/[section].stx +19 -0
  65. package/views/dashboard/settings/appearance.stx +4 -2
  66. package/views/dashboard/settings/billing.stx +3 -4
  67. package/views/dashboard/settings/index.stx +4 -2
  68. package/views/dashboard/settings/mail.stx +3 -3
  69. package/views/dashboard/settings/software-update.stx +9 -0
@@ -102,6 +102,7 @@ function handleKeydown(event: KeyboardEvent): void {
102
102
 
103
103
  <div class="relative">
104
104
  <textarea
105
+ data-dashboard-field
105
106
  :id="textareaId()"
106
107
  :name="liveName() || null"
107
108
  :rows="liveRows()"
@@ -1,3 +1,21 @@
1
+ <script server>
2
+ // What the form shows before its client script has run. Rendered here, so an
3
+ // island (`client="interaction"`) or a page whose script has not loaded yet
4
+ // still has a labelled field and a button that says what it does, and a plain
5
+ // form post carries its source and return address.
6
+ const props = defineProps()
7
+ const initial = {
8
+ label: props.label || 'Subscribe',
9
+ placeholder: props.placeholder || 'you@example.com',
10
+ intro: props.intro || '',
11
+ fine: props.fine || '',
12
+ source: props.source || 'website',
13
+ list: props.list || '',
14
+ returnTo: props.returnTo || '',
15
+ buttonClass: `${props.tone === 'outline' ? 'subscribe-form__button--outline ' : ''}${props.buttonClass || ''}`.trim(),
16
+ }
17
+ </script>
18
+
1
19
  <script client>
2
20
  /*
3
21
  * A newsletter signup, answered in place. Drop it on any page:
@@ -62,6 +80,8 @@ const messages = {
62
80
  const outcomes = ['subscribed', 'pending', 'already', 'invalid', 'busy', 'error']
63
81
 
64
82
  const email = state('')
83
+ // The honeypot. People never see the field; a bot that fills it is answered as if it worked.
84
+ const website = state('')
65
85
  const sending = state(false)
66
86
  const outcome = state<Outcome | ''>(outcomes.includes(loadedWith()) ? loadedWith() as Outcome : '')
67
87
  const tonePositive = derived(() => outcome() === 'subscribed' || outcome() === 'pending' || outcome() === 'already')
@@ -102,7 +122,7 @@ async function send(): Promise<Outcome> {
102
122
  const response = await fetch('/api/email/subscribe', {
103
123
  method: 'POST',
104
124
  headers: { 'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },
105
- body: new URLSearchParams({ email: email(), source: source(), list: list(), return: returnTo() }).toString(),
125
+ body: new URLSearchParams({ email: email(), source: source(), list: list(), return: returnTo(), website: website() }).toString(),
106
126
  })
107
127
  let body: { success?: unknown, pending?: unknown, message?: unknown } | null = null
108
128
  try {
@@ -140,15 +160,16 @@ async function submit(): Promise<void> {
140
160
  :aria-busy="sending() ? 'true' : 'false'"
141
161
  @submit.prevent="submit()"
142
162
  >
143
- <input type="hidden" name="source" :value="source()">
144
- <input type="hidden" name="list" :value="list()">
145
- <input type="hidden" name="return" :value="returnTo()">
146
- <label class="subscribe-form__intro" :class="intro() ? '' : 'subscribe-form__sr'" for="subscribe-email">{{ intro() || 'Email address' }}</label>
163
+ <input type="hidden" name="source" value="{{ initial.source }}" :value="source()">
164
+ <input type="hidden" name="list" value="{{ initial.list }}" :value="list()">
165
+ <input type="hidden" name="return" value="{{ initial.returnTo }}" :value="returnTo()">
166
+ <input class="subscribe-form__sr" type="text" name="website" value="" tabindex="-1" autocomplete="off" aria-hidden="true" x-model="website">
167
+ <label class="subscribe-form__intro {{ initial.intro ? '' : 'subscribe-form__sr' }}" :class="intro() ? '' : 'subscribe-form__sr'" for="subscribe-email" :text="intro() || 'Email address'">{{ initial.intro || 'Email address' }}</label>
147
168
  <div class="subscribe-form__row">
148
- <input id="subscribe-email" ref="emailInput" class="subscribe-form__field" type="email" name="email" :placeholder="placeholder()" autocomplete="email" required x-model.trim="email">
149
- <button type="submit" class="subscribe-form__button" :class="(tone() === 'outline' ? 'subscribe-form__button--outline ' : '') + buttonClass()" :disabled="sending()">
169
+ <input id="subscribe-email" ref="emailInput" class="subscribe-form__field" type="email" name="email" placeholder="{{ initial.placeholder }}" :placeholder="placeholder()" autocomplete="email" required x-model.trim="email">
170
+ <button type="submit" class="subscribe-form__button {{ initial.buttonClass }}" :class="(tone() === 'outline' ? 'subscribe-form__button--outline ' : '') + buttonClass()" :disabled="sending()">
150
171
  <span class="subscribe-form__spinner" aria-hidden="true"></span>
151
- <span>{{ label() }}</span>
172
+ <span :text="label()">{{ initial.label }}</span>
152
173
  </button>
153
174
  </div>
154
175
  <p class="subscribe-form__notice" :class="noticeClass()" role="status" aria-live="polite">
@@ -0,0 +1,201 @@
1
+ import type { DashboardNavigationCard, DashboardNavigationHub } from './section-navigation'
2
+ import { canSeeDashboardCard, dashboardNavigationPath } from './section-navigation'
3
+
4
+ interface LandingDefinition {
5
+ introduction: string
6
+ primary: string
7
+ featured: Record<string, string>
8
+ groups?: Record<string, string[]>
9
+ }
10
+
11
+ const landings: Record<string, LandingDefinition> = {
12
+ library: {
13
+ introduction: 'Browse the pieces of your project, from interface components to functions and installed packages.',
14
+ primary: '/library/components',
15
+ featured: {
16
+ '/functions': 'Find the shared functions available in your application.',
17
+ '/packages': 'See the packages your project installs and depends on.',
18
+ '/releases': 'Look through released versions of the project.',
19
+ },
20
+ },
21
+ content: {
22
+ introduction: 'Find what you’re working on, make changes, and keep published content organized.',
23
+ primary: '/content/posts',
24
+ featured: {
25
+ '/content/pages': 'Edit the pages visitors find on your site.',
26
+ '/content/files': 'Browse and organize the files on your storage disks.',
27
+ '/content/blog': 'Review blog activity and publishing.',
28
+ '/content/comments': 'Read and moderate responses to your posts.',
29
+ },
30
+ groups: {
31
+ 'Publishing': ['/content/dashboard', '/content/authors', '/content/categories', '/content/tags'],
32
+ 'Discoverability': ['/content/seo'],
33
+ },
34
+ },
35
+ app: {
36
+ introduction: 'Ship changes, follow background work, and see how the application is behaving.',
37
+ primary: '/deployments',
38
+ featured: {
39
+ '/operations/scheduler': 'Review scheduled tasks and their recent runs.',
40
+ '/requests': 'Inspect HTTP requests and response times.',
41
+ '/jobs': 'Follow work as it runs in the background.',
42
+ '/errors': 'Find captured exceptions and their context.',
43
+ },
44
+ groups: {
45
+ 'Background work': ['/actions', '/commands', '/queue', '/jobs'],
46
+ 'Diagnostics': ['/queries', '/realtime', '/search-engine'],
47
+ 'Messages': ['/inbox', '/notifications'],
48
+ },
49
+ },
50
+ data: {
51
+ introduction: 'Work with the people and records in your application, and see what’s changed recently.',
52
+ primary: '/models',
53
+ featured: {
54
+ '/data/users': 'Review accounts and manage individual users.',
55
+ '/data/teams': 'Browse teams and their members.',
56
+ '/data/activity': 'See recent changes made in the application.',
57
+ '/data/subscribers': 'Review the people on your subscriber list.',
58
+ },
59
+ groups: {
60
+ 'Data overview': ['/data/dashboard'],
61
+ },
62
+ },
63
+ commerce: {
64
+ introduction: 'Run the store from one place, from the products you sell to the orders customers place.',
65
+ primary: '/commerce/orders',
66
+ featured: {
67
+ '/commerce/products': 'Manage products, prices, and availability.',
68
+ '/commerce/customers': 'Find customers and review their order history.',
69
+ '/commerce/payments': 'Inspect recorded payments and their status.',
70
+ '/commerce/pos': 'Open the point of sale for in-person orders.',
71
+ },
72
+ groups: {
73
+ 'Catalog': ['/commerce/categories', '/commerce/manufacturers', '/commerce/units', '/commerce/variants', '/commerce/reviews'],
74
+ 'Promotions': ['/commerce/coupons', '/commerce/discounts', '/commerce/upsells', '/commerce/gift-cards', '/commerce/waitlist'],
75
+ 'Store operations': ['/commerce/dashboard', '/commerce/taxes', '/commerce/printers'],
76
+ },
77
+ },
78
+ delivery: {
79
+ introduction: 'Set up how orders reach customers and manage access to digital purchases.',
80
+ primary: '/commerce/delivery',
81
+ featured: {
82
+ '/commerce/delivery/shipping-methods': 'Manage the ways customers can receive an order.',
83
+ '/commerce/delivery/couriers': 'Review the couriers handling delivery.',
84
+ '/commerce/delivery/delivery-routes': 'Organize delivery routes.',
85
+ '/commerce/delivery/digital-delivery': 'Review digital items and their delivery.',
86
+ },
87
+ groups: {
88
+ 'Rates and regions': ['/commerce/delivery/shipping-rates', '/commerce/delivery/shipping-zones'],
89
+ 'Digital access': ['/commerce/delivery/license-keys'],
90
+ },
91
+ },
92
+ marketing: {
93
+ introduction: 'Plan outreach, keep track of your audiences, and see where customers are engaging.',
94
+ primary: '/marketing/campaigns',
95
+ featured: {
96
+ '/marketing/lists': 'Organize the audiences you want to reach.',
97
+ '/marketing/social-posts': 'Review and manage social posts.',
98
+ '/marketing/abandoned-carts': 'See storefront carts left before checkout.',
99
+ '/marketing/reviews': 'Review customer feedback on products.',
100
+ },
101
+ },
102
+ analytics: {
103
+ introduction: 'Understand how people find your application and what they do once they arrive.',
104
+ primary: '/analytics',
105
+ featured: {
106
+ '/analytics/web': 'Review traffic, visits, and engagement.',
107
+ '/analytics/pages': 'Find the pages people visit most.',
108
+ '/analytics/referrers': 'See which sources send people to your site.',
109
+ '/analytics/events': 'Explore events captured by the application.',
110
+ },
111
+ groups: {
112
+ 'Audience': ['/analytics/countries', '/analytics/browsers', '/analytics/devices'],
113
+ 'Channels': ['/analytics/blog', '/analytics/commerce', '/analytics/marketing'],
114
+ },
115
+ },
116
+ management: {
117
+ introduction: 'Check the services your application relies on and manage access to its infrastructure.',
118
+ primary: '/health',
119
+ featured: {
120
+ '/cloud': 'Review the cloud resources connected to this project.',
121
+ '/servers': 'Find the servers running your application.',
122
+ '/logs': 'Read application logs and trace recent activity.',
123
+ '/management/permissions': 'Review the roles and permissions used by the dashboard.',
124
+ },
125
+ groups: {
126
+ 'Infrastructure': ['/serverless', '/dns', '/remote', '/mailboxes'],
127
+ 'Team operations': ['/insights', '/kanban', '/ci'],
128
+ },
129
+ },
130
+ utilities: {
131
+ introduction: 'Configure your project and find the tools it uses to run.',
132
+ primary: '/settings',
133
+ featured: {
134
+ '/settings/appearance': 'Choose a dashboard theme and color mode.',
135
+ '/environment': 'Review the environment your application runs in.',
136
+ '/access-tokens': 'Manage tokens used to connect to the application.',
137
+ '/buddy': 'Browse commands for building and operating the project.',
138
+ },
139
+ groups: {
140
+ 'Email': ['/settings/mail'],
141
+ },
142
+ },
143
+ }
144
+
145
+ interface LandingGroup {
146
+ title: string
147
+ first: DashboardNavigationCard[]
148
+ more: DashboardNavigationCard[]
149
+ }
150
+
151
+ export function getDashboardSectionLanding(hub: DashboardNavigationHub, roles: readonly string[], localViewer: boolean): {
152
+ introduction: string
153
+ primary: DashboardNavigationCard | undefined
154
+ featured: DashboardNavigationCard[]
155
+ groups: LandingGroup[]
156
+ } {
157
+ const design = landings[hub.id]
158
+ const destinations = hub.destinations.filter(item => canSeeDashboardCard(item, roles, localViewer))
159
+ const featuredByPath = design?.featured
160
+ const primary = destinations.find(item => item.href === design?.primary)
161
+ ?? destinations.find(item => featuredByPath?.[item.href])
162
+ ?? destinations[0]
163
+ const used = new Set(primary ? [primary.id] : [])
164
+ const featured: DashboardNavigationCard[] = []
165
+ for (const [href, description] of Object.entries(featuredByPath ?? {})) {
166
+ const card = destinations.find(item => item.href === href && !used.has(item.id))
167
+ if (card) {
168
+ featured.push({ ...card, description })
169
+ used.add(card.id)
170
+ }
171
+ }
172
+ if (!design) {
173
+ for (const card of destinations.filter(item => !used.has(item.id)).slice(0, 4)) {
174
+ featured.push(card)
175
+ used.add(card.id)
176
+ }
177
+ }
178
+
179
+ const groups: LandingGroup[] = []
180
+ function addGroup(title: string, matches: (card: DashboardNavigationCard) => boolean): void {
181
+ const items = destinations.filter(card => !used.has(card.id) && matches(card))
182
+ if (!items.length)
183
+ return
184
+ for (const item of items)
185
+ used.add(item.id)
186
+ groups.push({ title, first: items.slice(0, 4), more: items.slice(4) })
187
+ }
188
+
189
+ for (const [title, paths] of Object.entries(design?.groups ?? {})) {
190
+ addGroup(title, ({ href }) => {
191
+ if (!href.startsWith('/') || href.startsWith('//'))
192
+ return false
193
+ const path = dashboardNavigationPath(href)
194
+ return paths.some(prefix => path === prefix || path.startsWith(`${prefix}/`))
195
+ })
196
+ }
197
+ addGroup('Model records', item => item.href.startsWith('/models/'))
198
+ addGroup('More pages', () => true)
199
+
200
+ return { introduction: design?.introduction ?? hub.description ?? '', primary, featured, groups }
201
+ }
@@ -0,0 +1,95 @@
1
+ import type { WebSidebarItem, WebSidebarSection } from './sidebar'
2
+
3
+ export interface DashboardNavigationCard {
4
+ id: string
5
+ href: string
6
+ label: string
7
+ icon: string
8
+ description?: string
9
+ section: string
10
+ /** Each option is a path through the navigation tree. Every role group on one path must pass. */
11
+ roleOptions: string[][][]
12
+ }
13
+
14
+ export interface DashboardNavigationHub extends DashboardNavigationCard {
15
+ destinations: DashboardNavigationCard[]
16
+ }
17
+
18
+ const sectionDetails: Record<string, { icon: string, description: string }> = {
19
+ library: { icon: 'i-f7-cube-box', description: 'Components, functions, releases, and packages' },
20
+ content: { icon: 'i-f7-doc-text', description: 'Pages, posts, files, and publishing' },
21
+ app: { icon: 'i-f7-bolt', description: 'Deployments, requests, jobs, and inboxes' },
22
+ data: { icon: 'i-f7-table', description: 'People, activity, and application models' },
23
+ commerce: { icon: 'i-f7-cart', description: 'Orders, customers, products, and payments' },
24
+ delivery: { icon: 'i-f7-car-fill', description: 'Shipping, couriers, and digital delivery' },
25
+ marketing: { icon: 'i-f7-speaker-2', description: 'Campaigns, lists, and social posts' },
26
+ analytics: { icon: 'i-f7-chart-bar', description: 'Traffic, audiences, and events' },
27
+ management: { icon: 'i-f7-rectangle-stack', description: 'Infrastructure, permissions, and system health' },
28
+ utilities: { icon: 'i-f7-gear-alt', description: 'Environment, access tokens, and settings' },
29
+ }
30
+
31
+ export function buildDashboardSectionHubs(sections: readonly WebSidebarSection[]): DashboardNavigationHub[] {
32
+ const hubs: DashboardNavigationHub[] = []
33
+ for (const section of sections) {
34
+ if (!section.label)
35
+ continue
36
+
37
+ function destinations(items: readonly WebSidebarItem[], inheritedRoles: string[][] = []): DashboardNavigationCard[] {
38
+ return items.flatMap((item) => {
39
+ const roles = item.roles?.length ? [...inheritedRoles, item.roles] : inheritedRoles
40
+ const children = destinations(item.children ?? [], roles)
41
+ if (!item.href)
42
+ return children
43
+ const { id, href, label, icon } = item
44
+ const description = href.startsWith('/models/') ? 'Model records' : undefined
45
+ return [{ id, href, label, icon, description, section: section.id, roleOptions: [roles] }, ...children]
46
+ })
47
+ }
48
+
49
+ const cards = destinations(section.items)
50
+ if (!cards.length)
51
+ continue
52
+
53
+ const details = sectionDetails[section.id]
54
+ hubs.push({
55
+ id: section.id,
56
+ href: `/sections/${encodeURIComponent(section.id)}`,
57
+ label: section.label,
58
+ icon: details?.icon ?? 'i-f7-square-grid-2x2',
59
+ description: details?.description,
60
+ section: section.id,
61
+ roleOptions: cards.some(card => canSeeDashboardCard(card, [], false)) ? [[]] : cards.flatMap(card => card.roleOptions),
62
+ destinations: cards,
63
+ })
64
+ }
65
+ return hubs
66
+ }
67
+
68
+ export function canSeeDashboardCard(card: DashboardNavigationCard, roles: readonly string[], localViewer: boolean): boolean {
69
+ return localViewer || card.roleOptions.some(option => option.every(group => group.some(role => roles.includes(role))))
70
+ }
71
+
72
+ export function dashboardNavigationPath(path: string): string {
73
+ return path.split(/[?#]/, 1)[0]?.replace(/\/+$/, '') || '/'
74
+ }
75
+
76
+ export function activeDashboardSection(hubs: readonly DashboardNavigationHub[], path: string): string | undefined {
77
+ const current = dashboardNavigationPath(path)
78
+ if (current === '/')
79
+ return 'top'
80
+
81
+ let matched: string | undefined
82
+ let longest = 0
83
+ for (const hub of hubs) {
84
+ for (const { href } of [hub, ...hub.destinations]) {
85
+ if (!href.startsWith('/') || href.startsWith('//'))
86
+ continue
87
+ const candidate = dashboardNavigationPath(href)
88
+ if (candidate !== '/' && (current === candidate || current.startsWith(`${candidate}/`)) && candidate.length > longest) {
89
+ matched = hub.id
90
+ longest = candidate.length
91
+ }
92
+ }
93
+ }
94
+ return matched
95
+ }