@danielng23/dsh-client-ui-theme-store 0.1.0 → 0.1.1

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 CHANGED
@@ -1,8 +1,29 @@
1
1
  # @danielng23/dsh-client-ui-theme-store
2
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.
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/edex-themes.json`) — push the repo to GitHub and the plugin fetches the catalog from the raw URL at runtime.
4
4
 
5
- > "No category, just read a json file from this repo(push to github), theme contains name, author, screenshot."
5
+ ![Theme Store screenshot](screenshot.png)
6
+
7
+ ## Installation
8
+
9
+ ### Install from npm
10
+
11
+ ```bash
12
+ pnpm add @danielng23/dsh-client-ui-theme-store
13
+ ```
14
+
15
+ ### Add to the harness
16
+
17
+ After installing the package, add the plugin to your harness instance's `cordis.patch.yml`:
18
+
19
+ ```yaml
20
+ - id: ui-theme-store
21
+ name: '@danielng23/dsh-client-ui-theme-store'
22
+ ```
23
+
24
+ The client bundle is automatically served at `/plugins/@danielng23/dsh-client-ui-theme-store/client.js`.
25
+
26
+ > "No category, just read a json file from this repo (push to github), theme contains name, author, screenshot."
6
27
 
7
28
  ## What it looks like
8
29
 
@@ -22,7 +43,7 @@ Clicking **Apply**:
22
43
 
23
44
  ## Catalog
24
45
 
25
- The catalog is a JSON document at `catalog/themes.json` in this repository. Its structure:
46
+ The catalog is a JSON document at `catalog/edex-themes.json` in this repository. Its structure:
26
47
 
27
48
  ```json
28
49
  {
@@ -63,7 +84,7 @@ The catalog is a JSON document at `catalog/themes.json` in this repository. Its
63
84
 
64
85
  ### Adding a theme
65
86
 
66
- 1. Add an entry to `catalog/themes.json`.
87
+ 1. Add an entry to `catalog/edex-themes.json`.
67
88
  2. Add a screenshot image to `catalog/screenshots/` (or reference an external URL in `screenshot`).
68
89
  3. Push the repo to GitHub — the plugin will pick up the new theme on next load.
69
90
 
@@ -119,7 +140,7 @@ Two ways to compose this plugin into a running DeepSeek Harness GUI:
119
140
 
120
141
  #### B. External dependency
121
142
 
122
- 1. Install the package from GitHub or npm:
143
+ 1. Install the package from npm:
123
144
  ```bash
124
145
  pnpm add @danielng23/dsh-client-ui-theme-store
125
146
  ```
@@ -128,16 +149,18 @@ Two ways to compose this plugin into a running DeepSeek Harness GUI:
128
149
 
129
150
  ### Catalog URL
130
151
 
131
- The plugin fetches the catalog from a configurable URL. The default is:
152
+ The theme store loads its catalog live from this repository on GitHub, so you can add or change themes by pushing to the repo — no plugin release needed. The default catalog URL is:
132
153
 
133
154
  ```
134
- https://raw.githubusercontent.com/dsh-edex/dsh-edex-themes/main/catalog/themes.json
155
+ https://raw.githubusercontent.com/ph4310822/dsh-edex-themes/main/catalog/edex-themes.json
135
156
  ```
136
157
 
137
- Override at build time by setting the environment variable:
158
+ If GitHub is unreachable, the store falls back to the bundled catalog served by the plugin's node half at `/catalog/edex-themes.json`.
159
+
160
+ Override the default at build time by setting the environment variable:
138
161
 
139
162
  ```bash
140
- DSH_CLIENT_THEME_STORE_CATALOG_URL=https://your-raw-url/catalog/themes.json pnpm run build
163
+ DSH_CLIENT_THEME_STORE_CATALOG_URL=https://your-raw-url/catalog/edex-themes.json pnpm run build
141
164
  ```
142
165
 
143
166
  Or edit the constant in `src/client/catalog.ts`.
package/lib/client.js CHANGED
@@ -341,12 +341,18 @@ window.__ModuleLoader__.load({
341
341
  * service (`id`, `colorScheme`, `tokens`).
342
342
  */
343
343
  /**
344
- * Default catalog URL. Served locally by this plugin's node half at the
345
- * webserver route `/catalog/edex-themes.json` (same origin as the GUI), so
346
- * themes load without any GitHub push. Overridable at build time via
347
- * DSH_CLIENT_THEME_STORE_CATALOG_URL.
344
+ * Default catalog URL: the live catalog in this repository, fetched from
345
+ * GitHub raw so themes update by pushing to the repo — no plugin release
346
+ * required. Overridable at build time via DSH_CLIENT_THEME_STORE_CATALOG_URL.
348
347
  */
349
- const DEFAULT_CATALOG_URL = "/catalog/edex-themes.json";
348
+ const DEFAULT_CATALOG_URL = "https://raw.githubusercontent.com/ph4310822/dsh-edex-themes/main/catalog/edex-themes.json";
349
+ /**
350
+ * Bundled fallback: the catalog shipped with the plugin, served by the node
351
+ * half at the same-origin webserver route. Used when the live GitHub fetch
352
+ * fails (offline / GitHub unreachable), so the store still shows the shipped
353
+ * themes rather than an empty error state.
354
+ */
355
+ const LOCAL_CATALOG_URL = "/catalog/edex-themes.json";
350
356
  /** Resolve the effective catalog URL (build-time override, else default). */
351
357
  function catalogUrl() {
352
358
  const override = typeof process !== "undefined" ? process.env.DSH_CLIENT_THEME_STORE_CATALOG_URL : void 0;
@@ -497,8 +503,10 @@ window.__ModuleLoader__.load({
497
503
  }
498
504
  /**
499
505
  * Load the catalog from the configured URL and reconcile the persisted
500
- * applied theme. Safe to call repeatedly (retry); a failed fetch leaves
501
- * the previous ready state intact and reports an error snapshot.
506
+ * applied theme. If the live (GitHub) source is unreachable, falls back to
507
+ * the bundled catalog served by the node half. Safe to call repeatedly
508
+ * (retry); a total failure leaves the previous ready state intact and
509
+ * reports an error snapshot.
502
510
  * @returns completion of the load.
503
511
  */
504
512
  async load() {
@@ -508,7 +516,7 @@ window.__ModuleLoader__.load({
508
516
  error: void 0
509
517
  });
510
518
  try {
511
- const catalog = await fetchCatalog(this.href);
519
+ const catalog = await this.fetchCatalogWithFallback();
512
520
  if (this.disposed) return;
513
521
  this.publish({
514
522
  status: "ready",
@@ -525,6 +533,24 @@ window.__ModuleLoader__.load({
525
533
  }
526
534
  }
527
535
  /**
536
+ * Fetch the catalog, falling back to the bundled local route when the
537
+ * configured (GitHub) source fails. A non-GitHub href is tried as-is; when
538
+ * it and the local fallback both fail, the original error surfaces.
539
+ * @returns the fetched catalog.
540
+ */
541
+ async fetchCatalogWithFallback() {
542
+ try {
543
+ return await fetchCatalog(this.href);
544
+ } catch (primaryError) {
545
+ if (this.href === "/catalog/edex-themes.json") throw primaryError;
546
+ try {
547
+ return await fetchCatalog(LOCAL_CATALOG_URL);
548
+ } catch {
549
+ throw primaryError;
550
+ }
551
+ }
552
+ }
553
+ /**
528
554
  * Apply a catalog theme: register it with the harness theme service if
529
555
  * needed, switch the active preference to it, and persist the id.
530
556
  * @param id - a catalog theme id.
@@ -10,12 +10,18 @@
10
10
  */
11
11
  import type { ThemeDefinition } from '@deepseek-ai/dsh-client-ui-theme/client';
12
12
  /**
13
- * Default catalog URL. Served locally by this plugin's node half at the
14
- * webserver route `/catalog/edex-themes.json` (same origin as the GUI), so
15
- * themes load without any GitHub push. Overridable at build time via
16
- * DSH_CLIENT_THEME_STORE_CATALOG_URL.
13
+ * Default catalog URL: the live catalog in this repository, fetched from
14
+ * GitHub raw so themes update by pushing to the repo — no plugin release
15
+ * required. Overridable at build time via DSH_CLIENT_THEME_STORE_CATALOG_URL.
17
16
  */
18
- export declare const DEFAULT_CATALOG_URL = "/catalog/edex-themes.json";
17
+ export declare const DEFAULT_CATALOG_URL = "https://raw.githubusercontent.com/ph4310822/dsh-edex-themes/main/catalog/edex-themes.json";
18
+ /**
19
+ * Bundled fallback: the catalog shipped with the plugin, served by the node
20
+ * half at the same-origin webserver route. Used when the live GitHub fetch
21
+ * fails (offline / GitHub unreachable), so the store still shows the shipped
22
+ * themes rather than an empty error state.
23
+ */
24
+ export declare const LOCAL_CATALOG_URL = "/catalog/edex-themes.json";
19
25
  /** Resolve the effective catalog URL (build-time override, else default). */
20
26
  export declare function catalogUrl(): string;
21
27
  /**
@@ -61,11 +61,20 @@ export declare class ThemeStoreRuntime {
61
61
  subscribe(listener: () => void): () => void;
62
62
  /**
63
63
  * Load the catalog from the configured URL and reconcile the persisted
64
- * applied theme. Safe to call repeatedly (retry); a failed fetch leaves
65
- * the previous ready state intact and reports an error snapshot.
64
+ * applied theme. If the live (GitHub) source is unreachable, falls back to
65
+ * the bundled catalog served by the node half. Safe to call repeatedly
66
+ * (retry); a total failure leaves the previous ready state intact and
67
+ * reports an error snapshot.
66
68
  * @returns completion of the load.
67
69
  */
68
70
  load(): Promise<void>;
71
+ /**
72
+ * Fetch the catalog, falling back to the bundled local route when the
73
+ * configured (GitHub) source fails. A non-GitHub href is tried as-is; when
74
+ * it and the local fallback both fail, the original error surfaces.
75
+ * @returns the fetched catalog.
76
+ */
77
+ private fetchCatalogWithFallback;
69
78
  /**
70
79
  * Apply a catalog theme: register it with the harness theme service if
71
80
  * needed, switch the active preference to it, and persist the id.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielng23/dsh-client-ui-theme-store",
3
3
  "description": "Theme store plugin for the DeepSeek Harness web GUI: a settings Theme Store page that reads a JSON theme catalog from this repository (GitHub), shows name/author/screenshot cards, and applies selected --dsw-* token themes through the harness theme service",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },