@stacksjs/defaults 0.75.669 → 0.75.674

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 (27) hide show
  1. package/ai/skills/stacks-dashboard/SKILL.md +19 -5
  2. package/ai/skills/stacks-native/CATALOG.md +10 -10
  3. package/ai/skills/stacks-storage/SKILL.md +51 -0
  4. package/ai/skills/stacks-video/SKILL.md +29 -0
  5. package/ide/vscode/package.json +1 -1
  6. package/package.json +7 -7
  7. package/resources/components/Dashboard/Home/DashboardHome.stx +8 -8
  8. package/resources/components/Dashboard/MobileSidebar.stx +1 -1
  9. package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +19 -3
  10. package/resources/components/Dashboard/Settings/DashboardThemePicker.stx +218 -0
  11. package/resources/components/Dashboard/UI/ActivityTable.stx +7 -7
  12. package/resources/components/Dashboard/UI/Button.stx +6 -3
  13. package/resources/components/Dashboard/UI/Card.stx +1 -1
  14. package/resources/components/Dashboard/UI/Drawer.stx +1 -1
  15. package/resources/components/Dashboard/UI/Modal.stx +1 -0
  16. package/resources/components/Dashboard/UI/PageHeader.stx +1 -1
  17. package/resources/components/Dashboard/UI/QuickLinks.stx +7 -5
  18. package/resources/components/Dashboard/UI/ServiceHealth.stx +6 -6
  19. package/resources/components/Dashboard/UI/StatsCard.stx +5 -5
  20. package/resources/components/Dashboard/UI/Table.stx +1 -1
  21. package/styles/dashboard-theme.css +248 -0
  22. package/views/dashboard/composables/dashboard-theme-bootstrap.ts +11 -0
  23. package/views/dashboard/composables/dashboard-themes.ts +180 -0
  24. package/views/dashboard/composables/useAppearance.ts +21 -9
  25. package/views/dashboard/composables/useDashboardThemes.ts +79 -0
  26. package/views/dashboard/layouts/default.stx +45 -42
  27. package/views/dashboard/layouts/guest.stx +11 -1
@@ -0,0 +1,180 @@
1
+ export const DASHBOARD_THEME_STORAGE_KEY = 'stacks-dashboard-themes'
2
+ export const ORIGINAL_DASHBOARD_THEME = 'original'
3
+ export const MAX_THEME_FILE_SIZE = 16_384
4
+ const MAX_INSTALLED_THEMES = 24
5
+
6
+ const paletteKeys = [
7
+ 'window', 'canvas', 'surface', 'surfaceMuted', 'text', 'muted', 'border',
8
+ 'accent', 'accentFill', 'accentText', 'heroStart', 'heroEnd', 'heroText',
9
+ ] as const
10
+
11
+ type ThemePalette = Record<typeof paletteKeys[number], string>
12
+
13
+ export interface DashboardTheme {
14
+ version: 1
15
+ id: string
16
+ name: string
17
+ description?: string
18
+ layout: 'flush' | 'inset'
19
+ navigation: 'plain' | 'tiles'
20
+ overview: 'panel' | 'immersive'
21
+ radius: number
22
+ light: ThemePalette
23
+ dark: ThemePalette
24
+ }
25
+
26
+ export interface DashboardThemePreferences {
27
+ active: string
28
+ installed: DashboardTheme[]
29
+ }
30
+
31
+ export const SYSTEM_CLEANER_THEME: DashboardTheme = {
32
+ version: 1,
33
+ id: 'system-cleaner',
34
+ name: 'System Cleaner',
35
+ description: 'A macOS-style window with colored navigation tiles and a violet overview.',
36
+ layout: 'inset',
37
+ navigation: 'tiles',
38
+ overview: 'immersive',
39
+ radius: 14,
40
+ light: {
41
+ window: '#e7e7ec',
42
+ canvas: '#f5f5f7',
43
+ surface: '#ffffff',
44
+ surfaceMuted: '#eeeef1',
45
+ text: '#1d1d1f',
46
+ muted: '#55555b',
47
+ border: '#d9d9e0',
48
+ accent: '#692bc7',
49
+ accentFill: '#6d28d9',
50
+ accentText: '#ffffff',
51
+ heroStart: '#6a2fb8',
52
+ heroEnd: '#27114e',
53
+ heroText: '#ffffff',
54
+ },
55
+ dark: {
56
+ window: '#111113',
57
+ canvas: '#1a1a1c',
58
+ surface: '#242426',
59
+ surfaceMuted: '#2c2c2e',
60
+ text: '#f5f5f7',
61
+ muted: '#b8b8bf',
62
+ border: '#3b3b42',
63
+ accent: '#c48bff',
64
+ accentFill: '#7a2fe0',
65
+ accentText: '#ffffff',
66
+ heroStart: '#542593',
67
+ heroEnd: '#200d3b',
68
+ heroText: '#ffffff',
69
+ },
70
+ }
71
+
72
+ export const BUNDLED_DASHBOARD_THEMES: readonly DashboardTheme[] = [SYSTEM_CLEANER_THEME]
73
+
74
+ function record(value: unknown): Record<string, unknown> {
75
+ return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}
76
+ }
77
+
78
+ function readPalette(value: unknown, mode: string): ThemePalette {
79
+ const input = record(value)
80
+ const palette = {} as ThemePalette
81
+ for (const key of paletteKeys) {
82
+ const color = input[key]
83
+ if (typeof color !== 'string' || color.length !== 7 || !/^#[\da-f]{6}$/i.test(color))
84
+ throw new Error(`Use a six-digit hex color for ${mode}.${key}.`)
85
+ palette[key] = color.toLowerCase()
86
+ }
87
+ return palette
88
+ }
89
+
90
+ export function parseDashboardTheme(value: unknown): DashboardTheme {
91
+ const { version, id, name, description, layout, navigation, overview = 'panel', radius, light, dark } = record(value)
92
+ if (version !== 1)
93
+ throw new Error('Set the theme version to 1.')
94
+ if (typeof id !== 'string' || id !== id.trim() || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(id) || id.length > 48)
95
+ throw new Error('Use a theme ID of up to 48 lowercase letters, digits, and hyphens. Start with a letter.')
96
+ if (id === ORIGINAL_DASHBOARD_THEME || BUNDLED_DASHBOARD_THEMES.some(theme => theme.id === id))
97
+ throw new Error('Choose a new ID. That ID belongs to a bundled theme.')
98
+ if (typeof name !== 'string' || !name.trim() || name.length > 64)
99
+ throw new Error('Enter a theme name of up to 64 characters.')
100
+ if (description !== undefined && (typeof description !== 'string' || description.length > 180))
101
+ throw new Error('Keep the description to 180 characters or fewer.')
102
+ if (layout !== 'flush' && layout !== 'inset')
103
+ throw new Error('Choose either flush or inset for layout.')
104
+ if (navigation !== 'plain' && navigation !== 'tiles')
105
+ throw new Error('Choose either plain or tiles for navigation.')
106
+ if (overview !== 'panel' && overview !== 'immersive')
107
+ throw new Error('Choose either panel or immersive for overview.')
108
+ if (typeof radius !== 'number' || !Number.isInteger(radius) || radius < 0 || radius > 24)
109
+ throw new Error('Set the radius to a whole number from 0 to 24.')
110
+ return { version, id, name: name.trim(), description: description?.trim(), layout, navigation, overview, radius, light: readPalette(light, 'light'), dark: readPalette(dark, 'dark') }
111
+ }
112
+
113
+ export function resolveDashboardTheme(id: unknown, installed: readonly DashboardTheme[]): DashboardTheme | undefined {
114
+ return BUNDLED_DASHBOARD_THEMES.find(theme => theme.id === id) ?? installed.find(theme => theme.id === id)
115
+ }
116
+
117
+ export function readDashboardThemes(storage: Pick<Storage, 'getItem'>): DashboardThemePreferences {
118
+ const installed = new Map<string, DashboardTheme>()
119
+ try {
120
+ const saved = record(JSON.parse(storage.getItem(DASHBOARD_THEME_STORAGE_KEY) || '{}'))
121
+ if (Array.isArray(saved.installed)) {
122
+ for (const input of saved.installed.slice(0, MAX_INSTALLED_THEMES)) {
123
+ try {
124
+ const theme = parseDashboardTheme(input)
125
+ installed.set(theme.id, theme)
126
+ }
127
+ catch {
128
+ // An outdated or damaged installation should not hide valid themes.
129
+ }
130
+ }
131
+ }
132
+ const themes = [...installed.values()]
133
+ return { active: resolveDashboardTheme(saved.active, themes)?.id ?? ORIGINAL_DASHBOARD_THEME, installed: themes }
134
+ }
135
+ catch {
136
+ return { active: ORIGINAL_DASHBOARD_THEME, installed: [] }
137
+ }
138
+ }
139
+
140
+ export function installDashboardTheme(prefs: DashboardThemePreferences, theme: DashboardTheme): DashboardThemePreferences {
141
+ const index = prefs.installed.findIndex(installed => installed.id === theme.id)
142
+ const installed = [...prefs.installed]
143
+ if (index === -1) {
144
+ if (installed.length >= MAX_INSTALLED_THEMES)
145
+ throw new Error(`Remove an installed theme first. This browser can store ${MAX_INSTALLED_THEMES} themes.`)
146
+ installed.push(theme)
147
+ }
148
+ else {
149
+ installed[index] = theme
150
+ }
151
+ return { active: theme.id, installed }
152
+ }
153
+
154
+ function colorProperty(key: string): string {
155
+ return `--dashboard-${key.replace(/[A-Z]/g, letter => `-${letter.toLowerCase()}`)}`
156
+ }
157
+
158
+ export function dashboardThemeColor(theme: DashboardTheme, key: keyof ThemePalette): string {
159
+ return `light-dark(${theme.light[key]}, ${theme.dark[key]})`
160
+ }
161
+
162
+ export function applyDashboardTheme(root: HTMLElement, theme?: DashboardTheme): void {
163
+ root.dataset.dashboardTheme = theme?.id ?? ORIGINAL_DASHBOARD_THEME
164
+ if (theme) {
165
+ root.dataset.dashboardLayout = theme.layout
166
+ root.dataset.dashboardNavigation = theme.navigation
167
+ root.dataset.dashboardOverview = theme.overview
168
+ root.style.setProperty('--dashboard-radius', `${theme.radius}px`)
169
+ for (const key of paletteKeys)
170
+ root.style.setProperty(colorProperty(key), dashboardThemeColor(theme, key))
171
+ }
172
+ else {
173
+ delete root.dataset.dashboardLayout
174
+ delete root.dataset.dashboardNavigation
175
+ delete root.dataset.dashboardOverview
176
+ root.style.removeProperty('--dashboard-radius')
177
+ for (const key of paletteKeys)
178
+ root.style.removeProperty(colorProperty(key))
179
+ }
180
+ }
@@ -189,9 +189,10 @@ export function sidebarThemeFor(style: SidebarStyle, knownThemes: Record<string,
189
189
  * under `APPEARANCE_STORAGE_KEY`.
190
190
  */
191
191
  export const appearanceStore = defineStore('appearance', () => {
192
- const sidebarStyle = state<SidebarStyle>(DEFAULT_APPEARANCE.sidebarStyle)
193
- const colorMode = state<ColorMode>(DEFAULT_APPEARANCE.colorMode)
194
- const hiddenSections = state<string[]>([...DEFAULT_APPEARANCE.hiddenSections])
192
+ const saved = readStoredAppearance()
193
+ const sidebarStyle = state(saved.sidebarStyle)
194
+ const colorMode = state(saved.colorMode)
195
+ const hiddenSections = state(saved.hiddenSections)
195
196
 
196
197
  function snapshot(): AppearancePreferences {
197
198
  return {
@@ -201,6 +202,19 @@ export const appearanceStore = defineStore('appearance', () => {
201
202
  }
202
203
  }
203
204
 
205
+ function persist(): void {
206
+ if (typeof window === 'undefined')
207
+ return
208
+ try {
209
+ // Save during the interaction so an immediate navigation sees the new
210
+ // value in the synchronous appearance bootstrap.
211
+ window.localStorage.setItem(APPEARANCE_STORAGE_KEY, JSON.stringify(snapshot()))
212
+ }
213
+ catch {
214
+ // The appearance still works in this document if storage is disabled.
215
+ }
216
+ }
217
+
204
218
  /**
205
219
  * Write the preferences onto `<html>`, where the shell CSS reads them.
206
220
  *
@@ -238,6 +252,7 @@ export const appearanceStore = defineStore('appearance', () => {
238
252
  if (!isSidebarStyle(style))
239
253
  return
240
254
  sidebarStyle.set(style)
255
+ persist()
241
256
  apply()
242
257
  }
243
258
 
@@ -245,6 +260,7 @@ export const appearanceStore = defineStore('appearance', () => {
245
260
  if (!isColorMode(mode))
246
261
  return
247
262
  colorMode.set(mode)
263
+ persist()
248
264
  apply()
249
265
  }
250
266
 
@@ -253,6 +269,7 @@ export const appearanceStore = defineStore('appearance', () => {
253
269
  if (!visible)
254
270
  next.push(id)
255
271
  hiddenSections.set(next)
272
+ persist()
256
273
  }
257
274
 
258
275
  function isSectionHidden(id: string): boolean {
@@ -263,6 +280,7 @@ export const appearanceStore = defineStore('appearance', () => {
263
280
  sidebarStyle.set(DEFAULT_APPEARANCE.sidebarStyle)
264
281
  colorMode.set(DEFAULT_APPEARANCE.colorMode)
265
282
  hiddenSections.set([])
283
+ persist()
266
284
  apply()
267
285
  }
268
286
 
@@ -277,12 +295,6 @@ export const appearanceStore = defineStore('appearance', () => {
277
295
  reset,
278
296
  apply,
279
297
  }
280
- }, {
281
- persist: {
282
- storage: 'localStorage',
283
- key: APPEARANCE_STORAGE_KEY,
284
- pick: ['sidebarStyle', 'colorMode', 'hiddenSections'],
285
- },
286
298
  })
287
299
 
288
300
  /*
@@ -0,0 +1,79 @@
1
+ import type { DashboardThemePreferences } from './dashboard-themes'
2
+ import { defineStore, derived, state } from '@stacksjs/stx'
3
+ import {
4
+ applyDashboardTheme,
5
+ DASHBOARD_THEME_STORAGE_KEY,
6
+ installDashboardTheme,
7
+ ORIGINAL_DASHBOARD_THEME,
8
+ parseDashboardTheme,
9
+ readDashboardThemes,
10
+ resolveDashboardTheme,
11
+ } from './dashboard-themes'
12
+
13
+ function read(): DashboardThemePreferences {
14
+ try {
15
+ if (typeof window !== 'undefined')
16
+ return readDashboardThemes(window.localStorage)
17
+ }
18
+ catch {
19
+ // Storage access can be disabled by the browser.
20
+ }
21
+ return { active: ORIGINAL_DASHBOARD_THEME, installed: [] }
22
+ }
23
+
24
+ const dashboardThemeStore = defineStore('dashboard-themes', () => {
25
+ const preferences = state(read())
26
+ const active = derived(() => preferences().active)
27
+ const installed = derived(() => preferences().installed)
28
+
29
+ function apply(next: DashboardThemePreferences): void {
30
+ preferences.set(next)
31
+ if (typeof document !== 'undefined')
32
+ applyDashboardTheme(document.documentElement, resolveDashboardTheme(next.active, next.installed))
33
+ }
34
+
35
+ if (typeof window !== 'undefined') {
36
+ window.addEventListener('storage', (event) => {
37
+ if (event.key === DASHBOARD_THEME_STORAGE_KEY || event.key === null)
38
+ apply(read())
39
+ })
40
+ }
41
+
42
+ function save(next: DashboardThemePreferences): void {
43
+ try {
44
+ window.localStorage.setItem(DASHBOARD_THEME_STORAGE_KEY, JSON.stringify(next))
45
+ }
46
+ catch {
47
+ throw new Error('The browser could not save your dashboard themes.')
48
+ }
49
+ apply(next)
50
+ }
51
+
52
+ function select(id: string): void {
53
+ const current = read()
54
+ if (id === ORIGINAL_DASHBOARD_THEME || resolveDashboardTheme(id, current.installed))
55
+ save({ ...current, active: id })
56
+ }
57
+
58
+ function install(value: unknown): string {
59
+ const theme = parseDashboardTheme(value)
60
+ save(installDashboardTheme(read(), theme))
61
+ return theme.name
62
+ }
63
+
64
+ function remove(id: string): void {
65
+ const current = read()
66
+ if (!current.installed.some(theme => theme.id === id))
67
+ return
68
+ save({
69
+ active: current.active === id ? ORIGINAL_DASHBOARD_THEME : current.active,
70
+ installed: current.installed.filter(theme => theme.id !== id),
71
+ })
72
+ }
73
+
74
+ return { active, installed, select, install, remove, sync: () => apply(read()) }
75
+ })
76
+
77
+ export function useDashboardThemes(): typeof dashboardThemeStore {
78
+ return dashboardThemeStore
79
+ }
@@ -47,6 +47,8 @@ defineClientPayload({ sidebarRoleMap, sidebarSections })
47
47
  @head
48
48
  <link rel="icon" href="/images/logos/favicon.svg" type="image/svg+xml">
49
49
  <link rel="icon" href="/images/logos/favicon-dark.svg" type="image/svg+xml" media="(prefers-color-scheme: dark)">
50
+ <link rel="stylesheet" href="/__deps/dashboard-theme.css">
51
+ <script src="/__deps/dashboard-theme.js"></script>
50
52
  @endhead
51
53
 
52
54
  <!-- Dashboard icon stylesheet. Most dashboard icons are applied via dynamic
@@ -221,7 +223,7 @@ html .dashboard-modal-layer {
221
223
  * attribute is what wins, and it wins by specificity rather than by `!important`
222
224
  * so the rules stay overridable downstream.
223
225
  * ======================================================================== */
224
- html[data-appearance="arc"] {
226
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) {
225
227
  /* Warmer and a shade deeper than the content card it carries. The stx `arc`
226
228
  theme paints its pane at #f7f5f1 over whatever sits behind it; here the
227
229
  panel IS the backdrop, so it has to be flat and darker than white or the
@@ -232,26 +234,26 @@ html[data-appearance="arc"] {
232
234
  }
233
235
  /* The dark class is written onto the root element itself, so it stacks with
234
236
  the appearance attribute rather than sitting above it. */
235
- html[data-appearance="arc"].dark {
237
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark {
236
238
  --dash-arc-panel: #171717;
237
239
  }
238
240
 
239
241
  /* The gap around the content card is the body showing through, which is what
240
242
  makes the card read as floating on the sidebar rather than beside it. */
241
- html[data-appearance="arc"] body {
243
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) body {
242
244
  background: var(--dash-arc-panel);
243
245
  }
244
246
 
245
247
  /* The card owns scrolling, so the page must not also scroll: a document
246
248
  scrollbar would eat the right-hand gap and there would be nothing for it to
247
249
  scroll anyway. */
248
- html[data-appearance="arc"],
249
- html[data-appearance="arc"] body {
250
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])),
251
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) body {
250
252
  height: 100%;
251
253
  overflow: hidden;
252
254
  }
253
255
 
254
- html[data-appearance="arc"] [data-stx-content] {
256
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content] {
255
257
  /* Only three margins. `margin-left` is deliberately left to the base rule.
256
258
 
257
259
  It is the one margin that transitions (0.3s, for the sidebar collapse),
@@ -290,7 +292,7 @@ html[data-appearance="arc"] [data-stx-content] {
290
292
  0 8px 24px rgba(0, 0, 0, 0.06);
291
293
  transition: margin-left 0.3s ease-out;
292
294
  }
293
- html[data-appearance="arc"].dark [data-stx-content] {
295
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-stx-content] {
294
296
  background: #0a0a0a;
295
297
  box-shadow:
296
298
  0 0 0 0.5px rgba(255, 255, 255, 0.08),
@@ -299,38 +301,38 @@ html[data-appearance="arc"].dark [data-stx-content] {
299
301
 
300
302
  /* An overlay scrollbar inside the card, so the rounded corner is not cut by a
301
303
  full-width native gutter. */
302
- html[data-appearance="arc"] [data-stx-content] {
304
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content] {
303
305
  scrollbar-width: thin;
304
306
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
305
307
  }
306
- html[data-appearance="arc"] [data-stx-content]::-webkit-scrollbar {
308
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content]::-webkit-scrollbar {
307
309
  width: 8px;
308
310
  }
309
- html[data-appearance="arc"] [data-stx-content]::-webkit-scrollbar-thumb {
311
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content]::-webkit-scrollbar-thumb {
310
312
  border: 2px solid transparent;
311
313
  border-radius: 8px;
312
314
  background-clip: content-box;
313
315
  background-color: rgba(0, 0, 0, 0.2);
314
316
  }
315
- html[data-appearance="arc"] [data-stx-content]::-webkit-scrollbar-track {
317
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content]::-webkit-scrollbar-track {
316
318
  background: transparent;
317
319
  }
318
- html[data-appearance="arc"].dark [data-stx-content] {
320
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-stx-content] {
319
321
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
320
322
  }
321
- html[data-appearance="arc"].dark [data-stx-content]::-webkit-scrollbar-thumb {
323
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-stx-content]::-webkit-scrollbar-thumb {
322
324
  background-color: rgba(255, 255, 255, 0.25);
323
325
  }
324
326
 
325
327
  /* On narrow viewports the sidebar is hidden entirely, so the card would float
326
328
  on nothing. Return it to a flush pane. */
327
329
  @media (max-width: 1023px) {
328
- html[data-appearance="arc"],
329
- html[data-appearance="arc"] body {
330
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])),
331
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) body {
330
332
  height: auto;
331
333
  overflow: visible;
332
334
  }
333
- html[data-appearance="arc"] [data-stx-content] {
335
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-content] {
334
336
  margin-top: 0;
335
337
  margin-right: 0;
336
338
  margin-bottom: 0;
@@ -343,41 +345,41 @@ html[data-appearance="arc"].dark [data-stx-content]::-webkit-scrollbar-thumb {
343
345
  }
344
346
 
345
347
  /* The panel is the body; the pane just holds rows. */
346
- html[data-appearance="arc"] [data-stx-sidebar] {
348
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-stx-sidebar] {
347
349
  background: transparent;
348
350
  backdrop-filter: none;
349
351
  -webkit-backdrop-filter: none;
350
352
  color: #2c2a28;
351
353
  }
352
- html[data-appearance="arc"].dark [data-stx-sidebar] {
354
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-stx-sidebar] {
353
355
  color: #ededf0;
354
356
  }
355
357
  /* Liquid Glass belongs to the macOS material. Arc's panel is flat. */
356
- html[data-appearance="arc"] .stx-sidebar-rim {
358
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) .stx-sidebar-rim {
357
359
  display: none;
358
360
  }
359
361
 
360
362
  /* Rows: discrete cards with a 2px gutter, not AppKit's contiguous run. */
361
- html[data-appearance="arc"] [data-sidebar-row] {
363
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-row] {
362
364
  height: 32px;
363
365
  }
364
- html[data-appearance="arc"] [data-sidebar-item] {
366
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-item] {
365
367
  height: 30px;
366
368
  border-radius: 8px;
367
369
  color: inherit;
368
370
  }
369
- html[data-appearance="arc"] [data-sidebar-item]:hover {
371
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-item]:hover {
370
372
  background: rgba(255, 255, 255, 0.55);
371
373
  }
372
- html[data-appearance="arc"].dark [data-sidebar-item]:hover {
374
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-sidebar-item]:hover {
373
375
  background: rgba(255, 255, 255, 0.08);
374
376
  }
375
377
 
376
378
  /* Selection: a raised white card, in both window states. Matching the
377
379
  component's own selector shape is what gives these the specificity to win. */
378
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"],
379
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="false"] [data-sidebar-item][data-active="true"],
380
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"]:hover {
380
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"],
381
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="false"] [data-sidebar-item][data-active="true"],
382
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"]:hover {
381
383
  background: #fff;
382
384
  color: #1b1a19;
383
385
  font-weight: 500;
@@ -385,9 +387,9 @@ html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="t
385
387
  0 0 0 1px rgba(0, 0, 0, 0.05),
386
388
  0 1px 2px rgba(0, 0, 0, 0.08);
387
389
  }
388
- html[data-appearance="arc"].dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"],
389
- html[data-appearance="arc"].dark [data-sidebar-selection="accent"][data-window-key="false"] [data-sidebar-item][data-active="true"],
390
- html[data-appearance="arc"].dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"]:hover {
390
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"],
391
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-sidebar-selection="accent"][data-window-key="false"] [data-sidebar-item][data-active="true"],
392
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"]:hover {
391
393
  background: rgba(255, 255, 255, 0.14);
392
394
  color: #fff;
393
395
  box-shadow:
@@ -397,20 +399,20 @@ html[data-appearance="arc"].dark [data-sidebar-selection="accent"][data-window-k
397
399
 
398
400
  /* The icon, count and chevron turn white on a macOS accent fill. On a white
399
401
  card they must not - they keep their own tint, the same as an idle row. */
400
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-icon],
401
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-chevron] {
402
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-icon],
403
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-chevron] {
402
404
  color: var(--stx-sidebar-icon, currentColor);
403
405
  }
404
- html[data-appearance="arc"] [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-count] {
406
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-count] {
405
407
  color: rgba(44, 42, 40, 0.45);
406
408
  }
407
- html[data-appearance="arc"].dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-count] {
409
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])).dark [data-sidebar-selection="accent"][data-window-key="true"] [data-sidebar-item][data-active="true"] [data-sidebar-count] {
408
410
  color: rgba(237, 237, 240, 0.45);
409
411
  }
410
412
 
411
413
  /* Section headers: sentence case and quieter than the macOS uppercase strip. */
412
- html[data-appearance="arc"] [data-sidebar-section-header],
413
- html[data-appearance="arc"] [data-sidebar-section] > div:first-child {
414
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-section-header],
415
+ html[data-appearance="arc"]:where(:not([data-dashboard-layout])) [data-sidebar-section] > div:first-child {
414
416
  opacity: 0.55;
415
417
  }
416
418
 
@@ -492,7 +494,8 @@ import type { ToastType } from '@stacksjs/defaults/functions/toasts'
492
494
  import type { CraftSidebarSelectEvent } from '@stacksjs/defaults/functions/craft'
493
495
  import { useToasts, dismissToast } from '@stacksjs/defaults/functions/toasts'
494
496
  import { ensureCraftNativeSidebarMarker, useCraftSidebarSelection } from '@stacksjs/defaults/functions/craft'
495
- import { readStoredAppearance, useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
497
+ import { APPEARANCE_STORAGE_KEY, readStoredAppearance, useAppearance } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
498
+ import { useDashboardThemes } from '@stacksjs/defaults/views/dashboard/composables/useDashboardThemes'
496
499
  import { authStore } from '@stacksjs/defaults/views/dashboard/stores/auth'
497
500
  import { kanbanStore } from '@stacksjs/defaults/views/dashboard/stores/kanban'
498
501
  import { createDashboardSidebarOrder } from '@stacksjs/defaults/functions/dashboard-sidebar-order'
@@ -583,6 +586,7 @@ effect(() => {
583
586
  // ---------------------------------------------------------------------------
584
587
 
585
588
  const appearance = useAppearance()
589
+ const themes = useDashboardThemes()
586
590
 
587
591
  effect(() => {
588
592
  // Reading the signals here is what subscribes this effect to them; `apply`
@@ -619,11 +623,9 @@ function applySectionVisibility() {
619
623
  effect(applySectionVisibility)
620
624
 
621
625
 
622
- // Another tab changed the preferences. `storage` only fires in OTHER tabs, so
623
- // this cannot loop back on the tab that made the change. The store's own
624
- // persistence writes but does not watch, so the re-read is explicit.
626
+ // Apply edits from other tabs without writing those preferences back.
625
627
  useEventListener('storage', (event) => {
626
- if (event?.key !== 'stacks-dashboard-appearance') return
628
+ if (event.key !== APPEARANCE_STORAGE_KEY && event.key !== null) return
627
629
  const next = readStoredAppearance()
628
630
  appearance.sidebarStyle.set(next.sidebarStyle)
629
631
  appearance.colorMode.set(next.colorMode)
@@ -739,6 +741,7 @@ useEventListener('craft:ready', () => {
739
741
  })
740
742
 
741
743
  onMount(() => {
744
+ themes.sync()
742
745
  sidebarOrder.attach()
743
746
  void sidebarOrder.load()
744
747
  syncActiveSidebarRow()
@@ -779,7 +782,7 @@ onDestroy(() => {
779
782
  @endif
780
783
  </template>
781
784
  <template #footer>
782
- <div class="px-3 py-2 text-neutral-600 text-xs dark:text-neutral-300" data-sidebar-order-controls :data-sidebar-order-editing="sidebarReordering() ? 'true' : 'false'">
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'">
783
786
  <p role="status" aria-live="polite" :text="sidebarOrderStatus.message"></p>
784
787
  <Button :if="sidebarOrderStatus.ready" class="dashboard-sidebar-order-mode" variant="ghost" size="xs" @click="sidebarReordering.set(!sidebarReordering())">{{ sidebarReordering() ? 'Done reordering' : 'Reorder sidebar' }}</Button>
785
788
  <Button :if="!sidebarOrderStatus.ready" variant="ghost" size="xs" @click="sidebarOrder.load()">Retry loading order</Button>
@@ -796,7 +799,7 @@ onDestroy(() => {
796
799
  <div ref="dashboardMobileSidebarHost" data-dashboard-mobile-sidebar class="h-full"></div>
797
800
  </MobileSidebar>
798
801
 
799
- <main data-stx-content>
802
+ <main data-stx-content data-dashboard-content>
800
803
  @slot('content')
801
804
  </main>
802
805
 
@@ -6,8 +6,18 @@
6
6
  <link rel="icon" href="/images/logos/favicon.svg" type="image/svg+xml" />
7
7
  <link rel="icon" href="/images/logos/favicon-dark.svg" type="image/svg+xml" media="(prefers-color-scheme: dark)" />
8
8
  <title>Stacks Dashboard</title>
9
+ <link rel="stylesheet" href="/__deps/dashboard-theme.css" />
10
+ <script src="/__deps/dashboard-theme.js"></script>
11
+ @appearanceBootstrap({
12
+ storageKey: 'stacks-dashboard-appearance',
13
+ colorMode: {
14
+ key: 'colorMode',
15
+ attribute: 'color-mode',
16
+ default: 'system',
17
+ },
18
+ })
9
19
  </head>
10
- <body class="min-h-screen bg-neutral-100 dark:bg-neutral-950">
20
+ <body data-dashboard-guest class="min-h-screen bg-neutral-100 dark:bg-neutral-950">
11
21
  <main data-stx-content>
12
22
  @yield('content')
13
23
  </main>