@danielng23/dsh-client-ui-theme-store 0.1.0
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/README.md +161 -0
- package/catalog/edex-themes.json +634 -0
- package/lib/client.js +1591 -0
- package/lib/index.js +1093 -0
- package/lib/invariant.js +19 -0
- package/lib/types/client/ThemeStoreSection.d.ts +60 -0
- package/lib/types/client/catalog.d.ts +84 -0
- package/lib/types/client/index.d.ts +40 -0
- package/lib/types/client/locales.d.ts +60 -0
- package/lib/types/client/settings-store.d.ts +35 -0
- package/lib/types/client/theme-store.d.ts +95 -0
- package/lib/types/host/installer.d.ts +82 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/theme-store-settings.d.ts +14 -0
- package/package.json +104 -0
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# @danielng23/dsh-client-ui-theme-store
|
|
2
|
+
|
|
3
|
+
**Theme store plugin for the DeepSeek Harness Web GUI.** Ships a new **Theme Store** settings page where users browse a flat catalog of curated color themes, preview them via screenshots, and apply them with one click. The catalog is a plain JSON file in this repository (`catalog/themes.json`) — push the repo to GitHub and the plugin fetches the catalog from the raw URL at runtime.
|
|
4
|
+
|
|
5
|
+
> "No category, just read a json file from this repo(push to github), theme contains name, author, screenshot."
|
|
6
|
+
|
|
7
|
+
## What it looks like
|
|
8
|
+
|
|
9
|
+
A `settings.section` entry named **Theme Store** (order 12, between Models and Plugins) renders a grid of theme cards. Each card shows:
|
|
10
|
+
|
|
11
|
+
- **Screenshot** — preview image (rendered inside `<img>`, falls back to a palette swatch when the image is broken)
|
|
12
|
+
- **Name** — display name of the theme
|
|
13
|
+
- **Author** — attribution
|
|
14
|
+
- **Scheme badge** — Light or Dark
|
|
15
|
+
- **Apply button** — applies the theme; shows "Applied" while the theme is active
|
|
16
|
+
|
|
17
|
+
Clicking **Apply**:
|
|
18
|
+
|
|
19
|
+
1. Registers the theme with the harness theme service (`ctx.theme.register(...)`) — idempotent, no crash on duplicate ids.
|
|
20
|
+
2. Switches the active preference (`ctx.theme.setTheme(id)`).
|
|
21
|
+
3. Persists the applied theme id in the plugin's own durable settings namespace (`ui-theme-store.applied`) so the choice survives reloads — the built-in `ui-theme` schema only accepts `light/dark/system`, so the store owns its own persistence.
|
|
22
|
+
|
|
23
|
+
## Catalog
|
|
24
|
+
|
|
25
|
+
The catalog is a JSON document at `catalog/themes.json` in this repository. Its structure:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"themes": [
|
|
30
|
+
{
|
|
31
|
+
"id": "ocean",
|
|
32
|
+
"name": "Ocean",
|
|
33
|
+
"author": "dsh-edex",
|
|
34
|
+
"screenshot": "screenshots/ocean.svg",
|
|
35
|
+
"colorScheme": "dark",
|
|
36
|
+
"tokens": {
|
|
37
|
+
"--dsw-alias-bg-base": "#0d1b2a",
|
|
38
|
+
"--dsw-alias-bg-layer-1": "#14283c",
|
|
39
|
+
"--dsw-alias-bg-layer-2": "#1b344c",
|
|
40
|
+
"--dsw-alias-bg-overlay": "#101f30",
|
|
41
|
+
"--dsw-alias-border-l1": "#2a4a68",
|
|
42
|
+
"--dsw-alias-border-l2": "#3a6385",
|
|
43
|
+
"--dsw-alias-brand-primary": "#4ea1ff",
|
|
44
|
+
"--dsw-alias-label-primary": "#e6eef7",
|
|
45
|
+
"--dsw-alias-label-secondary": "#9db8d0",
|
|
46
|
+
"--dsw-specific-sidebar-fill": "#101f30"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Fields
|
|
54
|
+
|
|
55
|
+
| Field | Required | Description |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `id` | yes | Theme id (must be unique across the catalog). Used for `ctx.theme.register()`. |
|
|
58
|
+
| `name` | yes | Display name. |
|
|
59
|
+
| `author` | yes | Author attribution. |
|
|
60
|
+
| `screenshot` | yes | Preview image URL. Absolute URLs or paths relative to the catalog's directory. |
|
|
61
|
+
| `colorScheme` | yes | Base palette: `"light"` or `"dark"`. |
|
|
62
|
+
| `tokens` | yes | Flat map of `--dsw-alias-*` CSS variable overrides. One value per variable (the chosen `colorScheme` decides which base palette is active). |
|
|
63
|
+
|
|
64
|
+
### Adding a theme
|
|
65
|
+
|
|
66
|
+
1. Add an entry to `catalog/themes.json`.
|
|
67
|
+
2. Add a screenshot image to `catalog/screenshots/` (or reference an external URL in `screenshot`).
|
|
68
|
+
3. Push the repo to GitHub — the plugin will pick up the new theme on next load.
|
|
69
|
+
|
|
70
|
+
### Override-able tokens
|
|
71
|
+
|
|
72
|
+
The harness defines the following alias tokens (see `@deepseek-ai/dsh-client-ui-theme`):
|
|
73
|
+
|
|
74
|
+
- `--dsw-alias-bg-base`
|
|
75
|
+
- `--dsw-alias-bg-layer-1`
|
|
76
|
+
- `--dsw-alias-bg-layer-2`
|
|
77
|
+
- `--dsw-alias-bg-overlay`
|
|
78
|
+
- `--dsw-alias-border-l1`
|
|
79
|
+
- `--dsw-alias-border-l2`
|
|
80
|
+
- `--dsw-alias-brand-primary`
|
|
81
|
+
- `--dsw-alias-label-primary`
|
|
82
|
+
- `--dsw-alias-label-secondary`
|
|
83
|
+
- `--dsw-alias-state-error-primary`
|
|
84
|
+
- `--dsw-alias-state-success-primary`
|
|
85
|
+
- `--dsw-alias-state-warn-primary`
|
|
86
|
+
- `--dsw-specific-sidebar-fill`
|
|
87
|
+
|
|
88
|
+
## Standalone package
|
|
89
|
+
|
|
90
|
+
This repository is a **standalone npm package** that follows the harness client plugin conventions (`dsh.client` declaration, `exports["./client"]`, closure-factory bundle). It builds, typechecks, and tests independently.
|
|
91
|
+
|
|
92
|
+
### Quick start
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pnpm install
|
|
96
|
+
pnpm run typecheck
|
|
97
|
+
pnpm run test
|
|
98
|
+
pnpm run build
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Integration into the harness
|
|
102
|
+
|
|
103
|
+
Two ways to compose this plugin into a running DeepSeek Harness GUI:
|
|
104
|
+
|
|
105
|
+
#### A. Drop-in (recommended for development)
|
|
106
|
+
|
|
107
|
+
1. Copy the package into the harness monorepo:
|
|
108
|
+
```bash
|
|
109
|
+
cp -r . /path/to/deepseek-harness/packages/client/ui-theme-store
|
|
110
|
+
```
|
|
111
|
+
2. Add a tsconfig reference — add `{ "path": "packages/client/ui-theme-store" }` to `tsconfig.client.json`'s `references`.
|
|
112
|
+
3. Add a dependency — add `"@danielng23/dsh-client-ui-theme-store": "workspace:^"` to `packages/bundle/web-app/package.json`.
|
|
113
|
+
4. Add a cordis patch row — insert into `packages/bundle/web-app/cordis.patch.yml`:
|
|
114
|
+
```yaml
|
|
115
|
+
- id: ui-theme-store
|
|
116
|
+
name: '@danielng23/dsh-client-ui-theme-store'
|
|
117
|
+
```
|
|
118
|
+
5. Rebuild: `pnpm run build:lib:client && pnpm run build:web`.
|
|
119
|
+
|
|
120
|
+
#### B. External dependency
|
|
121
|
+
|
|
122
|
+
1. Install the package from GitHub or npm:
|
|
123
|
+
```bash
|
|
124
|
+
pnpm add @danielng23/dsh-client-ui-theme-store
|
|
125
|
+
```
|
|
126
|
+
2. Add a row to the cordis patch (see above) and a dependency entry in `web-app/package.json`.
|
|
127
|
+
3. The client bundle (`lib/client.js`) is in the correct closure-factory format — the harness modules node half will serve it at `/plugins/@danielng23/dsh-client-ui-theme-store/client.js`.
|
|
128
|
+
|
|
129
|
+
### Catalog URL
|
|
130
|
+
|
|
131
|
+
The plugin fetches the catalog from a configurable URL. The default is:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
https://raw.githubusercontent.com/dsh-edex/dsh-edex-themes/main/catalog/themes.json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Override at build time by setting the environment variable:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
DSH_CLIENT_THEME_STORE_CATALOG_URL=https://your-raw-url/catalog/themes.json pnpm run build
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Or edit the constant in `src/client/catalog.ts`.
|
|
144
|
+
|
|
145
|
+
## Model Experience
|
|
146
|
+
|
|
147
|
+
None, as the theme store is a browser-side settings surface that reads a JSON catalog and drives the harness theme service — nothing here reaches a model request.
|
|
148
|
+
|
|
149
|
+
#### KV Cache effect
|
|
150
|
+
|
|
151
|
+
None; this package neither assembles nor sends a provider request.
|
|
152
|
+
|
|
153
|
+
## Limitations
|
|
154
|
+
|
|
155
|
+
- **Third-party theme ids are in-process only** — the harness's built-in `ui-theme` settings schema only accepts `light/dark/system`. The theme store persists its own `applied` id in the `ui-theme-store` settings namespace, so the applied theme survives reloads. However, if the user later picks a built-in preference in the Appearance row, the store's persisted id is cleared on next reload (the built-in preference wins).
|
|
156
|
+
- **Remote browsers get no durable settings** — the settings RPCs used for persistence are loopback-only, so a non-loopback browser falls back to process-local selection.
|
|
157
|
+
- **Screenshots must be network-accessible** — the catalog JSON references screenshot URLs; the plugin does not bundle them.
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|