@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
@@ -0,0 +1,78 @@
1
+ <script server>
2
+ import type { DashboardNavigationHub } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
3
+
4
+ const { sectionHubs = [] } = defineProps<{ sectionHubs: DashboardNavigationHub[] }>()
5
+ defineClientPayload({ sectionHubs })
6
+ </script>
7
+
8
+ <script client>
9
+ import { activeDashboardSection, canSeeDashboardCard, dashboardNavigationPath } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
10
+ import { useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
11
+ import { authStore } from '@stacksjs/defaults/views/dashboard/stores/auth'
12
+
13
+ const hubs = {{ sectionHubs }}
14
+ const rail = useRef<HTMLElement>('dashboardSectionSidebar')
15
+ const route = useRoute()
16
+ const appearance = useAppearance()
17
+
18
+ function syncVisibility(): void {
19
+ const hidden = appearance.hiddenSections()
20
+ const roles = authStore.roles()
21
+ const localViewer = authStore.unauthenticated()
22
+ for (const hub of hubs) {
23
+ const link = rail.current?.querySelector(`[data-section-id="${hub.id}"]`)
24
+ link?.toggleAttribute('hidden', hidden.includes(hub.id) || !canSeeDashboardCard(hub, roles, localViewer))
25
+ }
26
+ }
27
+
28
+ function syncSelection(path = route.path): void {
29
+ const current = dashboardNavigationPath(path)
30
+ const settings = current === '/settings' || current.startsWith('/settings/')
31
+ const active = settings ? 'settings' : activeDashboardSection(hubs, current)
32
+ for (const link of rail.current?.querySelectorAll<HTMLElement>('[data-dashboard-section-entry]') ?? []) {
33
+ if (link.dataset.sectionId === active)
34
+ link.setAttribute('aria-current', link.getAttribute('href') === current ? 'page' : 'location')
35
+ else
36
+ link.removeAttribute('aria-current')
37
+ }
38
+ }
39
+
40
+ function handleKeydown(event: KeyboardEvent): void {
41
+ // The enclosing Sidebar delegates these keys for its outline. In the
42
+ // flat rail the focused link handles keyboard activation.
43
+ if (event.key === 'Enter' || event.key.startsWith('Arrow'))
44
+ event.stopPropagation()
45
+ }
46
+
47
+ // This component lives outside the route outlet and keeps its listeners and
48
+ // refs when STX replaces a page's setup during a same-layout navigation.
49
+ useEventListener('stx:navigate', () => syncSelection())
50
+ useEventListener('stx:load', () => syncSelection())
51
+ useEventListener('popstate', () => syncSelection())
52
+ effect(syncVisibility)
53
+ onMount(() => {
54
+ syncVisibility()
55
+ syncSelection()
56
+ })
57
+ </script>
58
+
59
+ <div data-dashboard-section-sidebar ref="dashboardSectionSidebar" @keydown="handleKeydown($event)">
60
+ <div data-dashboard-section-sidebar-links>
61
+ <a href="/" data-stx-link data-dashboard-section-entry data-section-id="top">
62
+ <span class="dashboard-section-icon" aria-hidden="true"><span class="i-f7-house"></span></span>
63
+ <span>Home</span>
64
+ </a>
65
+ @foreach(sectionHubs as hub)
66
+ <a href="{{ hub.href }}" data-stx-link data-dashboard-section-entry data-section-id="{{ hub.id }}">
67
+ <span class="dashboard-section-icon" aria-hidden="true"><span class="{{ hub.icon }}"></span></span>
68
+ <span>{{ hub.label }}</span>
69
+ </a>
70
+ @endforeach
71
+ </div>
72
+ <div data-dashboard-section-sidebar-footer>
73
+ <a href="/settings" data-stx-link data-dashboard-section-entry data-section-id="settings">
74
+ <span class="dashboard-section-icon" aria-hidden="true"><span class="i-f7-gear-alt"></span></span>
75
+ <span>Settings</span>
76
+ </a>
77
+ </div>
78
+ </div>
@@ -1,5 +1,6 @@
1
1
  <script client>
2
2
  import type { SearchResultItem, SearchResults, SearchUnavailable } from '../../../functions/search'
3
+ import { openDashboardSettings } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
3
4
  import { fetchGlobalSearch } from '../../../functions/search'
4
5
 
5
6
  const query = state('')
@@ -91,7 +92,8 @@ function moveDown(): void {
91
92
 
92
93
  function openResult(item: SearchResultItem): void {
93
94
  close()
94
- navigate(item.href)
95
+ if (!openDashboardSettings(item.href))
96
+ navigate(item.href)
95
97
  }
96
98
 
97
99
  function selectCurrent(): void {
@@ -1,3 +1,11 @@
1
+ <script server>
2
+ import { buildDashboardSectionHubs } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
3
+ import { buildWebSidebarSections } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
4
+
5
+ export const homeSectionCards = buildDashboardSectionHubs(buildWebSidebarSections())
6
+ .map(({ id, href, label, icon, description, section, roleOptions }) => ({ id, href, label, icon, description, section, roleOptions }))
7
+ </script>
8
+
1
9
  <script client>
2
10
  import { useDashboard } from '../../../../functions/dashboard'
3
11
 
@@ -128,8 +136,8 @@ onMount(() => {
128
136
 
129
137
  <style>
130
138
  .dashboard-overview {
131
- --overview-border: light-dark(#dedee5, #ffffff1a);
132
- --overview-surface: light-dark(#ffffff, #18191f);
139
+ --overview-border: var(--dashboard-border, light-dark(#dedee5, #ffffff1a));
140
+ --overview-surface: var(--dashboard-surface, light-dark(#ffffff, #18191f));
133
141
  }
134
142
  .overview-metrics {
135
143
  display: grid;
@@ -145,18 +153,23 @@ onMount(() => {
145
153
  .overview-panel {
146
154
  background: var(--overview-surface);
147
155
  border: 1px solid var(--overview-border);
148
- border-radius: 1rem;
156
+ border-radius: var(--dashboard-radius, 1rem);
149
157
  }
150
158
  </style>
151
159
 
152
- <div class="mx-auto px-4 py-6 sm:px-8 sm:py-8 max-w-6xl dashboard-overview">
153
- <div class="flex flex-wrap gap-3 items-start justify-between mb-6">
160
+ <div class="mx-auto px-4 py-6 sm:px-8 sm:py-8 max-w-6xl dashboard-overview" data-dashboard-overview-page>
161
+ <div data-dashboard-hero class="flex flex-wrap gap-3 items-start justify-between mb-6">
154
162
  <PageHeader title="Dashboard" description="Application activity and service health" />
155
163
  <Button variant="secondary" size="sm" :loading="dashboard.isLoading.value" @click="loadDashboard">
156
164
  Refresh
157
165
  </Button>
158
166
  </div>
159
167
 
168
+ <section data-dashboard-section-overview aria-labelledby="dashboard-sections" class="mb-6">
169
+ <h2 id="dashboard-sections" data-dashboard-ink class="mb-3 font-semibold text-base text-neutral-900 dark:text-white">Sections</h2>
170
+ <DashboardNavigationCards :navigationCards="homeSectionCards" />
171
+ </section>
172
+
160
173
  <details :if="issues().length > 0" class="mb-4 px-4 py-3 text-amber-800 text-sm dark:text-amber-200 overview-panel">
161
174
  <summary class="font-medium cursor-pointer">Some dashboard data is unavailable</summary>
162
175
  <ul class="mt-2 pl-5 list-disc">
@@ -164,10 +177,10 @@ onMount(() => {
164
177
  </ul>
165
178
  </details>
166
179
 
167
- <section aria-labelledby="application-overview" class="mb-5 p-3 sm:p-4 overview-panel">
180
+ <section data-dashboard-metrics aria-labelledby="application-overview" class="mb-5 p-3 sm:p-4 overview-panel">
168
181
  <div class="flex flex-wrap gap-2 items-center justify-between mb-3">
169
- <h2 id="application-overview" class="font-semibold text-base text-neutral-900 dark:text-white">Overview</h2>
170
- <StxLink to="/requests" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">Request history</StxLink>
182
+ <h2 data-dashboard-ink id="application-overview" class="font-semibold text-base text-neutral-900 dark:text-white">Overview</h2>
183
+ <StxLink data-dashboard-muted to="/requests" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">Request history</StxLink>
171
184
  </div>
172
185
  <div class="overview-metrics">
173
186
  <StatsCard :for="item in loadingCards" :if="dashboard.isLoading.value && stats().length === 0" loading />
@@ -195,7 +208,7 @@ onMount(() => {
195
208
  <ServiceHealth :services="services()" :loading="dashboard.isLoading.value" />
196
209
  <ActivityTable :activities="activities()" :description="activityDescription()" :loading="dashboard.isLoading.value">
197
210
  <template #actions>
198
- <StxLink to="/data/activity" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">View all</StxLink>
211
+ <StxLink data-dashboard-muted to="/data/activity" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">View all</StxLink>
199
212
  </template>
200
213
  </ActivityTable>
201
214
  </div>
@@ -69,7 +69,7 @@ useEventListener('keydown', handleKeydown)
69
69
  useEventListener('stx:navigate', closeSidebar)
70
70
  </script>
71
71
 
72
- <div class="flex lg:hidden sticky top-0 z-40 gap-3 items-center px-4 h-14 bg-white/95 dark:bg-neutral-950/95 border-b border-neutral-200 dark:border-neutral-800 backdrop-blur-xl">
72
+ <div data-dashboard-mobile-bar class="flex lg:hidden sticky top-0 z-40 gap-3 items-center px-4 h-14 bg-white/95 dark:bg-neutral-950/95 border-b border-neutral-200 dark:border-neutral-800 backdrop-blur-xl">
73
73
  <button
74
74
  ref="dashboardMobileMenuButton"
75
75
  type="button"
@@ -20,28 +20,31 @@ defineClientPayload({ navSections })
20
20
 
21
21
  <script client>
22
22
  import type { ColorMode, SidebarStyle } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
23
+ import { ORIGINAL_DASHBOARD_THEME } from '@stacksjs/defaults/views/dashboard/composables/dashboard-themes'
23
24
  import {
24
25
  COLOR_MODE_OPTIONS,
25
26
  SIDEBAR_STYLE_OPTIONS,
26
27
  useAppearance,
27
28
  } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
29
+ import { useDashboardThemes } from '@stacksjs/defaults/views/dashboard/composables/useDashboardThemes'
28
30
 
29
31
  const appearance = useAppearance()
32
+ const themes = useDashboardThemes()
33
+ const usesOriginalTheme = derived(() => themes.active() === ORIGINAL_DASHBOARD_THEME)
34
+ const resetError = state('')
30
35
 
31
36
  // Every control writes straight through to the preference. There is no Save
32
37
  // button and no draft state: the shell restyles under the cursor, which is both
33
38
  // the confirmation and the preview. A settings page whose changes you cannot
34
39
  // see until you navigate away is the thing this is avoiding.
35
40
  const styleOptions = SIDEBAR_STYLE_OPTIONS
36
- const colorModes = COLOR_MODE_OPTIONS
41
+ const colorModes = COLOR_MODE_OPTIONS.map(({ id, label }) => ({ value: id, label }))
37
42
  const sections = {{ navSections }}
38
43
 
39
44
  const sidebarStyle = appearance.sidebarStyle
40
45
  const colorMode = appearance.colorMode
41
46
  const hiddenSections = appearance.hiddenSections
42
47
 
43
- const hiddenCount = derived(() => hiddenSections().length)
44
-
45
48
  function selectStyle(id: SidebarStyle) {
46
49
  appearance.setSidebarStyle(id)
47
50
  }
@@ -59,7 +62,15 @@ function toggleSection(id: string, visible: boolean) {
59
62
  }
60
63
 
61
64
  function resetAll() {
62
- appearance.reset()
65
+ resetError.set('')
66
+ try {
67
+ if (!usesOriginalTheme())
68
+ themes.select(ORIGINAL_DASHBOARD_THEME)
69
+ appearance.reset()
70
+ }
71
+ catch (error) {
72
+ resetError.set((error as Error).message)
73
+ }
63
74
  }
64
75
 
65
76
  // Selected state travels as a data attribute rather than as a swapped class
@@ -97,12 +108,6 @@ const selected = (a: unknown, b: unknown) => String(a === b)
97
108
  color: #2563eb;
98
109
  }
99
110
 
100
- .appearance-mode[data-selected="true"] {
101
- border-color: #3b82f6;
102
- background: #eff6ff;
103
- color: #1d4ed8;
104
- }
105
-
106
111
  .dark .appearance-option {
107
112
  border-color: rgba(255, 255, 255, 0.1);
108
113
  background: rgba(255, 255, 255, 0.03);
@@ -117,12 +122,6 @@ const selected = (a: unknown, b: unknown) => String(a === b)
117
122
  .dark .appearance-option[data-selected="true"] .appearance-check {
118
123
  color: #93c5fd;
119
124
  }
120
- .dark .appearance-mode[data-selected="true"] {
121
- border-color: #60a5fa;
122
- background: rgba(59, 130, 246, 0.15);
123
- color: #bfdbfe;
124
- }
125
-
126
125
  /*
127
126
  * Shell miniatures.
128
127
  *
@@ -216,24 +215,17 @@ const selected = (a: unknown, b: unknown) => String(a === b)
216
215
  </style>
217
216
 
218
217
  <template>
219
- <div class="flex flex-col gap-6 mx-auto pb-12 pt-6 px-6 max-w-4xl">
220
- <PageHeader
221
- title="Appearance"
222
- description="How the dashboard looks for you. These preferences are stored in this browser and apply to every page."
223
- backLink="/settings"
224
- backLabel="Settings"
225
- />
218
+ <div class="dashboard-settings-stack">
219
+ <SettingsGroup header="Display">
220
+ <SettingsRow label="Color mode" description="System follows your device’s light or dark mode." setting="color-mode">
221
+ <SegmentedControl :value="colorMode()" :options="colorModes" label="Color mode" variant="mac" @change="selectColorMode($event)" />
222
+ </SettingsRow>
223
+ </SettingsGroup>
226
224
 
227
- <!-- ===================== Sidebar style ===================== -->
228
- <Card variant="default" padding="none">
229
- <div class="px-6 py-5 border-b border-neutral-200/60 dark:border-white/5">
230
- <h2 class="font-semibold text-lg text-neutral-900 dark:text-white">Sidebar style</h2>
231
- <p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">
232
- Changes the navigation pane and the shape of every page around it.
233
- </p>
234
- </div>
225
+ <DashboardThemePicker />
235
226
 
236
- <div class="grid gap-4 sm:grid-cols-2 p-6">
227
+ <SettingsGroup header="Sidebar style" footer="Applies when The Original is selected.">
228
+ <div class="grid gap-4 sm:grid-cols-2 p-3">
237
229
  <button :for="option in styleOptions"
238
230
  type="button"
239
231
  class="flex flex-col gap-3 p-4 w-full text-left rounded-xl appearance-option"
@@ -261,68 +253,21 @@ const selected = (a: unknown, b: unknown) => String(a === b)
261
253
  <span class="leading-relaxed text-neutral-500 text-xs dark:text-neutral-400">{{ option.description }}</span>
262
254
  </button>
263
255
  </div>
264
- </Card>
265
-
266
- <!-- ===================== Color mode ===================== -->
267
- <Card variant="default" padding="none">
268
- <div class="px-6 py-5 border-b border-neutral-200/60 dark:border-white/5">
269
- <h2 class="font-semibold text-lg text-neutral-900 dark:text-white">Color mode</h2>
270
- <p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">
271
- System follows your operating system and changes with it.
272
- </p>
273
- </div>
274
-
275
- <div class="flex gap-3 p-6" role="group" aria-label="Color mode">
276
- <button :for="mode in colorModes"
277
- type="button"
278
- class="flex flex-1 gap-2 items-center justify-center px-3 py-2 font-medium text-neutral-600 text-sm dark:text-neutral-300 rounded-lg appearance-mode appearance-option"
279
- :data-selected="selected(colorMode(), mode.id)"
280
- :aria-pressed="String(selected(colorMode(), mode.id))"
281
- @click="selectColorMode(mode.id)"
282
- >
283
- <span :class="mode.icon" class="h-4 w-4" aria-hidden="true"></span>
284
- <span>{{ mode.label }}</span>
285
- </button>
286
- </div>
287
- </Card>
288
-
289
- <!-- ===================== Navigation sections ===================== -->
290
- <Card variant="default" padding="none">
291
- <div class="flex flex-wrap gap-4 items-center justify-between px-6 py-5 border-b border-neutral-200/60 dark:border-white/5">
292
- <div>
293
- <h2 class="font-semibold text-lg text-neutral-900 dark:text-white">Navigation</h2>
294
- <p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">
295
- Hide sections you do not use. This only affects your sidebar. It does not
296
- disable anything, and every page stays reachable by URL.
297
- </p>
298
- </div>
299
- <span :if="hiddenCount() > 0" class="px-2.5 py-1 font-medium text-amber-700 text-xs dark:text-amber-300 bg-amber-50 dark:bg-amber-500/10 rounded-full">
300
- {{ hiddenCount() }} hidden
301
- </span>
302
- </div>
256
+ </SettingsGroup>
303
257
 
304
- <div class="divide-neutral-200/60 divide-y dark:divide-white/5">
305
- <div :for="section in sections" class="px-6 py-4 hover:bg-stone-50/60 dark:hover:bg-white/[0.02]">
306
- <Toggle
307
- :checked="isVisible(section.id)"
308
- :label="section.label"
309
- :description="section.count + ' items'"
310
- :ariaLabel="'Show ' + section.label + ' section'"
311
- labelPosition="left"
312
- @update:checked="toggleSection(section.id, $event)"
313
- />
314
- </div>
258
+ <SettingsGroup header="Sidebar sections" footer="Hidden sections stay accessible by URL.">
259
+ <div :for="section in sections" class="dashboard-settings-section-toggle">
260
+ <SettingsRow :label="section.label" :description="section.count + ' items'" :setting="'show-section-' + section.id">
261
+ <Switch :checked="isVisible(section.id)" :label="'Show ' + section.label + ' section'" variant="mac" @change="toggleSection(section.id, $event)" />
262
+ </SettingsRow>
315
263
  </div>
316
- </Card>
264
+ </SettingsGroup>
317
265
 
318
- <!-- ===================== Reset ===================== -->
319
- <div class="flex items-center justify-between px-1">
320
- <p class="text-neutral-500 text-xs dark:text-neutral-400">
321
- Preferences are stored in this browser only, and sync across its tabs.
322
- </p>
323
- <Button variant="secondary" size="sm" @click="resetAll()">
324
- Reset to defaults
325
- </Button>
326
- </div>
266
+ <SettingsGroup>
267
+ <SettingsRow label="Restore defaults" description="Reset dashboard appearance and sidebar preferences in this browser." setting="reset-appearance">
268
+ <Button variant="secondary" size="sm" @click="resetAll()">Reset to defaults</Button>
269
+ </SettingsRow>
270
+ </SettingsGroup>
271
+ <p :if="resetError()" class="text-red-700 text-sm dark:text-red-300" role="alert" :text="resetError()"></p>
327
272
  </div>
328
273
  </template>
@@ -0,0 +1,98 @@
1
+ <script server>
2
+ const { pane } = defineProps<{ pane: 'general' | 'appearance' | 'mail' | 'billing' | 'software-update' }>()
3
+
4
+ export const panes = [
5
+ { id: 'general', label: 'General', href: '/settings', icon: 'i-f7-gear-alt-fill', tone: 'grey', description: 'Manage this project’s configuration and environment bindings.', keywords: 'config project environment' },
6
+ { id: 'appearance', label: 'Appearance', href: '/settings/appearance', icon: 'i-f7-circle-lefthalf-fill', tone: 'purple', description: 'Choose how the dashboard looks and which sections are shown in the sidebar.', keywords: 'theme color mode dark light sidebar display' },
7
+ { id: 'software-update', label: 'Software Update', href: '/settings/software-update', icon: 'i-f7-arrow-down-circle-fill', tone: 'blue', description: 'Check for Stacks releases and update your projects through Buddy.', keywords: 'upgrade framework version install dependencies' },
8
+ { id: 'mail', label: 'Mail', href: '/settings/mail', icon: 'i-f7-envelope-fill', tone: 'blue', description: 'Set the sender, delivery driver, and credentials for outgoing mail.', keywords: 'email smtp sender transport' },
9
+ { id: 'billing', label: 'Billing', href: '/settings/billing', icon: 'i-f7-creditcard-fill', tone: 'green', description: 'View your subscription, payment methods, and transactions.', keywords: 'subscription payment transaction invoice' },
10
+ ] as const
11
+ export const activePane = panes.find(item => item.id === pane) ?? panes[0]
12
+ defineClientPayload({ panes, activePane })
13
+ </script>
14
+
15
+ <script client>
16
+ import { dragSettingsWindow, isNativeSettingsWindow, returnToDashboard } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
17
+ import { useSettingsWindow } from '@stacksjs/defaults/views/dashboard/composables/useSettingsWindow'
18
+
19
+ const settingsWindow = useSettingsWindow
20
+ const query = settingsWindow.query
21
+ const search = useRef<HTMLInputElement>('settingsSearch')
22
+ const native = state(isNativeSettingsWindow())
23
+ const entries = {{ panes }}
24
+ const selectedHref = {{ activePane.href }}
25
+ const matching = derived(() => {
26
+ const searchText = query().trim().toLowerCase()
27
+ return entries.filter(({ label, keywords }) => `${label.toLowerCase()} ${keywords}`.includes(searchText))
28
+ })
29
+
30
+ function matches(id: string): boolean {
31
+ return matching().some(item => item.id === id)
32
+ }
33
+
34
+ function openSearchResult(): void {
35
+ const [result, another] = matching()
36
+ if (result && !another && result.href !== selectedHref)
37
+ navigate(result.href)
38
+ }
39
+
40
+ useEventListener('craft:ready', () => native.set(isNativeSettingsWindow()))
41
+ useEventListener('keydown', (event) => {
42
+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'f') {
43
+ event.preventDefault()
44
+ search.current?.focus()
45
+ search.current?.select()
46
+ }
47
+ })
48
+ </script>
49
+
50
+ <div data-dashboard-settings class="dashboard-settings" :data-settings-native="String(native())">
51
+ <aside class="dashboard-settings-sidebar">
52
+ <div class="dashboard-settings-sidebar-chrome">
53
+ <SidebarHeader windowControls="native" />
54
+ <a href="/" class="dashboard-settings-back" @click="returnToDashboard($event)">
55
+ <span class="i-f7-chevron-left" aria-hidden="true"></span>
56
+ Dashboard
57
+ </a>
58
+ </div>
59
+ <form class="dashboard-settings-search" role="search" @submit.prevent="openSearchResult()">
60
+ <span class="i-f7-search" aria-hidden="true"></span>
61
+ <input x-model="query" ref="settingsSearch" type="search" placeholder="Search" aria-label="Search settings" autocomplete="off">
62
+ </form>
63
+ <nav aria-label="Settings">
64
+ <SettingsSidebarGroup>
65
+ @foreach(panes as item)
66
+ <a href="{{ item.href }}" data-stx-link class="dashboard-settings-nav-item" :hidden="!matches('{{ item.id }}')"
67
+ @if(item.id === activePane.id)aria-current="page"@endif>
68
+ <span class="dashboard-settings-tile" data-tone="{{ item.tone }}" aria-hidden="true">
69
+ <span class="{{ item.icon }}"></span>
70
+ </span>
71
+ {{ item.label }}
72
+ </a>
73
+ @endforeach
74
+ </SettingsSidebarGroup>
75
+ <p :if="matching().length === 0" class="dashboard-settings-search-empty" role="status">No matching settings</p>
76
+ </nav>
77
+ </aside>
78
+
79
+ <div class="dashboard-settings-detail">
80
+ <header class="dashboard-settings-toolbar" @mousedown="dragSettingsWindow($event)">
81
+ <div class="dashboard-settings-history" role="group" aria-label="Settings history">
82
+ <button type="button" aria-label="Back" :disabled="settingsWindow.index() === 0" @click="goBack()">
83
+ <span class="i-f7-chevron-left" aria-hidden="true"></span>
84
+ </button>
85
+ <button type="button" aria-label="Forward" :disabled="settingsWindow.index() >= settingsWindow.lastIndex()" @click="goForward()">
86
+ <span class="i-f7-chevron-right" aria-hidden="true"></span>
87
+ </button>
88
+ </div>
89
+ <h1>{{ activePane.label }}</h1>
90
+ </header>
91
+ <div class="dashboard-settings-pane" data-stx-scroll="settings">
92
+ <div class="dashboard-settings-inner">
93
+ <SettingsPaneHeader :title="activePane.label" :description="activePane.description" :icon="activePane.icon" :tone="activePane.tone" />
94
+ <slot />
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>