@huanlin/dsh-plugin-sidebar-brand-text 0.4.2 → 0.6.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 +130 -128
- package/lib/client.js +1066 -1066
- package/lib/client.js.map +1 -1
- package/lib/index.js +233 -234
- package/lib/types/client/controller.d.ts +66 -66
- package/lib/types/client/index.d.ts +38 -38
- package/lib/types/client/titleWriter.d.ts +29 -29
- package/lib/types/settings.d.ts +31 -31
- package/package.json +23 -28
- package/lib/invariant.js +0 -21
- package/lib/types/invariant.d.ts +0 -10
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sidebar-brand-text — browser half.
|
|
3
|
-
*
|
|
4
|
-
* Two registrations:
|
|
5
|
-
* - `settings.plugin.item` keyed slot (key `sidebar-brand-text`) — a card
|
|
6
|
-
* in the Plugin Config page with two text inputs (name + revision).
|
|
7
|
-
* Reads/writes through the `/sbbt/api` HTTP route via the shared
|
|
8
|
-
* `BrandTextSettingsController`.
|
|
9
|
-
* - `sidebar.brand.name` single slot — renders the configured brand name
|
|
10
|
-
* text and optional revision badge. Reads from the same controller
|
|
11
|
-
* store via `useSnapshot`, so a save in the card is instantly
|
|
12
|
-
* reflected in the sidebar.
|
|
13
|
-
*
|
|
14
|
-
* The mark slot (`sidebar.brand.mark`) is deliberately NOT registered:
|
|
15
|
-
* the fish logo stays in place unless another plugin (e.g.
|
|
16
|
-
* `ui-brand-official`) replaces it.
|
|
17
|
-
*
|
|
18
|
-
* @module @huanlin/dsh-plugin-sidebar-brand-text/client
|
|
19
|
-
*/
|
|
20
|
-
import type { ClientContext } from '@deepseek-ai/
|
|
21
|
-
import { type BrandTextKey } from './locales.ts';
|
|
22
|
-
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
23
|
-
interface LocaleNamespaceMap {
|
|
24
|
-
/** The settings card labels. */
|
|
25
|
-
'dsh-plugin-sidebar-brand-text': BrandTextKey;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** Required services: slots + locale + sessions (sessions drives the title writer). */
|
|
29
|
-
export declare const inject: string[];
|
|
30
|
-
/**
|
|
31
|
-
* Client plugin body: register the brand-name slot occupant, the settings
|
|
32
|
-
* card, the locale dictionary, and the stylesheet.
|
|
33
|
-
*
|
|
34
|
-
* A single `BrandTextSettingsController` is shared between the card and
|
|
35
|
-
* the brand text so a save is instantly reflected in the sidebar.
|
|
36
|
-
* @param ctx - client root context.
|
|
37
|
-
*/
|
|
38
|
-
export declare function apply(ctx: ClientContext): void;
|
|
1
|
+
/**
|
|
2
|
+
* sidebar-brand-text — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Two registrations:
|
|
5
|
+
* - `settings.plugin.item` keyed slot (key `sidebar-brand-text`) — a card
|
|
6
|
+
* in the Plugin Config page with two text inputs (name + revision).
|
|
7
|
+
* Reads/writes through the `/sbbt/api` HTTP route via the shared
|
|
8
|
+
* `BrandTextSettingsController`.
|
|
9
|
+
* - `sidebar.brand.name` single slot — renders the configured brand name
|
|
10
|
+
* text and optional revision badge. Reads from the same controller
|
|
11
|
+
* store via `useSnapshot`, so a save in the card is instantly
|
|
12
|
+
* reflected in the sidebar.
|
|
13
|
+
*
|
|
14
|
+
* The mark slot (`sidebar.brand.mark`) is deliberately NOT registered:
|
|
15
|
+
* the fish logo stays in place unless another plugin (e.g.
|
|
16
|
+
* `ui-brand-official`) replaces it.
|
|
17
|
+
*
|
|
18
|
+
* @module @huanlin/dsh-plugin-sidebar-brand-text/client
|
|
19
|
+
*/
|
|
20
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
21
|
+
import { type BrandTextKey } from './locales.ts';
|
|
22
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
23
|
+
interface LocaleNamespaceMap {
|
|
24
|
+
/** The settings card labels. */
|
|
25
|
+
'dsh-plugin-sidebar-brand-text': BrandTextKey;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Required services: slots + locale + sessions (sessions drives the title writer). */
|
|
29
|
+
export declare const inject: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Client plugin body: register the brand-name slot occupant, the settings
|
|
32
|
+
* card, the locale dictionary, and the stylesheet.
|
|
33
|
+
*
|
|
34
|
+
* A single `BrandTextSettingsController` is shared between the card and
|
|
35
|
+
* the brand text so a save is instantly reflected in the sidebar.
|
|
36
|
+
* @param ctx - client root context.
|
|
37
|
+
*/
|
|
38
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { BrandTextState } from './controller.ts';
|
|
2
|
-
import type { SnapshotStore } from '@deepseek-ai/dsh-client-
|
|
3
|
-
/** Minimal face of `sessions.list` we depend on (ISessions.list slice). */
|
|
4
|
-
interface SessionListSnapshot {
|
|
5
|
-
current: string | undefined;
|
|
6
|
-
byId: Record<string, {
|
|
7
|
-
title?: string;
|
|
8
|
-
} | undefined>;
|
|
9
|
-
}
|
|
10
|
-
/** Minimal face of the `sessions` service we depend on. */
|
|
11
|
-
interface SessionsLike {
|
|
12
|
-
readonly list: {
|
|
13
|
-
getSnapshot(): SessionListSnapshot;
|
|
14
|
-
subscribe(fn: () => void): () => void;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/** Disposer returned by {@link startTitleWriter}. */
|
|
18
|
-
export type TitleWriterDisposer = () => void;
|
|
19
|
-
/**
|
|
20
|
-
* Start overriding `document.title` with the configured brand name.
|
|
21
|
-
*
|
|
22
|
-
* @param sessions - the cordis `sessions` service (read-only face).
|
|
23
|
-
* @param store - the shared `BrandTextSettingsController` store; the title
|
|
24
|
-
* updates when the config changes (card save) as well as when the current
|
|
25
|
-
* session changes.
|
|
26
|
-
* @returns a disposer that tears down all subscriptions and the observer.
|
|
27
|
-
*/
|
|
28
|
-
export declare function startTitleWriter(sessions: SessionsLike | undefined, store: SnapshotStore<BrandTextState>): TitleWriterDisposer;
|
|
29
|
-
export {};
|
|
1
|
+
import type { BrandTextState } from './controller.ts';
|
|
2
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
/** Minimal face of `sessions.list` we depend on (ISessions.list slice). */
|
|
4
|
+
interface SessionListSnapshot {
|
|
5
|
+
current: string | undefined;
|
|
6
|
+
byId: Record<string, {
|
|
7
|
+
title?: string;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
}
|
|
10
|
+
/** Minimal face of the `sessions` service we depend on. */
|
|
11
|
+
interface SessionsLike {
|
|
12
|
+
readonly list: {
|
|
13
|
+
getSnapshot(): SessionListSnapshot;
|
|
14
|
+
subscribe(fn: () => void): () => void;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Disposer returned by {@link startTitleWriter}. */
|
|
18
|
+
export type TitleWriterDisposer = () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Start overriding `document.title` with the configured brand name.
|
|
21
|
+
*
|
|
22
|
+
* @param sessions - the cordis `sessions` service (read-only face).
|
|
23
|
+
* @param store - the shared `BrandTextSettingsController` store; the title
|
|
24
|
+
* updates when the config changes (card save) as well as when the current
|
|
25
|
+
* session changes.
|
|
26
|
+
* @returns a disposer that tears down all subscriptions and the observer.
|
|
27
|
+
*/
|
|
28
|
+
export declare function startTitleWriter(sessions: SessionsLike | undefined, store: SnapshotStore<BrandTextState>): TitleWriterDisposer;
|
|
29
|
+
export {};
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -1,31 +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:
|
|
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;
|
|
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: "sidebar-brand-text";
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huanlin/dsh-plugin-sidebar-brand-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -17,10 +17,6 @@
|
|
|
17
17
|
"types": "./lib/types/index.d.ts",
|
|
18
18
|
"import": "./lib/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./invariant": {
|
|
21
|
-
"types": "./lib/types/invariant.d.ts",
|
|
22
|
-
"import": "./lib/invariant.js"
|
|
23
|
-
},
|
|
24
20
|
"./client": {
|
|
25
21
|
"types": "./lib/types/client/index.d.ts",
|
|
26
22
|
"default": "./lib/client.js"
|
|
@@ -38,24 +34,27 @@
|
|
|
38
34
|
},
|
|
39
35
|
"client": {
|
|
40
36
|
"inject": [
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
37
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
42
38
|
"@deepseek-ai/dsh-client-locale",
|
|
43
|
-
"@deepseek-ai/dsh-client-
|
|
39
|
+
"@deepseek-ai/dsh-client-store",
|
|
40
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
41
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins",
|
|
44
42
|
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-slots"
|
|
46
44
|
],
|
|
47
45
|
"platform": "web"
|
|
48
46
|
}
|
|
49
47
|
},
|
|
50
48
|
"peerDependencies": {
|
|
51
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-client-
|
|
54
|
-
"@deepseek-ai/dsh-client-
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
49
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
50
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.5-rc.1",
|
|
51
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
|
|
52
|
+
"@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.5-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.5-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
|
|
59
58
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
60
59
|
"react": "^18.2.0"
|
|
61
60
|
},
|
|
@@ -63,10 +62,16 @@
|
|
|
63
62
|
"@deepseek-ai/cordis": {
|
|
64
63
|
"optional": true
|
|
65
64
|
},
|
|
65
|
+
"@deepseek-ai/dsh-api-session-controller": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
66
68
|
"@deepseek-ai/dsh-client-locale": {
|
|
67
69
|
"optional": true
|
|
68
70
|
},
|
|
69
|
-
"@deepseek-ai/dsh-client-
|
|
71
|
+
"@deepseek-ai/dsh-client-store": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
70
75
|
"optional": true
|
|
71
76
|
},
|
|
72
77
|
"@deepseek-ai/dsh-client-ui-settings-plugins": {
|
|
@@ -78,9 +83,6 @@
|
|
|
78
83
|
"@deepseek-ai/dsh-client-ui-slots": {
|
|
79
84
|
"optional": true
|
|
80
85
|
},
|
|
81
|
-
"@deepseek-ai/dsh-invariants": {
|
|
82
|
-
"optional": true
|
|
83
|
-
},
|
|
84
86
|
"@deepseek-ai/dsh-settings": {
|
|
85
87
|
"optional": true
|
|
86
88
|
},
|
|
@@ -92,14 +94,7 @@
|
|
|
92
94
|
}
|
|
93
95
|
},
|
|
94
96
|
"devDependencies": {
|
|
95
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
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",
|
|
97
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
103
98
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
104
99
|
"@types/node": "^22.20.1",
|
|
105
100
|
"@types/react": "~18.3.31",
|
package/lib/invariant.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/invariant.ts
|
|
2
|
-
const PACKAGE_NAME = "@huanlin/dsh-plugin-sidebar-brand-text";
|
|
3
|
-
const name = "sidebar-brand-text-invariant";
|
|
4
|
-
const inject = ["invariants"];
|
|
5
|
-
/**
|
|
6
|
-
* No runtime invariant: the single `sidebar.brand.name` slot registration
|
|
7
|
-
* is a registry-owned contribution whose disposal is proven by the
|
|
8
|
-
* declaration-aware `slots.inject()` rollback. The plugin retains no
|
|
9
|
-
* mutable state beyond the config snapshot closed over by the inject
|
|
10
|
-
* factory.
|
|
11
|
-
*/
|
|
12
|
-
const install = () => {};
|
|
13
|
-
/**
|
|
14
|
-
* Register this package's invariant companion.
|
|
15
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
16
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
17
|
-
*/
|
|
18
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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>;
|