@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,165 @@
1
+ <script client>
2
+ import { dashboardApi } from '@stacksjs/defaults/functions/dashboard-api'
3
+
4
+ interface Issue {
5
+ repository: string
6
+ number: number
7
+ title: string
8
+ state: 'open' | 'closed'
9
+ updatedAt: string
10
+ labels: string[]
11
+ url: string
12
+ }
13
+
14
+ interface IssuesSnapshot {
15
+ projects: Array<{ id: string, name: string, repository: string | null }>
16
+ issues: Issue[]
17
+ failures: Array<{ repository: string, message: string }>
18
+ loading: boolean
19
+ }
20
+
21
+ const snapshot = state<IssuesSnapshot | null>(null)
22
+ const requesting = state(true)
23
+ const error = state('')
24
+ const search = state('')
25
+ const projectId = state('')
26
+ const status = state('all')
27
+ const page = state(1)
28
+ const pageSize = 30
29
+ const dateFormat = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium' })
30
+ const statusOptions = [
31
+ { value: 'all', label: 'All statuses' },
32
+ { value: 'open', label: 'Open' },
33
+ { value: 'closed', label: 'Closed' },
34
+ ]
35
+
36
+ const loading = derived(() => requesting() || Boolean(snapshot()?.loading))
37
+ const projects = derived(() => snapshot()?.projects ?? [])
38
+ const connected = derived(() => projects().filter(project => project.repository))
39
+ const disconnected = derived(() => projects().filter(project => !project.repository))
40
+ const projectOptions = derived(() => [
41
+ { value: '', label: 'All projects' },
42
+ ...connected().map(project => ({ value: project.id, label: `${project.name} · ${project.repository}` })),
43
+ ])
44
+ const selectedRepository = derived(() => connected().find(project => project.id === projectId())?.repository)
45
+ const filtered = derived(() => {
46
+ const query = search().trim().toLowerCase()
47
+ const repository = selectedRepository()
48
+ const issueStatus = status()
49
+ return (snapshot()?.issues ?? []).filter(issue =>
50
+ (!repository || issue.repository === repository)
51
+ && (issueStatus === 'all' || issue.state === issueStatus)
52
+ && (!query || `${issue.title} ${issue.repository} #${issue.number} ${issue.labels.join(' ')}`.toLowerCase().includes(query)),
53
+ )
54
+ })
55
+ const visible = derived(() => filtered().slice((page() - 1) * pageSize, page() * pageSize))
56
+ const failures = derived(() => snapshot()?.failures ?? [])
57
+ const emptyMessage = derived(() => {
58
+ if (!connected().length)
59
+ return 'No local Stacks projects with a GitHub remote.'
60
+ if (failures().length)
61
+ return 'No matching issues in the results GitHub returned.'
62
+ return 'No issues match these filters.'
63
+ })
64
+
65
+ function resetPage(): void {
66
+ page.set(1)
67
+ }
68
+
69
+ async function load(mode: 'initial' | 'refresh' | 'poll' = 'initial'): Promise<void> {
70
+ if (mode !== 'poll') {
71
+ requesting.set(true)
72
+ error.set('')
73
+ resetPage()
74
+ }
75
+ try {
76
+ const query = mode === 'initial' ? '' : `?${mode}=1`
77
+ const next = await dashboardApi<IssuesSnapshot>(`/__buddy/github-issues${query}`, { auth: false })
78
+ snapshot.set(next)
79
+ if (projectId() && !next.projects.some(project => project.id === projectId() && project.repository))
80
+ projectId.set('')
81
+ }
82
+ catch (failure) {
83
+ error.set(failure instanceof Error ? failure.message : 'Could not load GitHub issues.')
84
+ const previous = snapshot()
85
+ if (previous?.loading)
86
+ snapshot.set({ ...previous, loading: false })
87
+ }
88
+ finally {
89
+ requesting.set(false)
90
+ }
91
+ }
92
+
93
+ let polling = false
94
+ useInterval(async () => {
95
+ if (!snapshot()?.loading || requesting() || polling)
96
+ return
97
+ polling = true
98
+ try {
99
+ await load('poll')
100
+ }
101
+ finally {
102
+ polling = false
103
+ }
104
+ }, 1_500)
105
+ onMount(() => { void load() })
106
+ </script>
107
+
108
+ <div class="flex flex-col gap-5">
109
+ <PageHeader title="GitHub Issues" description="Open and closed issues across your local Stacks projects.">
110
+ <Button variant="secondary" :loading="loading()" @click="load('refresh')">
111
+ <span :if="!loading()" aria-hidden="true" class="h-4 w-4 i-hugeicons-refresh"></span>
112
+ Refresh
113
+ </Button>
114
+ </PageHeader>
115
+
116
+ <p :if="error()" role="alert" class="px-4 py-3 text-red-800 text-sm dark:text-red-200 bg-red-50 dark:bg-red-950/30 border border-red-200 rounded-lg dark:border-red-900" :text="error()"></p>
117
+ <aside :if="failures().length" role="status" class="px-4 py-3 text-amber-900 text-sm dark:text-amber-200 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 rounded-lg dark:border-amber-900">
118
+ <p class="font-medium">Some repositories could only be loaded partially or were unavailable.</p>
119
+ <ul class="mt-1 space-y-1">
120
+ <li :for="failure in failures()"><span class="font-medium" :text="failure.repository"></span><span class="ml-2" :text="failure.message"></span></li>
121
+ </ul>
122
+ </aside>
123
+
124
+ <section aria-label="Issues" :aria-busy="loading()" class="overflow-hidden bg-white dark:bg-neutral-900 border border-gray-200 rounded-lg dark:border-neutral-800">
125
+ <div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-[minmax(0,1fr)_minmax(0,16rem)_9rem] p-4 border-b border-gray-200 dark:border-neutral-800">
126
+ <SearchFilter v-model:searchValue="search" @search="resetPage" placeholder="Search issues" ariaLabel="Search issues" class="sm:col-span-2 lg:col-span-1" />
127
+ <Select v-model:value="projectId" @change="resetPage" ariaLabel="Filter by project" placeholder="" :options="projectOptions()" />
128
+ <Select v-model:value="status" @change="resetPage" ariaLabel="Filter by status" placeholder="" :options="statusOptions" />
129
+ </div>
130
+
131
+ <p :if="loading() && !filtered().length" role="status" class="px-4 py-14 text-center text-gray-500 text-sm dark:text-neutral-400">Loading GitHub issues…</p>
132
+ <p :else-if="snapshot() && !filtered().length" role="status" class="px-4 py-14 text-center text-gray-500 text-sm dark:text-neutral-400" :text="emptyMessage()"></p>
133
+ <ul :else-if="snapshot()" class="divide-gray-200 divide-y dark:divide-neutral-800">
134
+ <li :for="issue in visible()" :key="issue.url">
135
+ <a :href="issue.url" target="_blank" rel="noopener noreferrer" class="flex gap-3 items-start px-4 py-3 hover:bg-gray-50 dark:hover:bg-neutral-800/60 focus-visible:outline-2 focus-visible:outline-blue-500 focus-visible:-outline-offset-2">
136
+ <span :class="issue.state === 'open' ? 'text-green-600 dark:text-green-400 i-hugeicons-circle' : 'text-violet-600 dark:text-violet-400 i-hugeicons-checkmark-circle-02'" class="shrink-0 mt-0.5 h-5 w-5" aria-hidden="true"></span>
137
+ <div class="flex-1 min-w-0">
138
+ <p class="break-words font-medium text-gray-900 text-sm dark:text-white" :text="issue.title"></p>
139
+ <div class="flex flex-wrap gap-x-2 gap-y-1 items-center mt-1 text-gray-500 text-xs dark:text-neutral-400">
140
+ <span class="break-all" :text="issue.repository + ' #' + issue.number"></span>
141
+ <span aria-hidden="true">·</span>
142
+ <span :text="issue.state === 'open' ? 'Open' : 'Closed'"></span>
143
+ <span aria-hidden="true">·</span>
144
+ <time :datetime="issue.updatedAt" :text="'Updated ' + dateFormat.format(new Date(issue.updatedAt))"></time>
145
+ <span :for="label in issue.labels" class="px-2 py-0.5 break-words text-gray-700 dark:text-neutral-200 bg-gray-100 dark:bg-neutral-800 rounded-full" :text="label"></span>
146
+ </div>
147
+ </div>
148
+ <span class="shrink-0 mt-0.5 h-4 w-4 text-gray-400 i-hugeicons-arrow-up-right-01" aria-hidden="true"></span>
149
+ </a>
150
+ </li>
151
+ </ul>
152
+
153
+ <div :if="filtered().length > pageSize" class="px-4 py-3 border-gray-200 border-t dark:border-neutral-800">
154
+ <Pagination :currentPage="page()" :totalItems="filtered().length" :itemsPerPage="pageSize" @page="page.set($event)" />
155
+ </div>
156
+ <p :if="loading() && filtered().length" role="status" class="px-4 py-3 text-gray-500 text-xs dark:text-neutral-400 border-gray-200 border-t dark:border-neutral-800">Loading more issues from GitHub…</p>
157
+ </section>
158
+
159
+ <details :if="disconnected().length" class="text-gray-600 text-sm dark:text-neutral-400">
160
+ <summary class="cursor-pointer">{{ disconnected().length }} local projects without a GitHub remote</summary>
161
+ <ul class="flex flex-wrap gap-x-4 gap-y-1 mt-2 pl-4">
162
+ <li :for="project in disconnected()" :text="project.name"></li>
163
+ </ul>
164
+ </details>
165
+ </div>
@@ -0,0 +1,10 @@
1
+ <script server>
2
+ import { settingsPanes } from '@stacksjs/defaults/resources/functions/dashboard/settings-panes'
3
+
4
+ const { pane } = defineProps<{ pane: string }>()
5
+ export const introduction = settingsPanes.find(item => item.id === pane)
6
+ </script>
7
+
8
+ @if(introduction?.description)
9
+ <SettingsPaneHeader :title="introduction.label" :description="introduction.description" :icon="introduction.icon" :tone="introduction.tone" />
10
+ @endif
@@ -0,0 +1,32 @@
1
+ <script client>
2
+ import { useSettingsWindow } from '@stacksjs/defaults/views/dashboard/composables/useSettingsWindow'
3
+
4
+ const settingsWindow = useSettingsWindow
5
+ const query = settingsWindow.query
6
+ const search = useRef<HTMLInputElement>('settingsSearch')
7
+ const emit = defineEmits(['open-result'])
8
+
9
+ useEventListener('keydown', (event: KeyboardEvent) => {
10
+ if (!(event.metaKey || event.ctrlKey) || event.key.toLowerCase() !== 'f')
11
+ return
12
+ event.preventDefault()
13
+ settingsWindow.browserNavOpen.set(true)
14
+ nextTick(() => {
15
+ search.current?.focus()
16
+ search.current?.select()
17
+ })
18
+ })
19
+
20
+ function clearSearch(event: KeyboardEvent): void {
21
+ if (event.key === 'Escape' && query()) {
22
+ event.preventDefault()
23
+ query.set('')
24
+ }
25
+ }
26
+ </script>
27
+
28
+ <form class="dashboard-settings-search" role="search" @submit.prevent="emit('open-result')">
29
+ <span class="i-f7-search" aria-hidden="true"></span>
30
+ <input x-model="query" ref="settingsSearch" type="search" placeholder="Search settings" aria-label="Search settings"
31
+ autocomplete="off" @keydown="clearSearch($event)">
32
+ </form>
@@ -0,0 +1,181 @@
1
+ <script client>
2
+ import { DashboardApiError, dashboardApi } from '@stacksjs/defaults/functions/dashboard-api'
3
+
4
+ interface DnsRecordRow {
5
+ type: string
6
+ name: string
7
+ value: string
8
+ ttl?: number | 'auto'
9
+ priority?: number
10
+ }
11
+
12
+ interface DnsSnapshot {
13
+ domains: string[]
14
+ records: DnsRecordRow[]
15
+ revision: string
16
+ }
17
+
18
+ const emit = defineEmits(['saved'])
19
+ const snapshot = state<DnsSnapshot | null>(null)
20
+ const loading = state(true)
21
+ const saving = state(false)
22
+ const showAdd = state(false)
23
+ const error = state('')
24
+ const formError = state('')
25
+ const savedMessage = state('')
26
+
27
+ const recordType = state<'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT'>('TXT')
28
+ const recordDomain = state('')
29
+ const recordHost = state('@')
30
+ const recordValue = state('')
31
+ const recordTtl = state('600')
32
+ const recordPriority = state('10')
33
+
34
+ const recordTypes = [
35
+ { value: 'TXT', label: 'TXT · Text or verification' },
36
+ { value: 'CNAME', label: 'CNAME · Host alias' },
37
+ { value: 'A', label: 'A · IPv4 address' },
38
+ { value: 'AAAA', label: 'AAAA · IPv6 address' },
39
+ { value: 'MX', label: 'MX · Mail server' },
40
+ ]
41
+ const domainOptions = derived(() => (snapshot()?.domains ?? []).map(domain => ({ value: domain, label: domain })))
42
+ const recordRows = derived(() => snapshot()?.records ?? [])
43
+ const hostname = derived(() => {
44
+ const domain = recordDomain()
45
+ const host = recordHost().trim().toLowerCase().replace(/\.$/, '')
46
+ if (!host || host === '@' || host === domain)
47
+ return domain
48
+ return host.endsWith(`.${domain}`) ? host : `${host}.${domain}`
49
+ })
50
+ const valueLabel = derived(() => ({ A: 'IPv4 address', AAAA: 'IPv6 address', CNAME: 'Target hostname', MX: 'Mail server', TXT: 'Text' })[recordType()] ?? 'Value')
51
+ const valueHint = derived(() => ({ A: 'A public IPv4 address', AAAA: 'A public IPv6 address', CNAME: 'For example, hosted.example.com', MX: 'For example, mail.example.com', TXT: 'Paste the verification token or TXT value.' })[recordType()] ?? '')
52
+
53
+ async function loadRecords(): Promise<void> {
54
+ loading.set(true)
55
+ error.set('')
56
+ try {
57
+ snapshot.set(await dashboardApi<DnsSnapshot>('/api/config/dns', { projectConfig: true }))
58
+ }
59
+ catch (cause) {
60
+ error.set(cause instanceof Error ? cause.message : 'Could not load DNS records.')
61
+ }
62
+ finally {
63
+ loading.set(false)
64
+ }
65
+ }
66
+
67
+ function openAdd(): void {
68
+ recordDomain.set(snapshot()?.domains[0] ?? '')
69
+ recordType.set('TXT')
70
+ recordHost.set('@')
71
+ recordValue.set('')
72
+ recordTtl.set('600')
73
+ recordPriority.set('10')
74
+ formError.set('')
75
+ savedMessage.set('')
76
+ showAdd.set(true)
77
+ }
78
+
79
+ function closeAdd(): void {
80
+ if (!saving())
81
+ showAdd.set(false)
82
+ }
83
+
84
+ async function saveRecord(): Promise<void> {
85
+ const current = snapshot()
86
+ if (!current || saving())
87
+ return
88
+ saving.set(true)
89
+ formError.set('')
90
+ try {
91
+ const updated = await dashboardApi('/api/config/dns/add', {
92
+ method: 'POST',
93
+ projectConfig: true,
94
+ body: {
95
+ revision: current.revision,
96
+ record: {
97
+ type: recordType(),
98
+ domain: recordDomain(),
99
+ host: recordHost(),
100
+ value: recordValue(),
101
+ ttl: Number(recordTtl()),
102
+ ...(recordType() === 'MX' && { priority: Number(recordPriority()) }),
103
+ },
104
+ },
105
+ })
106
+ emit('saved', updated)
107
+ showAdd.set(false)
108
+ savedMessage.set('Saved to config/dns.ts. Your next deployment will add the record if it is missing.')
109
+ await loadRecords()
110
+ }
111
+ catch (cause) {
112
+ formError.set(cause instanceof Error ? cause.message : 'Could not save the DNS record.')
113
+ if (cause instanceof DashboardApiError && cause.status === 409)
114
+ await loadRecords()
115
+ }
116
+ finally {
117
+ saving.set(false)
118
+ }
119
+ }
120
+
121
+ onMount(loadRecords)
122
+ </script>
123
+
124
+ <div class="dashboard-dns-settings">
125
+ <div class="dashboard-dns-toolbar">
126
+ <p class="dashboard-config-intro">Deployments add missing records for the selected app domain. Conflicting provider records are reported and kept.</p>
127
+ <Button size="sm" :disabled="loading() || domainOptions().length === 0" @click="openAdd">
128
+ <span class="h-4 w-4 i-hugeicons-add-01" aria-hidden="true"></span>
129
+ Add record
130
+ </Button>
131
+ </div>
132
+
133
+ <p :if="loading()" class="dashboard-config-intro" role="status">Loading DNS records…</p>
134
+ <div :if="error()" class="flex flex-wrap gap-2 items-center" role="alert">
135
+ <p class="text-red-700 text-sm dark:text-red-400" :text="error()"></p>
136
+ <Button variant="secondary" size="sm" @click="loadRecords">Retry</Button>
137
+ </div>
138
+ <p :if="savedMessage()" class="text-green-700 text-sm dark:text-green-400" role="status" :text="savedMessage()"></p>
139
+ <p :if="!loading() && snapshot() && domainOptions().length === 0" class="dashboard-config-intro">
140
+ Set a public deployment domain in <a href="/settings/config/cloud?file=cloud" data-stx-link data-stx-transition="none">Cloud &amp; Domains</a> to add records.
141
+ </p>
142
+ <p :if="!loading() && domainOptions().length > 0" class="dashboard-config-intro"
143
+ :text="'Application domains: ' + (snapshot()?.domains ?? []).join(', ')"></p>
144
+ <p :if="!loading() && !error() && recordRows().length === 0" class="dashboard-config-intro">No extra DNS records declared.</p>
145
+
146
+ <div :if="recordRows().length > 0" class="dashboard-dns-record-list" role="list" aria-label="Declared DNS records">
147
+ <div :for="record in recordRows()" class="dashboard-dns-record-row" role="listitem">
148
+ <span class="dashboard-dns-type" :text="record.type"></span>
149
+ <div class="min-w-0">
150
+ <span class="block break-all font-medium text-sm" :text="record.name.replace(/\.$/, '') || '@'"></span>
151
+ <span class="dashboard-dns-value" :text="record.value"></span>
152
+ </div>
153
+ <span class="dashboard-dns-meta" :text="(typeof record.ttl === 'number' ? record.ttl + ' s' : 'Auto TTL') + (record.priority == null ? '' : ' · Priority ' + record.priority)"></span>
154
+ </div>
155
+ </div>
156
+
157
+ <Modal :isOpen="showAdd()" title="Add DNS record" size="md" @close="closeAdd">
158
+ <form class="flex flex-col gap-4" @submit.prevent="saveRecord">
159
+ <Select v-model:value="recordType" label="Record type" :options="recordTypes" :disabled="saving()" />
160
+ <Select v-model:value="recordDomain" label="App domain" :options="domainOptions()" :disabled="saving()" />
161
+ <Input v-model:value="recordHost" label="Host" placeholder="@" :hint="'Publishes at ' + hostname()" :spellcheck="false" :disabled="saving()" />
162
+ <div :if="recordType() === 'TXT'">
163
+ <Textarea v-model:value="recordValue" :label="valueLabel()" :hint="valueHint()" :rows="2" :required="true" :disabled="saving()" />
164
+ </div>
165
+ <div :else>
166
+ <Input v-model:value="recordValue" :label="valueLabel()" :hint="valueHint()" :required="true" :spellcheck="false" :disabled="saving()" />
167
+ </div>
168
+ <div class="grid gap-3 sm:grid-cols-2">
169
+ <Input v-model:value="recordTtl" type="number" label="TTL in seconds" min="600" step="1" :required="true" :disabled="saving()" />
170
+ <div :if="recordType() === 'MX'">
171
+ <Input v-model:value="recordPriority" type="number" label="Priority" min="0" max="65535" step="1" :required="true" :disabled="saving()" />
172
+ </div>
173
+ </div>
174
+ <p :if="formError()" class="text-red-700 text-sm dark:text-red-400" role="alert" :text="formError()"></p>
175
+ <div class="flex gap-2 justify-end">
176
+ <Button type="button" variant="secondary" :disabled="saving()" @click="closeAdd">Cancel</Button>
177
+ <Button type="submit" :loading="saving()">Save DNS record</Button>
178
+ </div>
179
+ </form>
180
+ </Modal>
181
+ </div>
@@ -333,12 +333,12 @@ onMount(() => void loadSettings())
333
333
  <SettingsGroup header="Sender and driver">
334
334
  <div class="p-3">
335
335
  <div class="grid gap-4 md:grid-cols-2">
336
- <Select
337
- v-model:value="driver"
336
+ <SettingsPicker
337
+ :value="driver()"
338
338
  :options="driverOptions"
339
339
  label="Mail driver"
340
- placeholder=""
341
- required
340
+ :disabled="isBusy()"
341
+ @change="driver.set($event)"
342
342
  :error="fieldError('driver')"
343
343
  />
344
344
  <Input
@@ -369,7 +369,9 @@ onMount(() => void loadSettings())
369
369
  <Input v-model:value="smtpHost" label="Host" placeholder="smtp.example.com" required :error="fieldError('smtp.host')" />
370
370
  <Input v-model:value="smtpPort" type="number" label="Port" placeholder="587" required :error="fieldError('smtp.port')" />
371
371
  <Input v-model:value="smtpUsername" label="Username" placeholder="mailer@example.com" :error="fieldError('smtp.username')" />
372
- <Select v-model:value="smtpEncryption" :options="encryptionOptions" label="Encryption" placeholder="" hint="Match what your mail server expects. Most use STARTTLS on port 587." :error="fieldError('smtp.encryption')" />
372
+ <SettingsPicker :value="smtpEncryption()" :options="encryptionOptions" label="Encryption"
373
+ hint="Most mail servers use STARTTLS on port 587." :disabled="isBusy()"
374
+ :error="fieldError('smtp.encryption')" @change="smtpEncryption.set($event)" />
373
375
  <div class="md:col-span-2">
374
376
  <Input
375
377
  v-model:value="smtpPassword"
@@ -0,0 +1,27 @@
1
+ <script client>
2
+ const model = useModel('value', { default: '' })
3
+ const language = useReactiveProp('language', 'typescript')
4
+ const label = useReactiveProp('label', 'Configuration source')
5
+ const loading = useReactiveProp('loading', false)
6
+ const readonly = useReactiveProp('readonly', false)
7
+ const emit = defineEmits(['save', 'format'])
8
+
9
+ function handleKeydown(event: KeyboardEvent): void {
10
+ if (event.defaultPrevented || event.isComposing || !(event.metaKey || event.ctrlKey) || event.altKey)
11
+ return
12
+ const key = event.key.toLowerCase()
13
+ if (!event.shiftKey && key === 's') {
14
+ event.preventDefault()
15
+ emit('save')
16
+ }
17
+ else if (event.shiftKey && key === 'f' && !readonly() && !loading()) {
18
+ event.preventDefault()
19
+ emit('format')
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <div class="dashboard-settings-source" role="group" :aria-label="label()" @keydown="handleKeydown">
25
+ <CodeEditor :key="label()" v-model:value="model" :language="language()" label="Source text" :readonly="readonly()"
26
+ :disabled="loading()" :autoComplete="false" :hover="false" :signatureHelp="false" height="22rem" />
27
+ </div>