@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.
- package/ai/skills/stacks-dashboard/SKILL.md +19 -5
- package/ai/skills/stacks-native/CATALOG.md +10 -10
- package/ai/skills/stacks-storage/SKILL.md +51 -0
- package/ai/skills/stacks-video/SKILL.md +29 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +7 -7
- package/resources/components/Dashboard/Home/DashboardHome.stx +8 -8
- package/resources/components/Dashboard/MobileSidebar.stx +1 -1
- package/resources/components/Dashboard/Settings/AppearanceSettingsDashboard.stx +19 -3
- package/resources/components/Dashboard/Settings/DashboardThemePicker.stx +218 -0
- package/resources/components/Dashboard/UI/ActivityTable.stx +7 -7
- package/resources/components/Dashboard/UI/Button.stx +6 -3
- package/resources/components/Dashboard/UI/Card.stx +1 -1
- package/resources/components/Dashboard/UI/Drawer.stx +1 -1
- package/resources/components/Dashboard/UI/Modal.stx +1 -0
- package/resources/components/Dashboard/UI/PageHeader.stx +1 -1
- package/resources/components/Dashboard/UI/QuickLinks.stx +7 -5
- package/resources/components/Dashboard/UI/ServiceHealth.stx +6 -6
- package/resources/components/Dashboard/UI/StatsCard.stx +5 -5
- package/resources/components/Dashboard/UI/Table.stx +1 -1
- package/styles/dashboard-theme.css +248 -0
- package/views/dashboard/composables/dashboard-theme-bootstrap.ts +11 -0
- package/views/dashboard/composables/dashboard-themes.ts +180 -0
- package/views/dashboard/composables/useAppearance.ts +21 -9
- package/views/dashboard/composables/useDashboardThemes.ts +79 -0
- package/views/dashboard/layouts/default.stx +45 -42
- package/views/dashboard/layouts/guest.stx +11 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: stacks-dashboard
|
|
3
|
-
description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the
|
|
3
|
+
description: Use when building or customizing the Stacks admin dashboard, including dashboard pages, model management views, analytics widgets, commerce dashboards, content management, settings panels, deployment monitoring, job/queue management, or the 447 built-in dashboard components. Covers the dashboard system at storage/framework/defaults/.
|
|
4
4
|
license: MIT
|
|
5
5
|
compatibility: Bun >= 1.3.0, TypeScript
|
|
6
6
|
allowed-tools: Read Edit Write Bash Grep Glob
|
|
@@ -8,7 +8,7 @@ allowed-tools: Read Edit Write Bash Grep Glob
|
|
|
8
8
|
|
|
9
9
|
# Stacks Dashboard
|
|
10
10
|
|
|
11
|
-
The Stacks admin dashboard provides a full-featured admin panel with 100+ route views,
|
|
11
|
+
The Stacks admin dashboard provides a full-featured admin panel with 100+ route views, 447 components, and a multi-section layout.
|
|
12
12
|
|
|
13
13
|
## Key Paths
|
|
14
14
|
- Dashboard components: `storage/framework/defaults/resources/components/Dashboard/`
|
|
@@ -541,6 +541,20 @@ Persisted shell appearance is applied with STX's
|
|
|
541
541
|
storage key and defaults aligned with `composables/useAppearance.ts`. Never
|
|
542
542
|
replace it with raw `window`, `document`, or `localStorage` code in the layout.
|
|
543
543
|
|
|
544
|
+
Dashboard themes are selected in Settings → Appearance. The Original
|
|
545
|
+
retains both existing sidebar styles. System Cleaner and imported version 1
|
|
546
|
+
JSON themes apply validated light and dark palettes to the shared shell and
|
|
547
|
+
components. Keep theme definitions in `views/dashboard/composables/dashboard-themes.ts`
|
|
548
|
+
and reusable styling in `styles/dashboard-theme.css`. Extend shared components
|
|
549
|
+
with semantic styling hooks or dashboard theme CSS variables so every theme
|
|
550
|
+
can use the same STX navigation, controls and page markup. Use fallbacks that
|
|
551
|
+
match The Original when referencing optional theme variables.
|
|
552
|
+
|
|
553
|
+
Both dashboard servers expose the same theme stylesheet and synchronous
|
|
554
|
+
bootstrap. The bootstrap and the appearance picker share the same manifest
|
|
555
|
+
validator and read browser-local state. Keep both assets in the head when
|
|
556
|
+
publishing a custom dashboard layout that supports themes.
|
|
557
|
+
|
|
544
558
|
At widths below 1024px:
|
|
545
559
|
|
|
546
560
|
- Hide the fixed desktop sidebar and reset `[data-stx-content]` to
|
|
@@ -553,9 +567,9 @@ At widths below 1024px:
|
|
|
553
567
|
- Verify `document.documentElement.scrollWidth <= innerWidth` at phone and
|
|
554
568
|
tablet sizes.
|
|
555
569
|
|
|
556
|
-
At 1024px and wider, the desktop sidebar
|
|
557
|
-
|
|
558
|
-
|
|
570
|
+
At 1024px and wider, the desktop sidebar keeps its 250px width, fixed
|
|
571
|
+
placement, persisted collapse state, and `--stx-sidebar-width` content-shell
|
|
572
|
+
contract across themes.
|
|
559
573
|
|
|
560
574
|
### Reactive page components
|
|
561
575
|
|
|
@@ -19,7 +19,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
19
19
|
| `@stacksjs/arrays` | [`stacks-arrays`](../stacks-arrays/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/arrays/src/index.ts) | 12 |
|
|
20
20
|
| `@stacksjs/audio` | [`stacks-audio`](../stacks-audio/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/audio/src/index.ts) | 3 |
|
|
21
21
|
| `@stacksjs/auth` | [`stacks-auth`](../stacks-auth/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/auth/src/index.ts) | 136 |
|
|
22
|
-
| `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) |
|
|
22
|
+
| `@stacksjs/browser` | [`stacks-browser`](../stacks-browser/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/index.ts) | 11 |
|
|
23
23
|
| `@stacksjs/browser-extension` | [`stacks-browser-extension`](../stacks-browser-extension/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser-extension/src/index.ts) | 9 |
|
|
24
24
|
| `@stacksjs/buddy` | [`stacks-buddy`](../stacks-buddy/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/buddy/src/index.ts) | 220 |
|
|
25
25
|
| `@stacksjs/build` | [`stacks-build`](../stacks-build/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/build/src/index.ts) | 7 |
|
|
@@ -87,7 +87,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
87
87
|
| `@stacksjs/slug` | [`stacks-slug`](../stacks-slug/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/slug/src/index.ts) | 5 |
|
|
88
88
|
| `@stacksjs/sms` | [`stacks-sms`](../stacks-sms/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/sms/src/index.ts) | 7 |
|
|
89
89
|
| `@stacksjs/socials` | [`stacks-socials`](../stacks-socials/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/socials/src/index.ts) | 21 |
|
|
90
|
-
| `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) |
|
|
90
|
+
| `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 53 |
|
|
91
91
|
| `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
|
|
92
92
|
| `@stacksjs/support` | [`stacks-support`](../stacks-support/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/support/src/index.ts) | 6 |
|
|
93
93
|
| `@stacksjs/telephony` | [`stacks-telephony`](../stacks-telephony/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/telephony/src/index.ts) | 5 |
|
|
@@ -98,7 +98,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
98
98
|
| `@stacksjs/ui` | [`stacks-ui`](../stacks-ui/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ui/src/index.ts) | 6 |
|
|
99
99
|
| `@stacksjs/utils` | [`stacks-utils`](../stacks-utils/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/utils/src/index.ts) | 28 |
|
|
100
100
|
| `@stacksjs/validation` | [`stacks-validation`](../stacks-validation/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/validation/src/index.ts) | 26 |
|
|
101
|
-
| `@stacksjs/video` | [`stacks-video`](../stacks-video/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/index.ts) |
|
|
101
|
+
| `@stacksjs/video` | [`stacks-video`](../stacks-video/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/index.ts) | 4 |
|
|
102
102
|
| `@stacksjs/waf` | [`stacks-security`](../stacks-security/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/waf/src/index.ts) | 2 |
|
|
103
103
|
| `@stacksjs/whois` | [`stacks-whois`](../stacks-whois/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/whois/src/index.ts) | 5 |
|
|
104
104
|
|
|
@@ -203,7 +203,7 @@ Declared runtime exports: `BrowserQueryBuilder`, `BrowserQueryError`, `browserAu
|
|
|
203
203
|
|
|
204
204
|
Local source modules: [src/auto-init.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/auto-init.ts), [src/composables/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/composables/index.ts), [src/model-loader.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/model-loader.ts), [src/types/globals.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/types/globals.ts), [src/utils/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/src/utils/index.ts).
|
|
205
205
|
|
|
206
|
-
Evidence directory: [
|
|
206
|
+
Evidence directory: [11 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/browser/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
207
207
|
|
|
208
208
|
### @stacksjs/browser-extension
|
|
209
209
|
|
|
@@ -855,11 +855,11 @@ Evidence directory: [21 retained tests](https://github.com/stacksjs/stacks/blob/
|
|
|
855
855
|
|
|
856
856
|
Guidance: [`stacks-storage`](../stacks-storage/SKILL.md). Source: [storage/framework/core/storage/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts).
|
|
857
857
|
|
|
858
|
-
Declared runtime exports: `DirectoryListingChangedError`, `PathSanitizeError`, `Storage`, `StorageManager`, `UploadedFile`, `azureDisk`, `backblazeDisk`, `clearRevokedSignedStorageTokens`, `configFromEnv`, `createSignedStorageToken`, `detectMimeFromMagicBytes`, `ensureBucket`, `ensureConfiguredBuckets`, `fileInfo`, `fileInfoFromBytes`, `fileKind`, `filebaseDisk`, `gcsDisk`, `hetznerDisk`, `isPreviewable`, `isSignedStorageTokenRevoked`, `localDisk`, `parseDiskPath`, `r2Disk`, `resolveMime`, `revokeSignedStorageToken`, `s3Disk`, `sanitizePresignedDir`, `sanitizePresignedFilename`, `serveFile`, `signS3PresignedPost`, `storage`, `uploadedFile`, `uploadedFiles`, `verifySignedStorageToken`, `verifyUploadedMime`.
|
|
858
|
+
Declared runtime exports: `DirectoryListingChangedError`, `PathSanitizeError`, `Storage`, `StorageManager`, `UploadSessionError`, `UploadedFile`, `azureDisk`, `backblazeDisk`, `clearRevokedSignedStorageTokens`, `configFromEnv`, `createSignedStorageToken`, `createUploadSessions`, `detectMimeFromMagicBytes`, `ensureBucket`, `ensureConfiguredBuckets`, `fileInfo`, `fileInfoFromBytes`, `fileKind`, `filebaseDisk`, `gcsDisk`, `hetznerDisk`, `isPreviewable`, `isSignedStorageTokenRevoked`, `localDisk`, `parseDiskPath`, `r2Disk`, `resolveMime`, `revokeSignedStorageToken`, `s3Disk`, `sanitizePresignedDir`, `sanitizePresignedFilename`, `serveFile`, `signS3PresignedPost`, `storage`, `uploadedFile`, `uploadedFiles`, `verifySignedStorageToken`, `verifyUploadedMime`.
|
|
859
859
|
|
|
860
|
-
Local source modules: [src/adapters/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/adapters/index.ts), [src/bounded-text-file.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/bounded-text-file.ts), [src/completed-artifact-directory.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/completed-artifact-directory.ts), [src/copy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/copy.ts), [src/delete.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/delete.ts), [src/directory-page.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/directory-page.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/drivers/index.ts), [src/facade.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/facade.ts), [src/file-info.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/file-info.ts), [src/files.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/files.ts), [src/folders.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/folders.ts), [src/fs.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/fs.ts), [src/glob.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/glob.ts), [src/hash.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/hash.ts), [src/helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/helpers.ts), [src/mime-verify.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/mime-verify.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/path-sanitize.ts), [src/provision.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/provision.ts), [src/s3-presigned-post.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/s3-presigned-post.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/signed-url.ts), [src/static-serve.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/static-serve.ts), [src/storage.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/storage.ts), [src/temporary-workspaces.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/temporary-workspaces.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types.ts), [src/types/filesystem.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types/filesystem.ts), [src/uploaded-file.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/uploaded-file.ts), [src/zip.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/zip.ts).
|
|
860
|
+
Local source modules: [src/adapters/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/adapters/index.ts), [src/bounded-text-file.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/bounded-text-file.ts), [src/completed-artifact-directory.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/completed-artifact-directory.ts), [src/copy.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/copy.ts), [src/delete.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/delete.ts), [src/directory-page.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/directory-page.ts), [src/drivers/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/drivers/index.ts), [src/facade.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/facade.ts), [src/file-info.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/file-info.ts), [src/files.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/files.ts), [src/folders.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/folders.ts), [src/fs.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/fs.ts), [src/glob.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/glob.ts), [src/hash.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/hash.ts), [src/helpers.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/helpers.ts), [src/mime-verify.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/mime-verify.ts), [src/path-sanitize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/path-sanitize.ts), [src/provision.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/provision.ts), [src/s3-presigned-post.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/s3-presigned-post.ts), [src/signed-url.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/signed-url.ts), [src/static-serve.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/static-serve.ts), [src/storage.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/storage.ts), [src/temporary-workspaces.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/temporary-workspaces.ts), [src/types.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types.ts), [src/types/filesystem.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/types/filesystem.ts), [src/upload-sessions.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/upload-sessions.ts), [src/uploaded-file.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/uploaded-file.ts), [src/zip.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/zip.ts).
|
|
861
861
|
|
|
862
|
-
Evidence directory: [
|
|
862
|
+
Evidence directory: [53 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
863
863
|
|
|
864
864
|
### @stacksjs/strings
|
|
865
865
|
|
|
@@ -965,11 +965,11 @@ Evidence directory: [26 retained tests](https://github.com/stacksjs/stacks/blob/
|
|
|
965
965
|
|
|
966
966
|
Guidance: [`stacks-video`](../stacks-video/SKILL.md). Source: [storage/framework/core/video/src/index.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/index.ts).
|
|
967
967
|
|
|
968
|
-
Declared runtime exports: `VideoBuilder`, `assertVideoPlanExecutable`, `createHlsMaster`, `createPreviewVtt`, `createProtectedVideoPlaylist`, `deriveVideoLadder`, `inspectVideo`, `parseByteRange`, `processVideoPlan`, `signVideoAsset`, `verifyVideoAsset`, `video`, `videoAssetHeaders`, `videoContentType`, `videoFileResponse`, `videoResponseHeaders`.
|
|
968
|
+
Declared runtime exports: `VideoBuilder`, `assertVideoPlanExecutable`, `createHlsMaster`, `createPreviewVtt`, `createProtectedVideoPlaylist`, `deriveVideoLadder`, `inspectVideo`, `inspectVideoFile`, `isFaststart`, `parseByteRange`, `processVideoPlan`, `signVideoAsset`, `verifyVideoAsset`, `video`, `videoAssetHeaders`, `videoContentType`, `videoFileResponse`, `videoResponseHeaders`, `webReadyProblems`.
|
|
969
969
|
|
|
970
|
-
Local source modules: [src/files.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/files.ts), [src/inspect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/inspect.ts).
|
|
970
|
+
Local source modules: [src/files.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/files.ts), [src/inspect.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/inspect.ts), [src/upload.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/src/upload.ts).
|
|
971
971
|
|
|
972
|
-
Evidence directory: [
|
|
972
|
+
Evidence directory: [4 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/video/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
973
973
|
|
|
974
974
|
### @stacksjs/waf
|
|
975
975
|
|
|
@@ -412,6 +412,57 @@ const path = await file.move('new/path/file.jpg', 'local')
|
|
|
412
412
|
|
|
413
413
|
`store()` generates a hash-based filename using `crypto.randomUUID()`. `storeAs()` validates the filename: rejects path traversal (`..`), forward slashes, and backslashes.
|
|
414
414
|
|
|
415
|
+
## Uploads in parts (upload sessions)
|
|
416
|
+
|
|
417
|
+
For files too large or too precious for one request: a phone clip on a gym's
|
|
418
|
+
wifi, anything behind a gateway with a body limit. The client announces the
|
|
419
|
+
file, sends parts of 8 MiB that are each retried alone, and a part that
|
|
420
|
+
arrived is never sent again, even after the page reloads.
|
|
421
|
+
|
|
422
|
+
```ts
|
|
423
|
+
import { createUploadSessions, UploadSessionError } from '@stacksjs/storage'
|
|
424
|
+
|
|
425
|
+
const uploads = createUploadSessions({
|
|
426
|
+
directory: storagePath('app/upload-sessions'), // local, private to this process
|
|
427
|
+
maxBytes: 2 * 1024 ** 3,
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
// POST /uploads -> begin
|
|
431
|
+
const upload = await uploads.begin({ owner: String(user.id), name, size, type, meta })
|
|
432
|
+
// GET /uploads/{id} -> which parts are in
|
|
433
|
+
await uploads.status(id, owner)
|
|
434
|
+
// PUT /uploads/{id}/parts/{n} -> the part's raw bytes (application/octet-stream)
|
|
435
|
+
await uploads.receive(id, owner, index, new Uint8Array(await request.arrayBuffer()))
|
|
436
|
+
// DELETE /uploads/{id}
|
|
437
|
+
await uploads.abort(id, owner)
|
|
438
|
+
|
|
439
|
+
// In the action that uses the file:
|
|
440
|
+
const done = await uploads.complete(id, owner) // { path, name, size, type, meta, discard }
|
|
441
|
+
await Storage.disk().putStream(key, Bun.file(done.path).stream(), { contentType })
|
|
442
|
+
await done.discard()
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
- Every call names the `owner` given at `begin`; anyone else gets `not-found`,
|
|
446
|
+
the same as an id that never existed. `UploadSessionError` carries the HTTP
|
|
447
|
+
`status` to answer with (404, 409 incomplete, 413, 422, 429).
|
|
448
|
+
- A part must be exactly `partBytes` (the last one, the remainder). Sending one
|
|
449
|
+
again replaces it, so a retry after a timeout is safe. `complete` is safe to
|
|
450
|
+
repeat too.
|
|
451
|
+
- Parts live on this machine's filesystem, not on a disk: an object store
|
|
452
|
+
cannot append, and consumers need a path. With several servers, share the
|
|
453
|
+
directory or pin a session to one of them.
|
|
454
|
+
- Run `uploads.prune()` from the scheduler; unfinished sessions go after
|
|
455
|
+
`ttlSeconds` (a day by default). `maxOpenPerOwner` caps what one account can
|
|
456
|
+
leave lying around.
|
|
457
|
+
- Browser side: `uploadInParts(file, { endpoint, transport, onProgress, signal,
|
|
458
|
+
resumeKey })` from `@stacksjs/browser` speaks exactly these routes, retries
|
|
459
|
+
each part with a growing pause, honours `Retry-After`, and with
|
|
460
|
+
`resumeKey: uploadResumeKey(file, purpose)` continues a file picked again.
|
|
461
|
+
Route bodies are `{ upload: <session view> }`.
|
|
462
|
+
|
|
463
|
+
Source: core/storage/src/upload-sessions.ts, core/browser/src/utils/uploads.ts.
|
|
464
|
+
Tests: core/storage/tests/upload-sessions.test.ts, core/browser/tests/uploads.test.ts.
|
|
465
|
+
|
|
415
466
|
## Low-Level File Operations
|
|
416
467
|
|
|
417
468
|
### Read/Write Files
|
|
@@ -31,3 +31,32 @@ pipeline; they do not certify live encoding support on an arbitrary machine.
|
|
|
31
31
|
Test invalid ranges, signatures/expiry, capabilities and file metadata.
|
|
32
32
|
Source: core/video/src/index.ts, files.ts and inspect.ts. Retained tests:
|
|
33
33
|
video.test.ts, process.test.ts and files.test.ts.
|
|
34
|
+
|
|
35
|
+
## Uploads: convert on the device, check on the server
|
|
36
|
+
|
|
37
|
+
A picked clip is converted in the browser before it is sent, and the server
|
|
38
|
+
reads what arrived instead of believing the client.
|
|
39
|
+
|
|
40
|
+
- Browser: `prepareVideoUpload(file, { onProgress, signal })` from
|
|
41
|
+
`@stacksjs/video/browser` (its own path; nothing server-side comes with it).
|
|
42
|
+
It answers `{ video, poster?, converter }`: an upright H.264 and AAC MP4
|
|
43
|
+
inside 1280 by 720 at 30 frames a second with its index first, and a JPEG
|
|
44
|
+
poster, encoded with the browser's own codecs (WebCodecs through ts-videos).
|
|
45
|
+
It never fails an upload: without WebCodecs, or for a clip the browser cannot
|
|
46
|
+
read, `video` is the original and `converter` is null (`reason` says why).
|
|
47
|
+
Only a cancellation throws. `canPrepareVideoUpload()` is the cheap check.
|
|
48
|
+
- Server: `inspectVideo(bytes)` or `inspectVideoFile(path)` (reads the first
|
|
49
|
+
8 MB, the rest only when the index is at the end) answer the container,
|
|
50
|
+
codecs, the frame as shown and its `rotation`; `isFaststart(bytes)` reads the
|
|
51
|
+
box order; `webReadyProblems(inspection, faststart)` lists why a file is not
|
|
52
|
+
what `prepareVideoUpload` makes, and is empty when it is. A client's
|
|
53
|
+
"converted" flag is worth exactly that check.
|
|
54
|
+
- Send large files with upload sessions (`createUploadSessions` in
|
|
55
|
+
`@stacksjs/storage`, `uploadInParts` in `@stacksjs/browser`), then inspect
|
|
56
|
+
the finished file by path.
|
|
57
|
+
|
|
58
|
+
There is no server-side encoder in this package: a Bun process has no
|
|
59
|
+
WebCodecs. Do not promise a transcode on upload; convert on the device, or
|
|
60
|
+
run an ffmpeg job of your own.
|
|
61
|
+
Source: core/video/src/browser.ts and upload.ts. Tests: upload.test.ts, with a
|
|
62
|
+
real phone clip and the clip a browser made of it as fixtures.
|
package/ide/vscode/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"publisher": "Stacks",
|
|
3
3
|
"name": "vscode-stacks",
|
|
4
4
|
"displayName": "Stacks",
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.674",
|
|
6
6
|
"description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.674",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@iconify-json/f7": "^1.2.2",
|
|
47
47
|
"@iconify-json/hugeicons": "^1.2.35",
|
|
48
|
-
"@stacksjs/mobile": "0.75.
|
|
49
|
-
"@stacksjs/sanitizer": "^0.2.
|
|
50
|
-
"@stacksjs/stx": "^0.2.
|
|
51
|
-
"@stacksjs/strings": "0.75.
|
|
48
|
+
"@stacksjs/mobile": "0.75.674",
|
|
49
|
+
"@stacksjs/sanitizer": "^0.2.931",
|
|
50
|
+
"@stacksjs/stx": "^0.2.931",
|
|
51
|
+
"@stacksjs/strings": "0.75.674",
|
|
52
52
|
"@xterm/addon-fit": "^0.11.0",
|
|
53
53
|
"@xterm/xterm": "^6.0.0",
|
|
54
54
|
"ts-qr-codes": "^0.1.8",
|
|
55
|
-
"@stacksjs/support": "0.75.
|
|
56
|
-
"@stacksjs/browser": "0.75.
|
|
55
|
+
"@stacksjs/support": "0.75.674",
|
|
56
|
+
"@stacksjs/browser": "0.75.674"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -128,8 +128,8 @@ onMount(() => {
|
|
|
128
128
|
|
|
129
129
|
<style>
|
|
130
130
|
.dashboard-overview {
|
|
131
|
-
--overview-border: light-dark(#dedee5, #ffffff1a);
|
|
132
|
-
--overview-surface: light-dark(#ffffff, #18191f);
|
|
131
|
+
--overview-border: var(--dashboard-border, light-dark(#dedee5, #ffffff1a));
|
|
132
|
+
--overview-surface: var(--dashboard-surface, light-dark(#ffffff, #18191f));
|
|
133
133
|
}
|
|
134
134
|
.overview-metrics {
|
|
135
135
|
display: grid;
|
|
@@ -145,12 +145,12 @@ onMount(() => {
|
|
|
145
145
|
.overview-panel {
|
|
146
146
|
background: var(--overview-surface);
|
|
147
147
|
border: 1px solid var(--overview-border);
|
|
148
|
-
border-radius: 1rem;
|
|
148
|
+
border-radius: var(--dashboard-radius, 1rem);
|
|
149
149
|
}
|
|
150
150
|
</style>
|
|
151
151
|
|
|
152
|
-
<div class="mx-auto px-4 py-6 sm:px-8 sm:py-8 max-w-6xl dashboard-overview">
|
|
153
|
-
<div class="flex flex-wrap gap-3 items-start justify-between mb-6">
|
|
152
|
+
<div class="mx-auto px-4 py-6 sm:px-8 sm:py-8 max-w-6xl dashboard-overview" data-dashboard-overview-page>
|
|
153
|
+
<div data-dashboard-hero class="flex flex-wrap gap-3 items-start justify-between mb-6">
|
|
154
154
|
<PageHeader title="Dashboard" description="Application activity and service health" />
|
|
155
155
|
<Button variant="secondary" size="sm" :loading="dashboard.isLoading.value" @click="loadDashboard">
|
|
156
156
|
Refresh
|
|
@@ -166,8 +166,8 @@ onMount(() => {
|
|
|
166
166
|
|
|
167
167
|
<section aria-labelledby="application-overview" class="mb-5 p-3 sm:p-4 overview-panel">
|
|
168
168
|
<div class="flex flex-wrap gap-2 items-center justify-between mb-3">
|
|
169
|
-
<h2 id="application-overview" class="font-semibold text-base text-neutral-900 dark:text-white">Overview</h2>
|
|
170
|
-
<StxLink to="/requests" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">Request history</StxLink>
|
|
169
|
+
<h2 data-dashboard-ink id="application-overview" class="font-semibold text-base text-neutral-900 dark:text-white">Overview</h2>
|
|
170
|
+
<StxLink data-dashboard-muted to="/requests" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">Request history</StxLink>
|
|
171
171
|
</div>
|
|
172
172
|
<div class="overview-metrics">
|
|
173
173
|
<StatsCard :for="item in loadingCards" :if="dashboard.isLoading.value && stats().length === 0" loading />
|
|
@@ -195,7 +195,7 @@ onMount(() => {
|
|
|
195
195
|
<ServiceHealth :services="services()" :loading="dashboard.isLoading.value" />
|
|
196
196
|
<ActivityTable :activities="activities()" :description="activityDescription()" :loading="dashboard.isLoading.value">
|
|
197
197
|
<template #actions>
|
|
198
|
-
<StxLink to="/data/activity" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">View all</StxLink>
|
|
198
|
+
<StxLink data-dashboard-muted to="/data/activity" class="text-neutral-500 text-sm hover:text-neutral-700 dark:hover:text-neutral-300">View all</StxLink>
|
|
199
199
|
</template>
|
|
200
200
|
</ActivityTable>
|
|
201
201
|
</div>
|
|
@@ -69,7 +69,7 @@ useEventListener('keydown', handleKeydown)
|
|
|
69
69
|
useEventListener('stx:navigate', closeSidebar)
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
|
-
<div class="flex lg:hidden sticky top-0 z-40 gap-3 items-center px-4 h-14 bg-white/95 dark:bg-neutral-950/95 border-b border-neutral-200 dark:border-neutral-800 backdrop-blur-xl">
|
|
72
|
+
<div data-dashboard-mobile-bar class="flex lg:hidden sticky top-0 z-40 gap-3 items-center px-4 h-14 bg-white/95 dark:bg-neutral-950/95 border-b border-neutral-200 dark:border-neutral-800 backdrop-blur-xl">
|
|
73
73
|
<button
|
|
74
74
|
ref="dashboardMobileMenuButton"
|
|
75
75
|
type="button"
|
|
@@ -20,13 +20,18 @@ defineClientPayload({ navSections })
|
|
|
20
20
|
|
|
21
21
|
<script client>
|
|
22
22
|
import type { ColorMode, SidebarStyle } from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
|
|
23
|
+
import { ORIGINAL_DASHBOARD_THEME } from '@stacksjs/defaults/views/dashboard/composables/dashboard-themes'
|
|
23
24
|
import {
|
|
24
25
|
COLOR_MODE_OPTIONS,
|
|
25
26
|
SIDEBAR_STYLE_OPTIONS,
|
|
26
27
|
useAppearance,
|
|
27
28
|
} from '@stacksjs/defaults/views/dashboard/composables/useAppearance'
|
|
29
|
+
import { useDashboardThemes } from '@stacksjs/defaults/views/dashboard/composables/useDashboardThemes'
|
|
28
30
|
|
|
29
31
|
const appearance = useAppearance()
|
|
32
|
+
const themes = useDashboardThemes()
|
|
33
|
+
const usesOriginalTheme = derived(() => themes.active() === ORIGINAL_DASHBOARD_THEME)
|
|
34
|
+
const resetError = state('')
|
|
30
35
|
|
|
31
36
|
// Every control writes straight through to the preference. There is no Save
|
|
32
37
|
// button and no draft state: the shell restyles under the cursor, which is both
|
|
@@ -59,7 +64,15 @@ function toggleSection(id: string, visible: boolean) {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
function resetAll() {
|
|
62
|
-
|
|
67
|
+
resetError.set('')
|
|
68
|
+
try {
|
|
69
|
+
if (!usesOriginalTheme())
|
|
70
|
+
themes.select(ORIGINAL_DASHBOARD_THEME)
|
|
71
|
+
appearance.reset()
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
resetError.set((error as Error).message)
|
|
75
|
+
}
|
|
63
76
|
}
|
|
64
77
|
|
|
65
78
|
// Selected state travels as a data attribute rather than as a swapped class
|
|
@@ -224,8 +237,10 @@ const selected = (a: unknown, b: unknown) => String(a === b)
|
|
|
224
237
|
backLabel="Settings"
|
|
225
238
|
/>
|
|
226
239
|
|
|
240
|
+
<DashboardThemePicker />
|
|
241
|
+
|
|
227
242
|
<!-- ===================== Sidebar style ===================== -->
|
|
228
|
-
<Card variant="default" padding="none">
|
|
243
|
+
<Card :if="usesOriginalTheme()" variant="default" padding="none">
|
|
229
244
|
<div class="px-6 py-5 border-b border-neutral-200/60 dark:border-white/5">
|
|
230
245
|
<h2 class="font-semibold text-lg text-neutral-900 dark:text-white">Sidebar style</h2>
|
|
231
246
|
<p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">
|
|
@@ -318,11 +333,12 @@ const selected = (a: unknown, b: unknown) => String(a === b)
|
|
|
318
333
|
<!-- ===================== Reset ===================== -->
|
|
319
334
|
<div class="flex items-center justify-between px-1">
|
|
320
335
|
<p class="text-neutral-500 text-xs dark:text-neutral-400">
|
|
321
|
-
|
|
336
|
+
Themes and appearance preferences are stored in this browser.
|
|
322
337
|
</p>
|
|
323
338
|
<Button variant="secondary" size="sm" @click="resetAll()">
|
|
324
339
|
Reset to defaults
|
|
325
340
|
</Button>
|
|
326
341
|
</div>
|
|
342
|
+
<p :if="resetError()" class="text-red-700 text-sm dark:text-red-300" role="alert" :text="resetError()"></p>
|
|
327
343
|
</div>
|
|
328
344
|
</template>
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script client>
|
|
2
|
+
import type { DashboardTheme } from '@stacksjs/defaults/views/dashboard/composables/dashboard-themes'
|
|
3
|
+
import {
|
|
4
|
+
BUNDLED_DASHBOARD_THEMES,
|
|
5
|
+
dashboardThemeColor,
|
|
6
|
+
MAX_THEME_FILE_SIZE,
|
|
7
|
+
ORIGINAL_DASHBOARD_THEME,
|
|
8
|
+
SYSTEM_CLEANER_THEME,
|
|
9
|
+
} from '@stacksjs/defaults/views/dashboard/composables/dashboard-themes'
|
|
10
|
+
import { useDashboardThemes } from '@stacksjs/defaults/views/dashboard/composables/useDashboardThemes'
|
|
11
|
+
|
|
12
|
+
const themes = useDashboardThemes()
|
|
13
|
+
const active = themes.active
|
|
14
|
+
const installed = themes.installed
|
|
15
|
+
const themeFile = useRef('dashboardThemeFile')
|
|
16
|
+
const feedback = state('')
|
|
17
|
+
const failure = state('')
|
|
18
|
+
|
|
19
|
+
const themesToShow = derived(() => [
|
|
20
|
+
{
|
|
21
|
+
id: ORIGINAL_DASHBOARD_THEME,
|
|
22
|
+
name: 'The Original',
|
|
23
|
+
description: 'The classic Stacks dashboard with your choice of sidebar style.',
|
|
24
|
+
preview: '',
|
|
25
|
+
overview: 'panel',
|
|
26
|
+
},
|
|
27
|
+
...[...BUNDLED_DASHBOARD_THEMES, ...installed()].map(theme => ({
|
|
28
|
+
id: theme.id,
|
|
29
|
+
name: theme.name,
|
|
30
|
+
description: theme.description ?? '',
|
|
31
|
+
preview: previewStyle(theme),
|
|
32
|
+
overview: theme.overview,
|
|
33
|
+
})),
|
|
34
|
+
])
|
|
35
|
+
|
|
36
|
+
const selectedInstallation = derived(() => installed().find(theme => theme.id === active()))
|
|
37
|
+
const downloadable = derived(() => selectedInstallation() || {
|
|
38
|
+
...SYSTEM_CLEANER_THEME,
|
|
39
|
+
id: 'my-dashboard',
|
|
40
|
+
name: 'My Dashboard',
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
function previewStyle(theme: DashboardTheme): string {
|
|
44
|
+
return [
|
|
45
|
+
`--preview-window:${dashboardThemeColor(theme, 'window')}`,
|
|
46
|
+
`--preview-canvas:${dashboardThemeColor(theme, 'canvas')}`,
|
|
47
|
+
`--preview-surface:${dashboardThemeColor(theme, 'surface')}`,
|
|
48
|
+
`--preview-accent:${dashboardThemeColor(theme, 'accentFill')}`,
|
|
49
|
+
`--preview-hero-start:${dashboardThemeColor(theme, 'heroStart')}`,
|
|
50
|
+
`--preview-hero-end:${dashboardThemeColor(theme, 'heroEnd')}`,
|
|
51
|
+
`--preview-gap:${theme.layout === 'inset' ? '4px' : '0'}`,
|
|
52
|
+
].join(';')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function downloadHref(): string {
|
|
56
|
+
return `data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(downloadable(), null, 2))}`
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function selectTheme(id: string): void {
|
|
60
|
+
feedback.set('')
|
|
61
|
+
failure.set('')
|
|
62
|
+
try {
|
|
63
|
+
themes.select(id)
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
failure.set((error as Error).message)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function importTheme(event: Event): Promise<void> {
|
|
71
|
+
const input = event.currentTarget as HTMLInputElement
|
|
72
|
+
const file = input.files?.[0]
|
|
73
|
+
if (!file)
|
|
74
|
+
return
|
|
75
|
+
input.value = ''
|
|
76
|
+
feedback.set('')
|
|
77
|
+
failure.set('')
|
|
78
|
+
try {
|
|
79
|
+
if (file.size > MAX_THEME_FILE_SIZE)
|
|
80
|
+
throw new Error('Choose a theme JSON file smaller than 16 KB.')
|
|
81
|
+
let manifest: unknown
|
|
82
|
+
try {
|
|
83
|
+
manifest = JSON.parse(await file.text())
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new Error('Choose a valid theme JSON file.')
|
|
87
|
+
}
|
|
88
|
+
const name = themes.install(manifest)
|
|
89
|
+
feedback.set(`${name} is installed and active.`)
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
failure.set((error as Error).message)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function removeTheme(): void {
|
|
97
|
+
const theme = selectedInstallation()
|
|
98
|
+
if (!theme)
|
|
99
|
+
return
|
|
100
|
+
feedback.set('')
|
|
101
|
+
failure.set('')
|
|
102
|
+
try {
|
|
103
|
+
themes.remove(theme.id)
|
|
104
|
+
feedback.set(`${theme.name} was removed. The Original is active.`)
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
failure.set((error as Error).message)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style>
|
|
113
|
+
.dashboard-theme-choice {
|
|
114
|
+
border-color: var(--dashboard-border, light-dark(#e7e5e4, #ffffff24));
|
|
115
|
+
background: var(--dashboard-surface, light-dark(#fff, #262626));
|
|
116
|
+
}
|
|
117
|
+
.dashboard-theme-choice:hover {
|
|
118
|
+
background: var(--dashboard-surface-muted, light-dark(#fafaf9, #333));
|
|
119
|
+
}
|
|
120
|
+
.dashboard-theme-choice[aria-pressed="true"] {
|
|
121
|
+
border-color: var(--dashboard-accent, light-dark(#2563eb, #60a5fa));
|
|
122
|
+
box-shadow: 0 0 0 1px var(--dashboard-accent, light-dark(#2563eb, #60a5fa));
|
|
123
|
+
}
|
|
124
|
+
.dashboard-theme-choice:focus-visible {
|
|
125
|
+
outline: 2px solid var(--dashboard-accent, light-dark(#2563eb, #60a5fa));
|
|
126
|
+
outline-offset: 3px;
|
|
127
|
+
}
|
|
128
|
+
.dashboard-theme-preview {
|
|
129
|
+
color-scheme: light;
|
|
130
|
+
height: 5.25rem;
|
|
131
|
+
background: var(--preview-window, light-dark(#e7e7ec, #1c1c1e));
|
|
132
|
+
box-shadow: inset 0 0 0 1px rgb(127 127 127 / .18);
|
|
133
|
+
}
|
|
134
|
+
.dark .dashboard-theme-preview {
|
|
135
|
+
color-scheme: dark;
|
|
136
|
+
}
|
|
137
|
+
.dashboard-theme-preview[data-overview="immersive"] {
|
|
138
|
+
background: linear-gradient(155deg, var(--preview-hero-start), var(--preview-hero-end));
|
|
139
|
+
}
|
|
140
|
+
.dashboard-theme-preview[data-overview="immersive"] .dashboard-theme-preview-page {
|
|
141
|
+
background: transparent;
|
|
142
|
+
}
|
|
143
|
+
.dashboard-theme-preview[data-overview="immersive"] .dashboard-theme-preview-page > span {
|
|
144
|
+
background: rgb(255 255 255 / .15);
|
|
145
|
+
}
|
|
146
|
+
.dashboard-theme-preview-nav {
|
|
147
|
+
width: 30%;
|
|
148
|
+
display: grid;
|
|
149
|
+
align-content: start;
|
|
150
|
+
gap: 4px;
|
|
151
|
+
padding: 9px 5px;
|
|
152
|
+
}
|
|
153
|
+
.dashboard-theme-preview-nav > span {
|
|
154
|
+
height: 5px;
|
|
155
|
+
border-radius: 2px;
|
|
156
|
+
background: rgb(127 127 127 / .25);
|
|
157
|
+
}
|
|
158
|
+
.dashboard-theme-preview-nav > span:first-child {
|
|
159
|
+
background: var(--preview-accent, #007aff);
|
|
160
|
+
}
|
|
161
|
+
.dashboard-theme-preview-page {
|
|
162
|
+
display: grid;
|
|
163
|
+
flex: 1;
|
|
164
|
+
grid-template: 2fr 1fr / repeat(3, 1fr);
|
|
165
|
+
gap: 4px;
|
|
166
|
+
padding: 7px;
|
|
167
|
+
margin: var(--preview-gap, 0) var(--preview-gap, 0) var(--preview-gap, 0) 0;
|
|
168
|
+
border-radius: var(--preview-gap, 0);
|
|
169
|
+
background: var(--preview-canvas, light-dark(#f6f6f9, #121318));
|
|
170
|
+
}
|
|
171
|
+
.dashboard-theme-preview-page > span {
|
|
172
|
+
border-radius: 3px;
|
|
173
|
+
background: var(--preview-surface, light-dark(#fff, #27272a));
|
|
174
|
+
}
|
|
175
|
+
.dashboard-theme-preview-page > span:first-child {
|
|
176
|
+
grid-column: 1 / -1;
|
|
177
|
+
background: linear-gradient(155deg, var(--preview-hero-start, light-dark(#e4e4eb, #2d2e36)), var(--preview-hero-end, light-dark(#ececf1, #23242b)));
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
180
|
+
|
|
181
|
+
<template>
|
|
182
|
+
<Card variant="default" padding="none">
|
|
183
|
+
<div class="px-6 py-5 border-b border-neutral-200/60 dark:border-white/5">
|
|
184
|
+
<h2 class="font-semibold text-lg text-neutral-900 dark:text-white">Dashboard theme</h2>
|
|
185
|
+
<p class="mt-1 text-neutral-500 text-sm dark:text-neutral-400">Choose a theme or install one from a JSON file.</p>
|
|
186
|
+
</div>
|
|
187
|
+
<div class="grid gap-4 sm:grid-cols-2 p-6" role="group" aria-label="Dashboard theme">
|
|
188
|
+
<button
|
|
189
|
+
:for="theme in themesToShow()"
|
|
190
|
+
type="button"
|
|
191
|
+
class="flex flex-col gap-2 p-3 text-left border rounded-xl dashboard-theme-choice"
|
|
192
|
+
:data-theme-id="theme.id"
|
|
193
|
+
:aria-pressed="String(active() === theme.id)"
|
|
194
|
+
@click="selectTheme(theme.id)"
|
|
195
|
+
>
|
|
196
|
+
<span class="flex overflow-hidden w-full rounded-lg dashboard-theme-preview" :style="theme.preview" :data-overview="theme.overview" aria-hidden="true">
|
|
197
|
+
<span class="dashboard-theme-preview-nav"><span></span><span></span><span></span></span>
|
|
198
|
+
<span class="dashboard-theme-preview-page"><span></span><span></span><span></span><span></span></span>
|
|
199
|
+
</span>
|
|
200
|
+
<span class="font-medium text-neutral-900 text-sm dark:text-white" :text="theme.name"></span>
|
|
201
|
+
<span :if="theme.description" class="text-neutral-500 text-xs dark:text-neutral-400" :text="theme.description"></span>
|
|
202
|
+
</button>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="pb-6 px-6">
|
|
205
|
+
<div class="flex flex-wrap gap-2">
|
|
206
|
+
<input ref="dashboardThemeFile" hidden type="file" accept=".json,application/json" @change="importTheme($event)" />
|
|
207
|
+
<Button variant="secondary" size="sm" @click="themeFile.current?.click()">Install theme</Button>
|
|
208
|
+
<Button tag="a" variant="outline" size="sm" :href="downloadHref()" :download="downloadable().id + '.json'">
|
|
209
|
+
{{ selectedInstallation() ? 'Export theme' : 'Download starter theme' }}
|
|
210
|
+
</Button>
|
|
211
|
+
<Button :if="selectedInstallation()" variant="outline" size="sm" @click="removeTheme()">Remove theme</Button>
|
|
212
|
+
</div>
|
|
213
|
+
<p class="mt-3 text-neutral-500 text-xs dark:text-neutral-400">To build a theme, download the starter, edit its JSON, and install the file.</p>
|
|
214
|
+
<p :if="feedback()" class="mt-2 text-neutral-700 text-sm dark:text-neutral-200" role="status" :text="feedback()"></p>
|
|
215
|
+
<p :if="failure()" class="mt-2 text-red-700 text-sm dark:text-red-300" role="alert" :text="failure()"></p>
|
|
216
|
+
</div>
|
|
217
|
+
</Card>
|
|
218
|
+
</template>
|