@stacksjs/defaults 0.75.711 → 0.75.716

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 (46) hide show
  1. package/ai/skills/stacks-dashboard/SKILL.md +20 -6
  2. package/ai/skills/stacks-dns/SKILL.md +17 -2
  3. package/ai/skills/stacks-native/CATALOG.md +5 -5
  4. package/app/Actions/Dashboard/Infrastructure/dns-overview.ts +2 -2
  5. package/app/Actions/Dashboard/Infrastructure/environment-file.ts +1 -12
  6. package/functions/dashboard-api.ts +5 -0
  7. package/ide/vscode/package.json +1 -1
  8. package/package.json +6 -5
  9. package/resources/components/Dashboard/Buddy/BuddyAssistant.stx +1 -1
  10. package/resources/components/Dashboard/DashboardSectionSidebar.stx +12 -3
  11. package/resources/components/Dashboard/Environment/EnvironmentDashboard.stx +88 -68
  12. package/resources/components/Dashboard/Infrastructure/DnsDashboard.stx +1 -0
  13. package/resources/components/Dashboard/Projects/GitHubIssuesDashboard.stx +165 -0
  14. package/resources/components/Dashboard/Settings/DashboardSettingsIntro.stx +10 -0
  15. package/resources/components/Dashboard/Settings/DashboardSettingsSearch.stx +32 -0
  16. package/resources/components/Dashboard/Settings/DnsRecordsSettings.stx +181 -0
  17. package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +7 -5
  18. package/resources/components/Dashboard/Settings/SettingsCodeEditor.stx +27 -0
  19. package/resources/components/Dashboard/Settings/SettingsDashboard.stx +187 -270
  20. package/resources/components/Dashboard/Settings/SettingsPicker.stx +87 -0
  21. package/resources/functions/dashboard/environment-value.ts +11 -0
  22. package/resources/functions/dashboard/page-availability.ts +1 -1
  23. package/resources/functions/dashboard/project-config-sections.ts +105 -0
  24. package/resources/functions/dashboard/section-landing.ts +1 -1
  25. package/resources/functions/dashboard/settings-panes.ts +26 -0
  26. package/resources/functions/dashboard/sidebar.ts +7 -7
  27. package/scaffold/config/server.ts +12 -6
  28. package/styles/dashboard-theme.css +281 -25
  29. package/views/dashboard/composables/dashboard-theme-bootstrap.ts +7 -0
  30. package/views/dashboard/composables/settings-dialog.ts +22 -0
  31. package/views/dashboard/composables/settings-window.ts +10 -4
  32. package/views/dashboard/composables/useProjectConfigEditor.ts +244 -0
  33. package/views/dashboard/composables/useSettingsWindow.ts +23 -1
  34. package/views/dashboard/github-issues.stx +18 -0
  35. package/views/dashboard/layouts/default.stx +1 -1
  36. package/views/dashboard/layouts/settings.stx +147 -10
  37. package/views/dashboard/settings/appearance.stx +2 -3
  38. package/views/dashboard/settings/billing.stx +2 -3
  39. package/views/dashboard/settings/config/[section].stx +22 -0
  40. package/views/dashboard/{environment/index.stx → settings/environment.stx} +1 -1
  41. package/views/dashboard/settings/index.stx +1 -3
  42. package/views/dashboard/settings/mail.stx +2 -3
  43. package/views/dashboard/settings/software-update.stx +2 -3
  44. package/resources/components/Dashboard/CodeEditor.stx +0 -73
  45. package/resources/components/Dashboard/Settings/DashboardSettingsFrame.stx +0 -101
  46. package/resources/functions/dashboard/config-io.ts +0 -401
@@ -0,0 +1,244 @@
1
+ import { defineStore, derived, reactive, state, useSessionStorage } from '@stacksjs/stx'
2
+ import { dashboardApi } from '@stacksjs/defaults/functions/dashboard-api'
3
+
4
+ import type { ProjectConfigFile, ProjectConfigSection } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
5
+ import { configFileLabel, projectConfigSection, sectionForConfig } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
6
+
7
+ export const useProjectConfigInventory = defineStore('dashboard-project-config-inventory', () => {
8
+ const files = state<ProjectConfigFile[]>([])
9
+ const loading = state(true)
10
+ const error = state('')
11
+ let request: Promise<void> | undefined
12
+
13
+ function load(): Promise<void> {
14
+ request ??= (async () => {
15
+ loading.set(true)
16
+ error.set('')
17
+ try {
18
+ const body = await dashboardApi<{ files: ProjectConfigFile[] }>('/api/config/list', { projectConfig: true })
19
+ files.set(body.files.map(file => ({ ...file, title: configFileLabel(file.name) })))
20
+ }
21
+ catch (cause) {
22
+ error.set(cause instanceof Error ? cause.message : 'Unable to load configuration')
23
+ request = undefined
24
+ }
25
+ finally {
26
+ loading.set(false)
27
+ }
28
+ })()
29
+ return request
30
+ }
31
+
32
+ return { files, loading, error, load }
33
+ })
34
+
35
+ export interface ConfigField {
36
+ key: string
37
+ value: string | number | boolean | null
38
+ type: 'string' | 'number' | 'boolean' | 'null'
39
+ path: Array<string | number>
40
+ description?: string
41
+ }
42
+
43
+ interface ConfigDocument {
44
+ fields: ConfigField[]
45
+ source: string
46
+ revision: string
47
+ diagnostic?: string
48
+ }
49
+
50
+ export type EditorMode = 'fields' | 'source'
51
+
52
+ function createProjectConfigEditor(section: ProjectConfigSection) {
53
+ return defineStore(`dashboard-project-config-${section}`, () => {
54
+ const inventory = useProjectConfigInventory
55
+ const order: readonly string[] = projectConfigSection(section)?.files ?? []
56
+ const files = derived(() => inventory.files().filter(file => sectionForConfig(file.name) === section)
57
+ .sort((left, right) => order.indexOf(left.name) - order.indexOf(right.name)))
58
+ const current = state<ConfigDocument | null>(null)
59
+ const drafts = reactive<Record<string, ConfigField['value']>>(Object.create(null))
60
+ const sourceDraft = state('')
61
+ const selected = state('')
62
+ const mode = state<EditorMode>('fields')
63
+ const loading = state(true)
64
+ const saving = state(false)
65
+ const message = state('')
66
+ const error = state('')
67
+
68
+ const selection = useSessionStorage<{ file: string, mode: EditorMode }>(`stacks-dashboard-config-selection:${section}`, { file: '', mode: 'fields' })
69
+ const saved = useSessionStorage<{ file: string, revision: string } | null>(`stacks-dashboard-config-saved:${section}`, null)
70
+ const pending = new Map<string, {
71
+ document: ConfigDocument
72
+ source: string
73
+ values: Array<[string, ConfigField['value']]>
74
+ mode: EditorMode
75
+ }>()
76
+ let generation = 0
77
+
78
+ function setMode(next: EditorMode): void {
79
+ mode.set(next)
80
+ if (selected())
81
+ selection.set({ file: selected(), mode: next })
82
+ }
83
+
84
+ function savedMessage(file: string): string {
85
+ return `Saved config/${file}.ts. Restart any other running services that use this file.`
86
+ }
87
+
88
+ function draftValue(field: ConfigField): ConfigField['value'] {
89
+ const value = drafts[field.key]
90
+ if (field.type === 'number' && typeof value === 'string')
91
+ return value.trim() ? Number(value) : NaN
92
+ return value
93
+ }
94
+
95
+ const changedFields = derived(() => (current()?.fields ?? []).filter(field => !Object.is(draftValue(field), field.value)))
96
+ const isDirty = derived(() => mode() === 'source' ? sourceDraft() !== current()?.source : changedFields().length > 0)
97
+
98
+ function setDocument(result: ConfigDocument): void {
99
+ for (const key of Object.keys(drafts))
100
+ delete drafts[key]
101
+ for (const field of result.fields)
102
+ drafts[field.key] = field.value
103
+ sourceDraft.set(result.source)
104
+ current.set(result)
105
+ }
106
+
107
+ async function initialize(requested?: string): Promise<void> {
108
+ await inventory.load()
109
+ if (inventory.error()) {
110
+ error.set(inventory.error())
111
+ loading.set(false)
112
+ return
113
+ }
114
+ const previous = selection()
115
+ const first = files().find(file => file.name === requested)
116
+ ?? files().find(file => file.name === (selected() || previous.file))
117
+ ?? files()[0]
118
+ if (first)
119
+ await selectFile(first.name, { mode: first.name === previous.file ? previous.mode : undefined })
120
+ else
121
+ loading.set(false)
122
+ }
123
+
124
+ async function selectFile(name: string, options?: { mode?: EditorMode, reload?: boolean }): Promise<void> {
125
+ if (saving() || (!options?.reload && selected() === name && (current() || loading())))
126
+ return
127
+
128
+ const loaded = current()
129
+ const previous = selected()
130
+ if (options?.reload)
131
+ pending.delete(name)
132
+ else if (loaded && previous && isDirty()) {
133
+ pending.set(previous, {
134
+ document: loaded,
135
+ source: sourceDraft(),
136
+ values: changedFields().map(({ key }) => [key, drafts[key]]),
137
+ mode: mode(),
138
+ })
139
+ }
140
+
141
+ const request = ++generation
142
+ const draft = pending.get(name)
143
+ selected.set(name)
144
+ current.set(null)
145
+ message.set('')
146
+ error.set('')
147
+ loading.set(true)
148
+ try {
149
+ const result = draft?.document ?? await dashboardApi<ConfigDocument>(`/api/config/read?name=${encodeURIComponent(name)}`, { projectConfig: true })
150
+ if (request !== generation)
151
+ return
152
+ pending.delete(name)
153
+ setDocument(result)
154
+ if (draft) {
155
+ for (const [key, value] of draft.values)
156
+ drafts[key] = value
157
+ sourceDraft.set(draft.source)
158
+ }
159
+ setMode(draft?.mode ?? options?.mode ?? (name === 'dns' || result.fields.length ? 'fields' : 'source'))
160
+ const confirmation = saved()
161
+ if (!draft && confirmation?.file === name && confirmation.revision === result.revision)
162
+ message.set(savedMessage(name))
163
+ }
164
+ catch (cause) {
165
+ if (request === generation)
166
+ error.set(cause instanceof Error ? cause.message : 'Unable to read configuration')
167
+ }
168
+ finally {
169
+ if (request === generation)
170
+ loading.set(false)
171
+ }
172
+ }
173
+
174
+ async function save(): Promise<void> {
175
+ const loaded = current()
176
+ const file = selected()
177
+ if (!loaded || loading() || saving() || !isDirty())
178
+ return
179
+
180
+ const updates = changedFields().map(field => ({ key: field.key, type: field.type, value: draftValue(field) }))
181
+ if (mode() === 'fields' && updates.some(field => field.type === 'number' && !Number.isFinite(field.value))) {
182
+ error.set('Enter a valid number in each number field.')
183
+ return
184
+ }
185
+
186
+ message.set('')
187
+ error.set('')
188
+ saving.set(true)
189
+ try {
190
+ const result = await dashboardApi<ConfigDocument>('/api/config/update', {
191
+ method: 'POST',
192
+ projectConfig: true,
193
+ body: {
194
+ file,
195
+ revision: loaded.revision,
196
+ ...(mode() === 'source' ? { source: sourceDraft() } : { updates: updates.map(({ key, value }) => ({ key, value })) }),
197
+ },
198
+ })
199
+ setDocument(result)
200
+ saved.set({ file, revision: result.revision })
201
+ message.set(savedMessage(file))
202
+ }
203
+ catch (cause) {
204
+ error.set(cause instanceof Error ? cause.message : 'Unable to save configuration')
205
+ }
206
+ finally {
207
+ saving.set(false)
208
+ }
209
+ }
210
+
211
+ function hasUnsavedChanges(): boolean {
212
+ return pending.size > 0 || Boolean(current() && isDirty())
213
+ }
214
+
215
+ return { files, current, drafts, sourceDraft, selected, mode, setMode, loading, saving, message, error, isDirty, setDocument, selectFile, save, initialize, hasUnsavedChanges }
216
+ })
217
+ }
218
+
219
+ const editors = new Map<ProjectConfigSection, ReturnType<typeof createProjectConfigEditor>>()
220
+
221
+ export function projectConfigEditor(section: ProjectConfigSection): ReturnType<typeof createProjectConfigEditor> {
222
+ let editor = editors.get(section)
223
+ if (!editor) {
224
+ editor = createProjectConfigEditor(section)
225
+ editors.set(section, editor)
226
+ }
227
+ return editor
228
+ }
229
+
230
+ export function hasUnsavedProjectConfig(): boolean {
231
+ return [...editors.values()].some(editor => editor.hasUnsavedChanges())
232
+ }
233
+
234
+ export function requestedProjectConfigFile(): string | undefined {
235
+ return new URLSearchParams(location.search).get('file') ?? undefined
236
+ }
237
+
238
+ export function rememberProjectConfigFile(file: string): void {
239
+ const url = new URL(location.href)
240
+ if (url.searchParams.get('file') !== file) {
241
+ url.searchParams.set('file', file)
242
+ history.replaceState(history.state, '', url)
243
+ }
244
+ }
@@ -1,12 +1,16 @@
1
1
  import { defineStore, state } from '@stacksjs/stx'
2
+ import { settingsPanePath } from '@stacksjs/defaults/resources/functions/dashboard/settings-panes'
2
3
 
3
4
  const historyKey = 'stacksSettingsIndex'
4
5
 
5
6
  export const useSettingsWindow = defineStore('dashboard-settings-window', () => {
6
7
  const query = state('')
8
+ const activePath = state(settingsPanePath(typeof location === 'undefined' ? '/settings' : location.pathname))
9
+ const browserNavOpen = state(false)
7
10
  const index = state(0)
8
11
  const lastIndex = state(0)
9
12
  let initialized = false
13
+ let listening = false
10
14
 
11
15
  function syncHistory(): void {
12
16
  const saved = history.state?.[historyKey]
@@ -19,5 +23,23 @@ export const useSettingsWindow = defineStore('dashboard-settings-window', () =>
19
23
  initialized = true
20
24
  }
21
25
 
22
- return { query, index, lastIndex, syncHistory }
26
+ // The routed pane changes its STX setup on navigation. This listener
27
+ // belongs to the settings window, so its chrome survives those swaps.
28
+ function listen(): void {
29
+ if (listening)
30
+ return
31
+ listening = true
32
+ syncHistory()
33
+ window.addEventListener('stx:navigate', (event) => {
34
+ const href = (event as CustomEvent<{ url?: string }>).detail?.url ?? location.href
35
+ const next = settingsPanePath(new URL(href, location.href).pathname)
36
+ if (next !== activePath())
37
+ browserNavOpen.set(false)
38
+ activePath.set(next)
39
+ })
40
+ window.addEventListener('stx:load', syncHistory)
41
+ window.addEventListener('popstate', syncHistory)
42
+ }
43
+
44
+ return { query, activePath, browserNavOpen, index, lastIndex, listen }
23
45
  })
@@ -0,0 +1,18 @@
1
+ @extends('layouts/default')
2
+ @section('content')
3
+ @title('Dashboard - GitHub Issues')
4
+
5
+ <script server>
6
+ import { dashboardProjectIdentity } from '@stacksjs/defaults/resources/functions/dashboard/project-switcher'
7
+
8
+ export const localProjectsEnabled = dashboardProjectIdentity().enabled
9
+ </script>
10
+
11
+ <PageLayout>
12
+ @if(localProjectsEnabled)
13
+ <GitHubIssuesDashboard />
14
+ @else
15
+ <PageHeader title="GitHub Issues" description="Open the local Buddy dashboard to see issues across your projects." />
16
+ @endif
17
+ </PageLayout>
18
+ @endsection
@@ -780,7 +780,7 @@ onDestroy(() => {
780
780
  <div data-dashboard-sidebar-tree>
781
781
  <SidebarSections :sections="sidebarSections" theme="macos" />
782
782
  </div>
783
- <DashboardSectionSidebar :sectionHubs="sectionHubs" />
783
+ <DashboardSectionSidebar :sectionHubs="sectionHubs" :primaryItems="sidebarSections[0].items" />
784
784
  <template #footer>
785
785
  <div class="px-3 py-2 text-neutral-600 text-xs dark:text-neutral-300" data-sidebar-order-controls data-dashboard-muted :data-sidebar-order-editing="sidebarReordering() ? 'true' : 'false'">
786
786
  <p role="status" aria-live="polite" :text="sidebarOrderStatus.message"></p>
@@ -1,8 +1,17 @@
1
+ <script server>
2
+ import { dashboardPageVisibility } from '@stacksjs/defaults/resources/functions/dashboard/page-availability'
3
+ import { settingsPanes } from '@stacksjs/defaults/resources/functions/dashboard/settings-panes'
4
+
5
+ const isDashboardPageAvailable = dashboardPageVisibility()
6
+ export const builtInPanes = settingsPanes.filter(item => isDashboardPageAvailable(item.href))
7
+ defineClientPayload({ builtInPanes })
8
+ </script>
9
+
1
10
  @head
2
11
  <link rel="icon" href="/images/logos/favicon.svg" type="image/svg+xml">
3
12
  <link rel="stylesheet" href="/__deps/dashboard-theme.css">
4
13
  <link rel="stylesheet" href="/__deps/dashboard-icons.css">
5
- <script src="/__deps/dashboard-theme.js"></script>
14
+ <script src="/__deps/dashboard-theme.js" data-settings-router></script>
6
15
  @endhead
7
16
 
8
17
  @appearanceBootstrap({
@@ -21,11 +30,78 @@
21
30
  })
22
31
 
23
32
  <script client>
24
- import { listenForSettingsPane, setSettingsWindowAppearance } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
25
- import { useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
33
+ import { navigate } from '@stacksjs/stx/composables/use-router'
34
+ import { dragSettingsWindow, isNativeSettingsWindow, listenForSettingsPane, returnToDashboard, setSettingsWindowAppearance } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
35
+ import { projectConfigSections, sectionForConfig, projectConfigHref } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
36
+ import { settingsPaneLabel } from '@stacksjs/defaults/resources/functions/dashboard/settings-panes'
37
+ import { hasUnsavedProjectConfig, useProjectConfigInventory } from '@stacksjs/defaults/views/dashboard/composables/useProjectConfigEditor'
26
38
  import { useSettingsWindow } from '@stacksjs/defaults/views/dashboard/composables/useSettingsWindow'
39
+ import { useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
27
40
 
28
41
  const settingsWindow = useSettingsWindow
42
+ const inventory = useProjectConfigInventory
43
+ const query = settingsWindow.query
44
+ const browserNavOpen = settingsWindow.browserNavOpen
45
+ const native = state(isNativeSettingsWindow())
46
+ const builtIn = builtInPanes
47
+ const activePath = settingsWindow.activePath
48
+
49
+ const projectEntries = derived(() => {
50
+ const populated = new Set(inventory.files().map(file => sectionForConfig(file.name)))
51
+ return projectConfigSections
52
+ .filter(section => section.id === 'general' || projectConfigHref(section.id) === activePath() || populated.has(section.id))
53
+ .map(section => ({ ...section, href: projectConfigHref(section.id), detail: '', keywords: section.description }))
54
+ })
55
+
56
+ const groups = derived(() => [
57
+ { id: 'project', label: 'Project', items: projectEntries().filter(section => section.id !== 'environment-schema') },
58
+ { id: 'environment', label: 'Environment', items: [...builtIn.filter(item => item.group === 'environment'), ...projectEntries().filter(section => section.id === 'environment-schema')] },
59
+ { id: 'dashboard', label: 'Dashboard', items: builtIn.filter(item => item.group === 'dashboard') },
60
+ ].map(group => ({ ...group, items: group.items.map(item => ({ detail: '', ...item })) })))
61
+
62
+ const searchResults = derived(() => {
63
+ const terms = query().trim().toLowerCase().split(/\s+/).filter(Boolean)
64
+ if (!terms.length)
65
+ return []
66
+ const sections = projectEntries()
67
+ const files = inventory.files().flatMap((file) => {
68
+ const section = sections.find(item => item.id === sectionForConfig(file.name))
69
+ if (!section)
70
+ return []
71
+ return [{ id: file.name, label: file.title, href: projectConfigHref(section.id, file.name), detail: section.label, icon: 'i-f7-doc-text', tone: section.tone, keywords: `${file.name}.ts` }]
72
+ })
73
+ return [...groups().flatMap(group => group.items), ...files]
74
+ .filter(item => terms.every(term => `${item.label} ${item.keywords}`.toLowerCase().includes(term)))
75
+ .sort((left, right) => Number(right.label.toLowerCase() === terms.join(' ')) - Number(left.label.toLowerCase() === terms.join(' ')))
76
+ })
77
+
78
+ function navigateSearchResult(href: string): void {
79
+ query.set('')
80
+ browserNavOpen.set(false)
81
+ navigate(href, { instant: true })
82
+ }
83
+
84
+ function openSearchResult(): void {
85
+ const [first] = searchResults()
86
+ if (first)
87
+ navigateSearchResult(first.href)
88
+ }
89
+
90
+ function activateSearchLink(event: MouseEvent, href: string): void {
91
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
92
+ return
93
+ event.preventDefault()
94
+ navigateSearchResult(href)
95
+ }
96
+
97
+ onMount(() => { void inventory.load() })
98
+ useEventListener('craft:ready', () => native.set(isNativeSettingsWindow()))
99
+ useEventListener('beforeunload', (event: BeforeUnloadEvent) => {
100
+ if (hasUnsavedProjectConfig()) {
101
+ event.preventDefault()
102
+ event.returnValue = ''
103
+ }
104
+ })
29
105
  const appearance = useAppearance()
30
106
  let stopListening: (() => void) | undefined
31
107
 
@@ -34,15 +110,76 @@ effect(() => {
34
110
  setSettingsWindowAppearance(mode)
35
111
  })
36
112
 
37
- useEventListener('stx:load', () => settingsWindow.syncHistory())
38
- useEventListener('popstate', () => settingsWindow.syncHistory())
39
113
  onMount(() => {
40
- settingsWindow.syncHistory()
41
- stopListening = listenForSettingsPane(navigate)
114
+ settingsWindow.listen()
115
+ stopListening = listenForSettingsPane(href => navigate(href, { instant: true }))
42
116
  })
43
117
  onDestroy(() => stopListening?.())
44
118
  </script>
45
119
 
46
- <main data-stx-content data-dashboard-content data-dashboard-settings-content>
47
- @slot('content')
48
- </main>
120
+ <div data-dashboard-settings class="dashboard-settings" :data-settings-native="String(native())">
121
+ <aside class="dashboard-settings-sidebar">
122
+ <div class="dashboard-settings-sidebar-chrome">
123
+ <SidebarHeader windowControls="native" />
124
+ <a href="/" class="dashboard-settings-back" @click="returnToDashboard($event)">
125
+ <span class="i-f7-chevron-left" aria-hidden="true"></span>
126
+ Dashboard
127
+ </a>
128
+ </div>
129
+ <button type="button" class="dashboard-settings-mobile-menu" aria-controls="settings-navigation"
130
+ :aria-expanded="String(browserNavOpen())" @click="browserNavOpen.update(open => !open)">
131
+ Browse settings
132
+ <span class="i-f7-chevron-down" aria-hidden="true"></span>
133
+ </button>
134
+ <div id="settings-navigation" class="dashboard-settings-navigation" :data-menu-open="String(browserNavOpen())">
135
+ <DashboardSettingsSearch @open-result="openSearchResult" />
136
+ <nav aria-label="Settings" class="dashboard-settings-nav" data-stx-scroll="settings-navigation">
137
+ <div :if="!query().trim()">
138
+ <section :for="group in groups()" :key="group.id" class="dashboard-settings-nav-group">
139
+ <h2 :text="group.label"></h2>
140
+ <a :for="item in group.items" :key="item.href" :href="item.href" data-stx-link data-stx-transition="none" class="dashboard-settings-nav-item"
141
+ :aria-current="item.href === activePath() ? 'page' : null">
142
+ <span class="dashboard-settings-tile" :data-tone="item.tone" aria-hidden="true">
143
+ <span :class="item.icon"></span>
144
+ </span>
145
+ <span :text="item.label"></span>
146
+ </a>
147
+ </section>
148
+ </div>
149
+ <div :if="query().trim()" aria-label="Search results">
150
+ <a :for="item in searchResults()" :href="item.href" class="dashboard-settings-nav-item" @click="activateSearchLink($event, item.href)">
151
+ <span class="dashboard-settings-tile" :data-tone="item.tone" aria-hidden="true">
152
+ <span :class="item.icon"></span>
153
+ </span>
154
+ <span class="min-w-0">
155
+ <span class="block" :text="item.label"></span>
156
+ <span :if="item.detail" class="dashboard-settings-result-detail" :text="item.detail"></span>
157
+ </span>
158
+ </a>
159
+ <p :if="searchResults().length === 0" class="dashboard-settings-search-empty" role="status">No matching settings</p>
160
+ </div>
161
+ </nav>
162
+ </div>
163
+ </aside>
164
+
165
+ <div class="dashboard-settings-detail">
166
+ <header class="dashboard-settings-toolbar" @mousedown="dragSettingsWindow($event)">
167
+ <div class="dashboard-settings-history" role="group" aria-label="Settings history">
168
+ <button type="button" aria-label="Back" :disabled="settingsWindow.index() === 0" @click="goBack()">
169
+ <span class="i-f7-chevron-left" aria-hidden="true"></span>
170
+ </button>
171
+ <button type="button" aria-label="Forward" :disabled="settingsWindow.index() >= settingsWindow.lastIndex()" @click="goForward()">
172
+ <span class="i-f7-chevron-right" aria-hidden="true"></span>
173
+ </button>
174
+ </div>
175
+ <h1 :text="settingsPaneLabel(activePath())"></h1>
176
+ </header>
177
+ <main class="dashboard-settings-outlet" data-stx-content data-dashboard-content data-dashboard-settings-content>
178
+ <div class="dashboard-settings-pane" data-stx-scroll="settings">
179
+ <div class="dashboard-settings-inner">
180
+ @slot('content')
181
+ </div>
182
+ </div>
183
+ </main>
184
+ </div>
185
+ </div>
@@ -3,7 +3,6 @@
3
3
  @section('content')
4
4
  @title('Dashboard - Appearance')
5
5
 
6
- <DashboardSettingsFrame pane="appearance">
7
- <AppearanceSettingsDashboard />
8
- </DashboardSettingsFrame>
6
+ <DashboardSettingsIntro pane="appearance" />
7
+ <AppearanceSettingsDashboard />
9
8
  @endsection
@@ -3,7 +3,6 @@
3
3
  @section('content')
4
4
  @title('Dashboard - Billing Settings')
5
5
 
6
- <DashboardSettingsFrame pane="billing">
7
- <BillingSettings />
8
- </DashboardSettingsFrame>
6
+ <DashboardSettingsIntro pane="billing" />
7
+ <BillingSettings />
9
8
  @endsection
@@ -0,0 +1,22 @@
1
+ @extends('layouts/settings')
2
+
3
+ <script server>
4
+ import { projectConfigSection } from '@stacksjs/defaults/resources/functions/dashboard/project-config-sections'
5
+
6
+ const section = projectConfigSection(typeof params === 'undefined' ? '' : params.section)
7
+ export const configPane = section?.id ?? 'general'
8
+ export const settingsTitle = section ? `Dashboard - ${section.label}` : 'Dashboard - Settings'
9
+ export const knownConfigPane = Boolean(section && section.id !== 'general')
10
+ if (!knownConfigPane)
11
+ setResponseStatus(404)
12
+ </script>
13
+
14
+ @section('content')
15
+ @title(settingsTitle)
16
+
17
+ @if(knownConfigPane)
18
+ <SettingsDashboard :section="configPane" />
19
+ @else
20
+ <p class="p-4 text-sm">This configuration section could not be found.</p>
21
+ @endif
22
+ @endsection
@@ -1,4 +1,4 @@
1
- @extends('layouts/default')
1
+ @extends('layouts/settings')
2
2
 
3
3
  @section('content')
4
4
  @title('Dashboard - Environment')
@@ -3,7 +3,5 @@
3
3
  @section('content')
4
4
  @title('Dashboard - Settings')
5
5
 
6
- <DashboardSettingsFrame pane="general">
7
- <SettingsDashboard />
8
- </DashboardSettingsFrame>
6
+ <SettingsDashboard />
9
7
  @endsection
@@ -3,7 +3,6 @@
3
3
  @section('content')
4
4
  @title('Dashboard - Mail Settings')
5
5
 
6
- <DashboardSettingsFrame pane="mail">
7
- <MailSettingsDashboard />
8
- </DashboardSettingsFrame>
6
+ <DashboardSettingsIntro pane="mail" />
7
+ <MailSettingsDashboard />
9
8
  @endsection
@@ -3,7 +3,6 @@
3
3
  @section('content')
4
4
  @title('Dashboard - Software Update')
5
5
 
6
- <DashboardSettingsFrame pane="software-update">
7
- <SoftwareUpdateDashboard />
8
- </DashboardSettingsFrame>
6
+ <DashboardSettingsIntro pane="software-update" />
7
+ <SoftwareUpdateDashboard />
9
8
  @endsection
@@ -1,73 +0,0 @@
1
- <script client>
2
- type CodeEditorLanguage = 'env' | 'json' | 'typescript' | 'text'
3
-
4
- const liveValue = useReactiveProp('value', '')
5
- const liveLanguage = useReactiveProp('language', 'text' as CodeEditorLanguage)
6
- const liveLabel = useReactiveProp('label', 'Code editor')
7
- const liveLoading = useReactiveProp('loading', false)
8
- const liveReadonly = useReactiveProp('readonly', false)
9
- const emit = defineEmits(['update:value', 'input', 'save', 'format'])
10
-
11
- const lineCount = derived(() => Math.max(1, liveValue().split('\n').length))
12
- const characterCount = derived(() => liveValue().length)
13
-
14
- function inputValue(event: Event): string {
15
- return (event.target as HTMLTextAreaElement).value
16
- }
17
-
18
- function handleInput(event: Event): void {
19
- const value = inputValue(event)
20
- emit('update:value', value)
21
- emit('input', value)
22
- }
23
-
24
- function handleKeydown(event: KeyboardEvent): void {
25
- if (!(event.metaKey || event.ctrlKey))
26
- return
27
-
28
- if (event.key.toLowerCase() === 's') {
29
- event.preventDefault()
30
- emit('save')
31
- }
32
- else if (event.shiftKey && event.key.toLowerCase() === 'f') {
33
- event.preventDefault()
34
- emit('format')
35
- }
36
- }
37
- </script>
38
-
39
- <div class="overflow-hidden bg-[#0d1117] border border-[#30363d] rounded-xl shadow-sm">
40
- <div class="flex items-center justify-between px-4 py-3 bg-[#161b22] border-[#30363d] border-b">
41
- <div class="flex gap-3 items-center min-w-0">
42
- <div class="flex gap-1.5" aria-hidden="true">
43
- <span class="h-2.5 w-2.5 bg-[#f85149] rounded-full"></span>
44
- <span class="h-2.5 w-2.5 bg-[#db9d16] rounded-full"></span>
45
- <span class="h-2.5 w-2.5 bg-[#2ea043] rounded-full"></span>
46
- </div>
47
- <span class="font-mono text-[#c9d1d9] text-xs truncate" :text="liveLabel()"></span>
48
- </div>
49
- <div class="flex gap-2 items-center">
50
- <span :if="liveLoading()" class="h-3.5 w-3.5 text-[#8c959f] animate-spin i-hugeicons-loading-03" aria-label="Loading"></span>
51
- <span class="px-2 py-0.5 font-semibold text-[#8c959f] text-[10px] uppercase bg-[#21262d] border border-[#30363d] rounded" :text="liveLanguage()"></span>
52
- </div>
53
- </div>
54
-
55
- <textarea
56
- x-model="liveValue"
57
- :aria-label="liveLabel()"
58
- :readonly="liveReadonly()"
59
- :disabled="liveLoading()"
60
- spellcheck="false"
61
- autocomplete="off"
62
- autocapitalize="off"
63
- rows="24"
64
- class="block p-4 min-h-[28rem] w-full font-mono leading-6 text-[#c9d1d9] text-[13px] bg-[#0d1117] border-0 outline-none focus:ring-2 focus:ring-blue-500/40 focus:ring-inset disabled:opacity-60 resize-y"
65
- @input="handleInput"
66
- @keydown="handleKeydown"
67
- ></textarea>
68
-
69
- <div class="flex items-center justify-between px-4 py-2 font-mono text-[#8c959f] text-[10px] bg-[#161b22] border-[#30363d] border-t">
70
- <span :text="`${lineCount()} lines`"></span>
71
- <span :text="`${characterCount()} characters`"></span>
72
- </div>
73
- </div>