@stacksjs/defaults 0.75.674 → 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.
- package/ai/skills/stacks-ai/SKILL.md +7 -2
- package/ai/skills/stacks-api/SKILL.md +1 -1
- package/ai/skills/stacks-dashboard/SKILL.md +9 -2
- package/ai/skills/stacks-deploy/SKILL.md +8 -0
- package/ai/skills/stacks-desktop/SKILL.md +31 -0
- package/ai/skills/stacks-development/SKILL.md +5 -7
- package/ai/skills/stacks-health/SKILL.md +19 -9
- package/ai/skills/stacks-native/CATALOG.md +24 -24
- package/ai/skills/stacks-newsletter/SKILL.md +10 -4
- package/ai/skills/stacks-router/SKILL.md +2 -2
- package/ai/skills/stacks-routes/SKILL.md +2 -2
- package/ai/skills/stacks-scheduler/SKILL.md +16 -2
- package/ai/skills/stacks-security/SKILL.md +24 -0
- package/ai/skills/stacks-socials/SKILL.md +17 -1
- package/ai/skills/stacks-storage/SKILL.md +34 -15
- package/app/Actions/SubscriberEmailAction.ts +26 -10
- package/app/Jobs/Inspire.ts +33 -0
- package/functions/dashboard-sidebar-order.ts +3 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +8 -7
- package/project/storage/framework/types/request-context.d.ts +3 -0
- package/resources/components/Dashboard/Billing/BillingPaymentMethodsPanel.stx +3 -10
- package/resources/components/Dashboard/Billing/BillingPlanSummary.stx +3 -10
- package/resources/components/Dashboard/Billing/BillingSettings.stx +13 -15
- package/resources/components/Dashboard/Billing/BillingTransactionHistory.stx +2 -9
- package/resources/components/Dashboard/DashboardSectionLanding.stx +72 -0
- package/resources/components/Dashboard/DashboardSectionSidebar.stx +78 -0
- package/resources/components/Dashboard/GlobalSearch.stx +3 -1
- package/resources/components/Dashboard/Home/DashboardHome.stx +14 -1
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +21 -92
- package/resources/components/Dashboard/Settings/DashboardSettingsFrame.stx +98 -0
- package/resources/components/Dashboard/Settings/DashboardThemePicker.stx +4 -9
- package/resources/components/Dashboard/Settings/MailSettingsDashboard.stx +162 -167
- package/resources/components/Dashboard/Settings/SettingsDashboard.stx +34 -30
- package/resources/components/Dashboard/Settings/SoftwareUpdateDashboard.stx +229 -0
- package/resources/components/Dashboard/UI/DashboardNavigationCards.stx +44 -0
- package/resources/components/Dashboard/UI/Input.stx +1 -0
- package/resources/components/Dashboard/UI/Select.stx +1 -0
- package/resources/components/Dashboard/UI/Table.stx +1 -0
- package/resources/components/Dashboard/UI/Textarea.stx +1 -0
- package/resources/components/Marketing/SubscribeForm.stx +29 -8
- package/resources/functions/dashboard/section-landing.ts +201 -0
- package/resources/functions/dashboard/section-navigation.ts +95 -0
- package/styles/dashboard-theme.css +778 -9
- package/views/dashboard/composables/dashboard-themes.ts +5 -5
- package/views/dashboard/composables/settings-window.ts +116 -0
- package/views/dashboard/composables/useAppearance.ts +13 -4
- package/views/dashboard/composables/useDashboardThemes.ts +2 -1
- package/views/dashboard/composables/useSettingsWindow.ts +23 -0
- package/views/dashboard/layouts/default.stx +32 -20
- package/views/dashboard/layouts/settings.stx +48 -0
- package/views/dashboard/sections/[section].stx +19 -0
- package/views/dashboard/settings/appearance.stx +4 -2
- package/views/dashboard/settings/billing.stx +3 -4
- package/views/dashboard/settings/index.stx +4 -2
- package/views/dashboard/settings/mail.stx +3 -3
- package/views/dashboard/settings/software-update.stx +9 -0
|
@@ -16,7 +16,7 @@ export interface DashboardTheme {
|
|
|
16
16
|
name: string
|
|
17
17
|
description?: string
|
|
18
18
|
layout: 'flush' | 'inset'
|
|
19
|
-
navigation: 'plain' | 'tiles'
|
|
19
|
+
navigation: 'plain' | 'tiles' | 'sections'
|
|
20
20
|
overview: 'panel' | 'immersive'
|
|
21
21
|
radius: number
|
|
22
22
|
light: ThemePalette
|
|
@@ -32,9 +32,9 @@ export const SYSTEM_CLEANER_THEME: DashboardTheme = {
|
|
|
32
32
|
version: 1,
|
|
33
33
|
id: 'system-cleaner',
|
|
34
34
|
name: 'System Cleaner',
|
|
35
|
-
description: 'A
|
|
35
|
+
description: 'A violet overview, a flat sidebar, and color-coded section pages.',
|
|
36
36
|
layout: 'inset',
|
|
37
|
-
navigation: '
|
|
37
|
+
navigation: 'sections',
|
|
38
38
|
overview: 'immersive',
|
|
39
39
|
radius: 14,
|
|
40
40
|
light: {
|
|
@@ -101,8 +101,8 @@ export function parseDashboardTheme(value: unknown): DashboardTheme {
|
|
|
101
101
|
throw new Error('Keep the description to 180 characters or fewer.')
|
|
102
102
|
if (layout !== 'flush' && layout !== 'inset')
|
|
103
103
|
throw new Error('Choose either flush or inset for layout.')
|
|
104
|
-
if (navigation !== 'plain' && navigation !== 'tiles')
|
|
105
|
-
throw new Error('Choose
|
|
104
|
+
if (navigation !== 'plain' && navigation !== 'tiles' && navigation !== 'sections')
|
|
105
|
+
throw new Error('Choose plain, tiles, or sections for navigation.')
|
|
106
106
|
if (overview !== 'panel' && overview !== 'immersive')
|
|
107
107
|
throw new Error('Choose either panel or immersive for overview.')
|
|
108
108
|
if (typeof radius !== 'number' || !Number.isInteger(radius) || radius < 0 || radius > 24)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { nativeWindow } from '@stacksjs/desktop/browser'
|
|
2
|
+
|
|
3
|
+
const windowName = 'stacks-dashboard-settings'
|
|
4
|
+
const paneChannel = 'stacks.dashboard.settings-pane'
|
|
5
|
+
const settingsPaths = ['/settings', '/settings/appearance', '/settings/mail', '/settings/billing', '/settings/software-update']
|
|
6
|
+
let browserWindow: Window | null = null
|
|
7
|
+
|
|
8
|
+
export function isDashboardSettingsPath(path: string): boolean {
|
|
9
|
+
return settingsPaths.includes(path.replace(/\/+$/, ''))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Return false when the link should continue through ordinary navigation. */
|
|
13
|
+
export function openDashboardSettings(href = '/settings'): boolean {
|
|
14
|
+
let url: URL
|
|
15
|
+
try {
|
|
16
|
+
url = new URL(href, location.href)
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false
|
|
20
|
+
}
|
|
21
|
+
if (url.origin !== location.origin || !isDashboardSettingsPath(url.pathname) || isDashboardSettingsPath(location.pathname))
|
|
22
|
+
return false
|
|
23
|
+
|
|
24
|
+
if (nativeWindow.available) {
|
|
25
|
+
void nativeWindow.open({
|
|
26
|
+
name: windowName,
|
|
27
|
+
url: url.href,
|
|
28
|
+
title: 'Stacks Settings',
|
|
29
|
+
width: 746,
|
|
30
|
+
height: 680,
|
|
31
|
+
minWidth: 668,
|
|
32
|
+
minHeight: 480,
|
|
33
|
+
titlebarHidden: true,
|
|
34
|
+
webWindowMaterial: true,
|
|
35
|
+
chromeControls: false,
|
|
36
|
+
persistentStorage: true,
|
|
37
|
+
}).then(() => {
|
|
38
|
+
// Craft focuses an existing named window and leaves its webview in place.
|
|
39
|
+
// A pane-specific link can request a change from that existing webview.
|
|
40
|
+
if (url.pathname !== '/settings' && typeof BroadcastChannel !== 'undefined') {
|
|
41
|
+
const channel = new BroadcastChannel(paneChannel)
|
|
42
|
+
channel.postMessage(url.pathname + url.search + url.hash)
|
|
43
|
+
channel.close()
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
return true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!browserWindow || browserWindow.closed) {
|
|
50
|
+
browserWindow = window.open(url.href, windowName, 'popup,width=746,height=680')
|
|
51
|
+
if (!browserWindow)
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
54
|
+
else if (url.pathname !== '/settings') {
|
|
55
|
+
// An authentication redirect can temporarily take the popup off-origin.
|
|
56
|
+
// Its URL is writeable even when its current value cannot be read.
|
|
57
|
+
let current: string | undefined
|
|
58
|
+
try { current = browserWindow.location.href }
|
|
59
|
+
catch {}
|
|
60
|
+
if (current !== url.href)
|
|
61
|
+
browserWindow.location.href = url.href
|
|
62
|
+
}
|
|
63
|
+
browserWindow.focus()
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function handleDashboardSettingsClick(event: MouseEvent): void {
|
|
68
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
69
|
+
return
|
|
70
|
+
const link = event.target instanceof Element ? event.target.closest<HTMLAnchorElement>('a[href]') : null
|
|
71
|
+
if (!link || link.hasAttribute('download') || (link.target && link.target !== '_self'))
|
|
72
|
+
return
|
|
73
|
+
if (openDashboardSettings(link.href)) {
|
|
74
|
+
event.preventDefault()
|
|
75
|
+
event.stopPropagation()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function listenForSettingsPane(navigate: (href: string) => void): () => void {
|
|
80
|
+
if (typeof BroadcastChannel === 'undefined' || !nativeWindow.available)
|
|
81
|
+
return () => {}
|
|
82
|
+
const channel = new BroadcastChannel(paneChannel)
|
|
83
|
+
channel.onmessage = ({ data }) => {
|
|
84
|
+
if (typeof data !== 'string' || !data.startsWith('/') || data.startsWith('//'))
|
|
85
|
+
return
|
|
86
|
+
const url = new URL(data, location.href)
|
|
87
|
+
if (url.origin === location.origin && isDashboardSettingsPath(url.pathname) && url.href !== location.href)
|
|
88
|
+
navigate(url.pathname + url.search + url.hash)
|
|
89
|
+
}
|
|
90
|
+
return () => channel.close()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function listenForSettingsCommand(open: () => void): (() => void) | undefined {
|
|
94
|
+
return (window as Window & { craft?: { settings?: { onOpen?: (handler: () => void) => () => void } } }).craft?.settings?.onOpen?.(open)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function isNativeSettingsWindow(): boolean {
|
|
98
|
+
return nativeWindow.available
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function dragSettingsWindow(event: MouseEvent): void {
|
|
102
|
+
if (event.button === 0 && event.target === event.currentTarget)
|
|
103
|
+
void nativeWindow.startDrag()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function setSettingsWindowAppearance(mode: 'system' | 'light' | 'dark'): void {
|
|
107
|
+
void nativeWindow.setAppearance(mode)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function returnToDashboard(event: MouseEvent): void {
|
|
111
|
+
if (window.opener && !window.opener.closed) {
|
|
112
|
+
event.preventDefault()
|
|
113
|
+
window.opener.focus()
|
|
114
|
+
window.close()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -312,17 +312,26 @@ export type AppearanceSnapshot = typeof appearanceStore
|
|
|
312
312
|
* mirroring happens here instead — otherwise `system` would be resolved once,
|
|
313
313
|
* at load, and changing the OS theme would do nothing until a reload.
|
|
314
314
|
*/
|
|
315
|
-
function
|
|
316
|
-
if (typeof window === 'undefined'
|
|
315
|
+
function installAppearanceListeners(): void {
|
|
316
|
+
if (typeof window === 'undefined')
|
|
317
317
|
return
|
|
318
|
-
window.
|
|
318
|
+
window.addEventListener('storage', (event) => {
|
|
319
|
+
if (event.key !== APPEARANCE_STORAGE_KEY && event.key !== null)
|
|
320
|
+
return
|
|
321
|
+
const next = readStoredAppearance()
|
|
322
|
+
appearanceStore.sidebarStyle.set(next.sidebarStyle)
|
|
323
|
+
appearanceStore.colorMode.set(next.colorMode)
|
|
324
|
+
appearanceStore.hiddenSections.set(next.hiddenSections)
|
|
325
|
+
appearanceStore.apply()
|
|
326
|
+
})
|
|
327
|
+
window.matchMedia?.('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
319
328
|
const store = appearanceStore
|
|
320
329
|
if (store.colorMode() === 'system')
|
|
321
330
|
store.apply()
|
|
322
331
|
})
|
|
323
332
|
}
|
|
324
333
|
|
|
325
|
-
|
|
334
|
+
installAppearanceListeners()
|
|
326
335
|
|
|
327
336
|
export function useAppearance(): AppearanceSnapshot {
|
|
328
337
|
return appearanceStore
|
|
@@ -25,6 +25,7 @@ const dashboardThemeStore = defineStore('dashboard-themes', () => {
|
|
|
25
25
|
const preferences = state(read())
|
|
26
26
|
const active = derived(() => preferences().active)
|
|
27
27
|
const installed = derived(() => preferences().installed)
|
|
28
|
+
const sectionNavigation = derived(() => resolveDashboardTheme(active(), installed())?.navigation === 'sections')
|
|
28
29
|
|
|
29
30
|
function apply(next: DashboardThemePreferences): void {
|
|
30
31
|
preferences.set(next)
|
|
@@ -71,7 +72,7 @@ const dashboardThemeStore = defineStore('dashboard-themes', () => {
|
|
|
71
72
|
})
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
return { active, installed, select, install, remove, sync: () => apply(read()) }
|
|
75
|
+
return { active, installed, sectionNavigation, select, install, remove, sync: () => apply(read()) }
|
|
75
76
|
})
|
|
76
77
|
|
|
77
78
|
export function useDashboardThemes(): typeof dashboardThemeStore {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineStore, state } from '@stacksjs/stx'
|
|
2
|
+
|
|
3
|
+
const historyKey = 'stacksSettingsIndex'
|
|
4
|
+
|
|
5
|
+
export const useSettingsWindow = defineStore('dashboard-settings-window', () => {
|
|
6
|
+
const query = state('')
|
|
7
|
+
const index = state(0)
|
|
8
|
+
const lastIndex = state(0)
|
|
9
|
+
let initialized = false
|
|
10
|
+
|
|
11
|
+
function syncHistory(): void {
|
|
12
|
+
const saved = history.state?.[historyKey]
|
|
13
|
+
const isEntry = typeof saved === 'number'
|
|
14
|
+
const next = isEntry ? saved : initialized ? index() + 1 : 0
|
|
15
|
+
if (!isEntry)
|
|
16
|
+
history.replaceState({ ...history.state, [historyKey]: next }, '')
|
|
17
|
+
index.set(next)
|
|
18
|
+
lastIndex.set(isEntry ? Math.max(lastIndex(), next) : next)
|
|
19
|
+
initialized = true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return { query, index, lastIndex, syncHistory }
|
|
23
|
+
})
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
// `storage/framework/tsconfig.app.json` and falls back to the installed
|
|
18
18
|
// package when there is none, so it resolves in both layouts.
|
|
19
19
|
import { dashboardProjectIdentity } from '@stacksjs/defaults/resources/functions/dashboard/project-switcher'
|
|
20
|
+
import { buildDashboardSectionHubs } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
|
|
20
21
|
import { buildWebSidebarSections, webSidebarRoleMap } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
|
|
21
22
|
|
|
22
23
|
export const sidebarSections = buildWebSidebarSections()
|
|
24
|
+
export const sectionHubs = buildDashboardSectionHubs(sidebarSections)
|
|
23
25
|
|
|
24
26
|
// The project this dashboard serves, for the switcher at the top of the
|
|
25
27
|
// sidebar. Only its name: the list of other projects is fetched by the
|
|
@@ -54,9 +56,9 @@ defineClientPayload({ sidebarRoleMap, sidebarSections })
|
|
|
54
56
|
<!-- Dashboard icon stylesheet. Most dashboard icons are applied via dynamic
|
|
55
57
|
`:class="…"` bindings whose class names live in client script state, which the
|
|
56
58
|
stx Crosswind extractor cannot see, so their CSS is never generated inline and
|
|
57
|
-
they render as empty boxes. The
|
|
59
|
+
they render as empty boxes. The dashboard generates the full icon set once and
|
|
58
60
|
serves it here (browser-cached), instead of inlining ~260KB into every page.
|
|
59
|
-
Route: `/__deps/dashboard-icons.css` in actions/src/
|
|
61
|
+
Route: `/__deps/dashboard-icons.css` in actions/src/dashboard-assets.ts.
|
|
60
62
|
|
|
61
63
|
No angle-bracket tag names in this comment. stx parses them as elements, which
|
|
62
64
|
breaks OUT of the comment: the closing marker is then never emitted, and the
|
|
@@ -494,7 +496,9 @@ import type { ToastType } from '@stacksjs/defaults/functions/toasts'
|
|
|
494
496
|
import type { CraftSidebarSelectEvent } from '@stacksjs/defaults/functions/craft'
|
|
495
497
|
import { useToasts, dismissToast } from '@stacksjs/defaults/functions/toasts'
|
|
496
498
|
import { ensureCraftNativeSidebarMarker, useCraftSidebarSelection } from '@stacksjs/defaults/functions/craft'
|
|
497
|
-
import {
|
|
499
|
+
import { dashboardNavigationPath } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
|
|
500
|
+
import { useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
|
|
501
|
+
import { handleDashboardSettingsClick, listenForSettingsCommand, openDashboardSettings } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
|
|
498
502
|
import { useDashboardThemes } from '@stacksjs/defaults/views/dashboard/composables/useDashboardThemes'
|
|
499
503
|
import { authStore } from '@stacksjs/defaults/views/dashboard/stores/auth'
|
|
500
504
|
import { kanbanStore } from '@stacksjs/defaults/views/dashboard/stores/kanban'
|
|
@@ -543,6 +547,7 @@ const sidebarOrder = createDashboardSidebarOrder({
|
|
|
543
547
|
status: value => sidebarOrderStatus.set(value),
|
|
544
548
|
})
|
|
545
549
|
let removeCraftSidebarSelection = () => {}
|
|
550
|
+
let removeSettingsCommand: (() => void) | undefined
|
|
546
551
|
ensureCraftNativeSidebarMarker()
|
|
547
552
|
auth.load()
|
|
548
553
|
|
|
@@ -607,7 +612,9 @@ function applySectionVisibility() {
|
|
|
607
612
|
// ends up with no dependency and never runs again. The toggle then appears to
|
|
608
613
|
// do nothing until a reload.
|
|
609
614
|
const hidden = appearance.hiddenSections()
|
|
615
|
+
const flatNavigation = themes.sectionNavigation()
|
|
610
616
|
for (const pane of sidebarPanes()) {
|
|
617
|
+
pane.setAttribute('tabindex', flatNavigation ? '-1' : '0')
|
|
611
618
|
for (const section of pane.querySelectorAll<HTMLElement>('[data-sidebar-section]')) {
|
|
612
619
|
const id = section.dataset.sectionId || ''
|
|
613
620
|
section.setAttribute('data-viewer-hidden', String(hidden.includes(id)))
|
|
@@ -623,20 +630,12 @@ function applySectionVisibility() {
|
|
|
623
630
|
effect(applySectionVisibility)
|
|
624
631
|
|
|
625
632
|
|
|
626
|
-
|
|
627
|
-
useEventListener('
|
|
628
|
-
if (event.
|
|
629
|
-
|
|
630
|
-
appearance.sidebarStyle.set(next.sidebarStyle)
|
|
631
|
-
appearance.colorMode.set(next.colorMode)
|
|
632
|
-
appearance.hiddenSections.set(next.hiddenSections)
|
|
633
|
-
appearance.apply()
|
|
633
|
+
useEventListener('click', handleDashboardSettingsClick, { capture: true })
|
|
634
|
+
useEventListener('keydown', (event) => {
|
|
635
|
+
if (!removeSettingsCommand && event.metaKey && event.key === ',' && openDashboardSettings())
|
|
636
|
+
event.preventDefault()
|
|
634
637
|
})
|
|
635
638
|
|
|
636
|
-
function normalizeRoutePath(path: string | null | undefined): string {
|
|
637
|
-
return (path || '/').replace(/\/+$/, '') || '/'
|
|
638
|
-
}
|
|
639
|
-
|
|
640
639
|
// Highlight the current route. Longest-prefix matching keeps a detail page
|
|
641
640
|
// such as /commerce/products/42 attached to its /commerce/products row while
|
|
642
641
|
// preventing /health from matching /health-check.
|
|
@@ -649,7 +648,7 @@ function syncActiveSidebarRow(url?: string): void {
|
|
|
649
648
|
catch {}
|
|
650
649
|
}
|
|
651
650
|
|
|
652
|
-
const currentPath =
|
|
651
|
+
const currentPath = dashboardNavigationPath(path || '/')
|
|
653
652
|
for (const pane of sidebarPanes()) {
|
|
654
653
|
let bestMatch = null
|
|
655
654
|
let bestLength = -1
|
|
@@ -658,7 +657,7 @@ function syncActiveSidebarRow(url?: string): void {
|
|
|
658
657
|
for (const link of links) {
|
|
659
658
|
const href = link.getAttribute('href') || ''
|
|
660
659
|
if (href.startsWith('http')) continue
|
|
661
|
-
const candidatePath =
|
|
660
|
+
const candidatePath = dashboardNavigationPath(href)
|
|
662
661
|
if (`${currentPath}/`.startsWith(`${candidatePath}/`) && candidatePath.length > bestLength) {
|
|
663
662
|
bestMatch = link
|
|
664
663
|
bestLength = candidatePath.length
|
|
@@ -681,7 +680,8 @@ function handleSidebarItemClick(payload: { item?: { href?: string }, event?: { p
|
|
|
681
680
|
const href = payload?.item?.href
|
|
682
681
|
if (!href || href.startsWith('http')) return
|
|
683
682
|
payload.event?.preventDefault()
|
|
684
|
-
|
|
683
|
+
if (!openDashboardSettings(href))
|
|
684
|
+
navigate(href)
|
|
685
685
|
}
|
|
686
686
|
|
|
687
687
|
// Where the Sidebar sat in the window while it is lent to the drawer.
|
|
@@ -699,6 +699,7 @@ function showSidebarInDrawer() {
|
|
|
699
699
|
drawer.appendChild(element)
|
|
700
700
|
}
|
|
701
701
|
applyRoleFilter()
|
|
702
|
+
applySectionVisibility()
|
|
702
703
|
syncActiveSidebarRow()
|
|
703
704
|
}
|
|
704
705
|
|
|
@@ -722,12 +723,17 @@ function handleCraftSidebarSelection(event: CraftSidebarSelectEvent | undefined)
|
|
|
722
723
|
const link = row?.querySelector('a[data-sidebar-item][href]')
|
|
723
724
|
const href = link?.getAttribute('href')
|
|
724
725
|
if (href) {
|
|
725
|
-
|
|
726
|
+
if (!openDashboardSettings(href))
|
|
727
|
+
navigate(href)
|
|
726
728
|
return
|
|
727
729
|
}
|
|
728
730
|
}
|
|
729
731
|
}
|
|
730
732
|
|
|
733
|
+
function attachSettingsCommand(): void {
|
|
734
|
+
removeSettingsCommand ??= listenForSettingsCommand(() => { openDashboardSettings() })
|
|
735
|
+
}
|
|
736
|
+
|
|
731
737
|
function attachCraftSidebarSelection() {
|
|
732
738
|
removeCraftSidebarSelection()
|
|
733
739
|
removeCraftSidebarSelection = useCraftSidebarSelection(handleCraftSidebarSelection)
|
|
@@ -738,6 +744,7 @@ useEventListener('stx:hydrated', () => syncActiveSidebarRow(), { once: true })
|
|
|
738
744
|
useEventListener('craft:ready', () => {
|
|
739
745
|
ensureCraftNativeSidebarMarker()
|
|
740
746
|
attachCraftSidebarSelection()
|
|
747
|
+
attachSettingsCommand()
|
|
741
748
|
})
|
|
742
749
|
|
|
743
750
|
onMount(() => {
|
|
@@ -748,17 +755,18 @@ onMount(() => {
|
|
|
748
755
|
applyRoleFilter()
|
|
749
756
|
applySectionVisibility()
|
|
750
757
|
attachCraftSidebarSelection()
|
|
758
|
+
attachSettingsCommand()
|
|
751
759
|
})
|
|
752
760
|
|
|
753
761
|
onDestroy(() => {
|
|
754
762
|
sidebarOrder.destroy()
|
|
763
|
+
removeSettingsCommand?.()
|
|
755
764
|
removeCraftSidebarSelection()
|
|
756
765
|
})
|
|
757
766
|
</script>
|
|
758
767
|
|
|
759
768
|
<div ref="dashboardSidebarHost" data-dashboard-web-sidebar>
|
|
760
769
|
<Sidebar
|
|
761
|
-
:sections="sidebarSections"
|
|
762
770
|
theme="macos"
|
|
763
771
|
width="250"
|
|
764
772
|
placement="fixed"
|
|
@@ -781,6 +789,10 @@ onDestroy(() => {
|
|
|
781
789
|
<ProjectSwitcher :name="dashboardProject.name" />
|
|
782
790
|
@endif
|
|
783
791
|
</template>
|
|
792
|
+
<div data-dashboard-sidebar-tree>
|
|
793
|
+
<SidebarSections :sections="sidebarSections" theme="macos" />
|
|
794
|
+
</div>
|
|
795
|
+
<DashboardSectionSidebar :sectionHubs="sectionHubs" />
|
|
784
796
|
<template #footer>
|
|
785
797
|
<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
798
|
<p role="status" aria-live="polite" :text="sidebarOrderStatus.message"></p>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@head
|
|
2
|
+
<link rel="icon" href="/images/logos/favicon.svg" type="image/svg+xml">
|
|
3
|
+
<link rel="stylesheet" href="/__deps/dashboard-theme.css">
|
|
4
|
+
<link rel="stylesheet" href="/__deps/dashboard-icons.css">
|
|
5
|
+
<script src="/__deps/dashboard-theme.js"></script>
|
|
6
|
+
@endhead
|
|
7
|
+
|
|
8
|
+
@appearanceBootstrap({
|
|
9
|
+
storageKey: 'stacks-dashboard-appearance',
|
|
10
|
+
appearance: {
|
|
11
|
+
key: 'sidebarStyle',
|
|
12
|
+
attribute: 'appearance',
|
|
13
|
+
allowed: ['macos', 'arc'],
|
|
14
|
+
default: 'macos',
|
|
15
|
+
},
|
|
16
|
+
colorMode: {
|
|
17
|
+
key: 'colorMode',
|
|
18
|
+
attribute: 'color-mode',
|
|
19
|
+
default: 'system',
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
<script client>
|
|
24
|
+
import { listenForSettingsPane, setSettingsWindowAppearance } from '@stacksjs/defaults/views/dashboard/composables/settings-window'
|
|
25
|
+
import { useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
|
|
26
|
+
import { useSettingsWindow } from '@stacksjs/defaults/views/dashboard/composables/useSettingsWindow'
|
|
27
|
+
|
|
28
|
+
const settingsWindow = useSettingsWindow
|
|
29
|
+
const appearance = useAppearance()
|
|
30
|
+
let stopListening: (() => void) | undefined
|
|
31
|
+
|
|
32
|
+
effect(() => {
|
|
33
|
+
const mode = appearance.colorMode()
|
|
34
|
+
setSettingsWindowAppearance(mode)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
useEventListener('stx:load', () => settingsWindow.syncHistory())
|
|
38
|
+
useEventListener('popstate', () => settingsWindow.syncHistory())
|
|
39
|
+
onMount(() => {
|
|
40
|
+
settingsWindow.syncHistory()
|
|
41
|
+
stopListening = listenForSettingsPane(navigate)
|
|
42
|
+
})
|
|
43
|
+
onDestroy(() => stopListening?.())
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<main data-stx-content data-dashboard-content data-dashboard-settings-content>
|
|
47
|
+
@slot('content')
|
|
48
|
+
</main>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@extends('layouts/default')
|
|
2
|
+
|
|
3
|
+
<script server>
|
|
4
|
+
import { buildDashboardSectionHubs } from '@stacksjs/defaults/resources/functions/dashboard/section-navigation'
|
|
5
|
+
import { buildWebSidebarSections } from '@stacksjs/defaults/resources/functions/dashboard/sidebar'
|
|
6
|
+
|
|
7
|
+
export const hub = buildDashboardSectionHubs(buildWebSidebarSections())
|
|
8
|
+
.find(section => section.id === (typeof params !== 'undefined' ? params.section : undefined))
|
|
9
|
+
export const sectionTitle = hub ? `Dashboard - ${hub.label}` : 'Section not found'
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
@section('content')
|
|
13
|
+
@title(sectionTitle)
|
|
14
|
+
@if(hub)
|
|
15
|
+
<DashboardSectionLanding :hub="hub" />
|
|
16
|
+
@else
|
|
17
|
+
<NotFoundDashboard />
|
|
18
|
+
@endif
|
|
19
|
+
@endsection
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
@extends('layouts/
|
|
1
|
+
@extends('layouts/settings')
|
|
2
2
|
|
|
3
3
|
@section('content')
|
|
4
4
|
@title('Dashboard - Appearance')
|
|
5
5
|
|
|
6
|
-
<
|
|
6
|
+
<DashboardSettingsFrame pane="appearance">
|
|
7
|
+
<AppearanceSettingsDashboard />
|
|
8
|
+
</DashboardSettingsFrame>
|
|
7
9
|
@endsection
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
@extends('layouts/
|
|
1
|
+
@extends('layouts/settings')
|
|
2
2
|
|
|
3
3
|
@section('content')
|
|
4
4
|
@title('Dashboard - Billing Settings')
|
|
5
5
|
|
|
6
|
-
<
|
|
6
|
+
<DashboardSettingsFrame pane="billing">
|
|
7
7
|
<BillingSettings />
|
|
8
|
-
</
|
|
9
|
-
|
|
8
|
+
</DashboardSettingsFrame>
|
|
10
9
|
@endsection
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
@extends('layouts/
|
|
1
|
+
@extends('layouts/settings')
|
|
2
2
|
|
|
3
3
|
@section('content')
|
|
4
4
|
@title('Dashboard - Mail Settings')
|
|
5
5
|
|
|
6
|
-
<
|
|
6
|
+
<DashboardSettingsFrame pane="mail">
|
|
7
7
|
<MailSettingsDashboard />
|
|
8
|
-
</
|
|
8
|
+
</DashboardSettingsFrame>
|
|
9
9
|
@endsection
|