@huanlin/dsh-plugin-sidebar-brand-text 0.3.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.
@@ -0,0 +1,10 @@
1
+ /** Package invariant companion for dsh-plugin-sidebar-brand-text. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ export declare const name = "sidebar-brand-text-invariant";
4
+ export declare const inject: string[];
5
+ /**
6
+ * Register this package's invariant companion.
7
+ * @param ctx - Cordis context carrying the invariant service.
8
+ * @returns the installed registration's disposer after setup succeeds.
9
+ */
10
+ export declare const apply: (ctx: Context) => Promise<() => void>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Host-side settings bridge for `sidebar-brand-text`.
3
+ *
4
+ * Mirrors the ego-browser / dsh-plugin-interpreters pattern: a `source()`
5
+ * thunk the HTTP gateway reads in-process, plus an `onChange()` subscription.
6
+ * The settings service is reached through `ctx.inject(['settings'], ...)` so a
7
+ * composition without a settings provider still loads (entry-source fallback,
8
+ * no persistence). Multi-fiber dedupe is handled by catching the
9
+ * `"already registered"` rejection.
10
+ *
11
+ * @module @huanlin/dsh-plugin-sidebar-brand-text/settings
12
+ */
13
+ import type { Context } from '@deepseek-ai/cordis';
14
+ import type { BrandTextConfig } from './types.ts';
15
+ /** Settings namespace under which brand-text config persists. */
16
+ export declare const SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
17
+ /** Bridge returned by {@link installBrandTextSettings}. */
18
+ export interface BrandTextSettingsBridge {
19
+ /** Read the current resolved config (entry source or settings layer). */
20
+ source(): BrandTextConfig;
21
+ /** Subscribe to config changes (live re-registration follows every commit). */
22
+ onChange(callback: () => void): () => void;
23
+ }
24
+ /**
25
+ * Install the `sidebar-brand-text` settings namespace and return the bridge.
26
+ *
27
+ * @param ctx - host context.
28
+ * @param entry - raw composition-layer config seed.
29
+ * @returns the settings bridge.
30
+ */
31
+ export declare function installBrandTextSettings(ctx: Context, entry: BrandTextConfig): BrandTextSettingsBridge;
@@ -0,0 +1,21 @@
1
+ /** Shared config surface of the sidebar-brand-text plugin (host + client halves). */
2
+ /**
3
+ * The plugin's user-facing settings, persisted through the settings seam
4
+ * under the `sidebar-brand-text` namespace in `$DSH_HOME/settings.yaml`.
5
+ * The browser half reads these via the `/sbbt/api/get` HTTP route.
6
+ */
7
+ export interface BrandTextConfig {
8
+ /**
9
+ * Brand name text shown in the sidebar's top-left brand row, beside the
10
+ * mark slot. Replaces the shell's "DSH Local Build" fallback.
11
+ */
12
+ name: string;
13
+ /**
14
+ * Revision badge text rendered beside the brand name. Empty string hides
15
+ * the badge entirely. Replaces the shell's 7-character
16
+ * `DSH_CLIENT_COMMIT_HASH` fallback.
17
+ */
18
+ revision: string;
19
+ }
20
+ /** Runtime defaults applied when no config arrives (defensive only). */
21
+ export declare const DEFAULT_BRAND_TEXT_CONFIG: BrandTextConfig;
package/package.json ADDED
@@ -0,0 +1,123 @@
1
+ {
2
+ "name": "@huanlin/dsh-plugin-sidebar-brand-text",
3
+ "version": "0.3.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "keywords": [
8
+ "dsh-plugin"
9
+ ],
10
+ "description": "替换侧边栏左上角的品牌名与构建徽标文案(默认 DSH Local Build + commit hash),经 WebUI 插件配置页卡片实时配置。 | Replace the sidebar's top-left brand name and build-revision badge text (defaults to DSH Local Build + commit hash) via a live settings card in the Plugin Config page.",
11
+ "type": "module",
12
+ "license": "MIT",
13
+ "main": "./lib/index.js",
14
+ "types": "./lib/types/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./lib/types/index.d.ts",
18
+ "import": "./lib/index.js"
19
+ },
20
+ "./invariant": {
21
+ "types": "./lib/types/invariant.d.ts",
22
+ "import": "./lib/invariant.js"
23
+ },
24
+ "./client": {
25
+ "types": "./lib/types/client/index.d.ts",
26
+ "default": "./lib/client.js"
27
+ },
28
+ "./src/*": "./src/*",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "files": [
32
+ "lib/",
33
+ "cordis.patch.yml"
34
+ ],
35
+ "dsh": {
36
+ "bundle": {
37
+ "patch": "./cordis.patch.yml"
38
+ },
39
+ "client": {
40
+ "inject": [
41
+ "@deepseek-ai/dsh-client-runtime",
42
+ "@deepseek-ai/dsh-client-locale",
43
+ "@deepseek-ai/dsh-client-ui-slots",
44
+ "@deepseek-ai/dsh-client-ui-sidebar",
45
+ "@deepseek-ai/dsh-client-ui-settings-plugins"
46
+ ],
47
+ "platform": "web"
48
+ }
49
+ },
50
+ "peerDependencies": {
51
+ "@deepseek-ai/cordis": "^4.0.0-rc.7",
52
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8",
53
+ "@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8",
54
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.0-rc.8",
55
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.1.0-rc.8",
56
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8",
57
+ "@deepseek-ai/dsh-invariants": "0.1.0-rc.8",
58
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
59
+ "@deepseek-ai/schemastery": "^3.18.1",
60
+ "react": "^18.2.0"
61
+ },
62
+ "peerDependenciesMeta": {
63
+ "@deepseek-ai/cordis": {
64
+ "optional": true
65
+ },
66
+ "@deepseek-ai/dsh-client-locale": {
67
+ "optional": true
68
+ },
69
+ "@deepseek-ai/dsh-client-runtime": {
70
+ "optional": true
71
+ },
72
+ "@deepseek-ai/dsh-client-ui-settings-plugins": {
73
+ "optional": true
74
+ },
75
+ "@deepseek-ai/dsh-client-ui-sidebar": {
76
+ "optional": true
77
+ },
78
+ "@deepseek-ai/dsh-client-ui-slots": {
79
+ "optional": true
80
+ },
81
+ "@deepseek-ai/dsh-invariants": {
82
+ "optional": true
83
+ },
84
+ "@deepseek-ai/dsh-settings": {
85
+ "optional": true
86
+ },
87
+ "@deepseek-ai/schemastery": {
88
+ "optional": true
89
+ },
90
+ "react": {
91
+ "optional": true
92
+ }
93
+ },
94
+ "devDependencies": {
95
+ "@deepseek-ai/cordis": "^4.0.0-rc.7",
96
+ "@deepseek-ai/dsh-client-locale": "0.1.0-rc.8",
97
+ "@deepseek-ai/dsh-client-runtime": "0.1.0-rc.8",
98
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.0-rc.8",
99
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.1.0-rc.8",
100
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8",
101
+ "@deepseek-ai/dsh-invariants": "0.1.0-rc.8",
102
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
103
+ "@deepseek-ai/schemastery": "^3.18.1",
104
+ "@types/node": "^22.20.1",
105
+ "@types/react": "~18.3.31",
106
+ "jsdom": "^26.0.0",
107
+ "react": "^18.2.0",
108
+ "react-dom": "^18.2.0",
109
+ "schemastery": "^3.18.0",
110
+ "tsdown": "^0.15.0",
111
+ "typescript": "^5.9.0",
112
+ "vitest": "^3.2.0"
113
+ },
114
+ "engines": {
115
+ "node": ">=22.0.0"
116
+ },
117
+ "scripts": {
118
+ "typecheck": "tsc --noEmit -p tsconfig.json",
119
+ "test": "vitest run",
120
+ "build": "tsdown -c tsdown.config.ts && tsc -p tsconfig.json",
121
+ "bundle:client": "tsdown -c tsdown.config.ts"
122
+ }
123
+ }