@huanlin/dsh-plugin-sidebar-brand-text 0.6.1 → 0.7.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 +3 -3
- package/lib/client.js +993 -1066
- package/lib/client.js.map +1 -1
- package/lib/index.js +199 -233
- package/lib/types/client/BrandTextCard.d.ts +6 -7
- package/lib/types/client/controller.d.ts +60 -66
- package/lib/types/client/index.d.ts +39 -38
- package/lib/types/client/titleWriter.d.ts +34 -29
- package/lib/types/config.d.ts +12 -2
- package/lib/types/index.d.ts +3 -3
- package/lib/types/settings.d.ts +37 -31
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +16 -15
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* sidebar-brand-text — browser half.
|
|
3
|
-
*
|
|
4
|
-
* Two registrations:
|
|
5
|
-
* - `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
/**
|
|
2
|
+
* sidebar-brand-text — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Two registrations:
|
|
5
|
+
* - `plugins.row.config` keyed slot (key
|
|
6
|
+
* `@huanlin/dsh-plugin-sidebar-brand-text#sidebar-brand-text`) — the
|
|
7
|
+
* plugin's configuration page on the Plugins page, with two text inputs
|
|
8
|
+
* (name + revision). Reads/writes through the `/sbbt/api` HTTP route via
|
|
9
|
+
* the shared `BrandTextSettingsController`.
|
|
10
|
+
* - `sidebar.brand.name` single slot — renders the configured brand name
|
|
11
|
+
* text and optional revision badge. Reads from the same controller
|
|
12
|
+
* store via `useSnapshot`, so a save in the card is instantly
|
|
13
|
+
* reflected in the sidebar.
|
|
14
|
+
*
|
|
15
|
+
* The mark slot (`sidebar.brand.mark`) is deliberately NOT registered:
|
|
16
|
+
* the fish logo stays in place unless another plugin (e.g.
|
|
17
|
+
* `ui-brand-official`) replaces it.
|
|
18
|
+
*
|
|
19
|
+
* @module @huanlin/dsh-plugin-sidebar-brand-text/client
|
|
20
|
+
*/
|
|
21
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
22
|
+
import { type BrandTextKey } from './locales.ts';
|
|
23
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
24
|
+
interface LocaleNamespaceMap {
|
|
25
|
+
/** The settings card labels. */
|
|
26
|
+
'dsh-plugin-sidebar-brand-text': BrandTextKey;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Required services: slots + locale + sessions (sessions drives the title writer). */
|
|
30
|
+
export declare const inject: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Client plugin body: register the brand-name slot occupant, the settings
|
|
33
|
+
* card, the locale dictionary, and the stylesheet.
|
|
34
|
+
*
|
|
35
|
+
* A single `BrandTextSettingsController` is shared between the card and
|
|
36
|
+
* the brand text so a save is instantly reflected in the sidebar.
|
|
37
|
+
* @param ctx - client root context.
|
|
38
|
+
*/
|
|
39
|
+
export declare function apply(ctx: ClientContext): void;
|
|
@@ -1,29 +1,34 @@
|
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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.
|
|
4
|
+
*
|
|
5
|
+
* rc.1's `ISessions.list` snapshot (`SessionListState`) carries `byId` only:
|
|
6
|
+
* the selected-session id moved out of the sessions domain. `current` is kept
|
|
7
|
+
* optional so the writer still accepts the rc.1 snapshot; when it is absent the
|
|
8
|
+
* title falls back to the brand name alone. */
|
|
9
|
+
interface SessionListSnapshot {
|
|
10
|
+
current?: string | undefined;
|
|
11
|
+
byId: Record<string, {
|
|
12
|
+
title?: string;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
}
|
|
15
|
+
/** Minimal face of the `sessions` service we depend on. */
|
|
16
|
+
interface SessionsLike {
|
|
17
|
+
readonly list: {
|
|
18
|
+
getSnapshot(): SessionListSnapshot;
|
|
19
|
+
subscribe(fn: () => void): () => void;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Disposer returned by {@link startTitleWriter}. */
|
|
23
|
+
export type TitleWriterDisposer = () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Start overriding `document.title` with the configured brand name.
|
|
26
|
+
*
|
|
27
|
+
* @param sessions - the cordis `sessions` service (read-only face).
|
|
28
|
+
* @param store - the shared `BrandTextSettingsController` store; the title
|
|
29
|
+
* updates when the config changes (card save) as well as when the current
|
|
30
|
+
* session changes.
|
|
31
|
+
* @returns a disposer that tears down all subscriptions and the observer.
|
|
32
|
+
*/
|
|
33
|
+
export declare function startTitleWriter(sessions: SessionsLike | undefined, store: SnapshotStore<BrandTextState>): TitleWriterDisposer;
|
|
34
|
+
export {};
|
package/lib/types/config.d.ts
CHANGED
|
@@ -9,9 +9,19 @@
|
|
|
9
9
|
* @module @huanlin/dsh-plugin-sidebar-brand-text/config
|
|
10
10
|
*/
|
|
11
11
|
import z from '@deepseek-ai/schemastery';
|
|
12
|
+
import type { Volatile } from '@deepseek-ai/cordis';
|
|
12
13
|
import type { BrandTextConfig } from './types.ts';
|
|
13
|
-
/**
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Volatile Cordis config the loader passes to {@link apply}: each editable
|
|
16
|
+
* field is a stable reference whose `.get()` returns the latest accepted
|
|
17
|
+
* value. `Settings` enumerates these fields for the profile-owned form.
|
|
18
|
+
*/
|
|
19
|
+
export interface BrandTextEntryConfig {
|
|
20
|
+
name: Volatile<string>;
|
|
21
|
+
revision: Volatile<string>;
|
|
22
|
+
}
|
|
23
|
+
/** Schemastery schema for the composition entry (live-editable via `.volatile()`). */
|
|
24
|
+
export declare const Config: z<BrandTextEntryConfig>;
|
|
15
25
|
/**
|
|
16
26
|
* Resolve a raw config object into a complete {@link BrandTextConfig}.
|
|
17
27
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { Context } from '@deepseek-ai/cordis';
|
|
18
18
|
import { Config } from './config.ts';
|
|
19
|
-
import type {
|
|
19
|
+
import type { BrandTextEntryConfig } from './config.ts';
|
|
20
20
|
export declare const name = "sidebar-brand-text";
|
|
21
21
|
/** `webServer` is required for the HTTP gateway that backs the settings card. */
|
|
22
22
|
export declare const inject: string[];
|
|
@@ -27,6 +27,6 @@ export { Config };
|
|
|
27
27
|
* Plugin body: install the settings bridge and register the HTTP gateway.
|
|
28
28
|
*
|
|
29
29
|
* @param ctx - host context carrying `webServer`.
|
|
30
|
-
* @param config -
|
|
30
|
+
* @param config - the entry's volatile Cordis config.
|
|
31
31
|
*/
|
|
32
|
-
export declare function apply(ctx: Context, config:
|
|
32
|
+
export declare function apply(ctx: Context, config: BrandTextEntryConfig): void;
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Host-side settings bridge for `sidebar-brand-text`.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Host-side settings bridge for `sidebar-brand-text`.
|
|
3
|
+
*
|
|
4
|
+
* dsh 0.1.7-rc.1 moved plugin configuration into the profile-owned Cordis
|
|
5
|
+
* `Config`: the fields are marked `.volatile()` (see `config.ts`), so the
|
|
6
|
+
* loader commits live references without remounting. The namespace-registration API
|
|
7
|
+
* is gone; a plugin only declares the presentation policy for its own page.
|
|
8
|
+
*
|
|
9
|
+
* This bridge exposes a `source()` thunk the `/sbbt/api` gateway reads
|
|
10
|
+
* in-process. Each call reads the current volatile reference, so the gateway
|
|
11
|
+
* always serves the latest accepted value. The value persists in the active
|
|
12
|
+
* profile's `cordis.patch.yml` under the entry's `config` (the entry id is the
|
|
13
|
+
* composition row id declared in `cordis.patch.yml`).
|
|
14
|
+
*
|
|
15
|
+
* @module @huanlin/dsh-plugin-sidebar-brand-text/settings
|
|
16
|
+
*/
|
|
17
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
18
|
+
import type { BrandTextEntryConfig } from './config.ts';
|
|
19
|
+
import type { BrandTextConfig } from './types.ts';
|
|
20
|
+
/** The composition row id: the settings namespace / profile entry id. */
|
|
21
|
+
export declare const SETTINGS_NAMESPACE: "sidebar-brand-text";
|
|
22
|
+
/** Bridge returned by {@link installBrandTextSettings}. */
|
|
23
|
+
export interface BrandTextSettingsBridge {
|
|
24
|
+
/** Read the current resolved config from the entry's volatile references. */
|
|
25
|
+
source(): BrandTextConfig;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Declare the plugin's settings presentation policy and return the bridge.
|
|
29
|
+
*
|
|
30
|
+
* `auto: false` suppresses a schema-generated page: this plugin ships its own
|
|
31
|
+
* form through the `plugins.row.config` slot on the Plugins page.
|
|
32
|
+
*
|
|
33
|
+
* @param ctx - host context.
|
|
34
|
+
* @param config - the entry's volatile Cordis config.
|
|
35
|
+
* @returns the settings bridge.
|
|
36
|
+
*/
|
|
37
|
+
export declare function installBrandTextSettings(ctx: Context, config: BrandTextEntryConfig): BrandTextSettingsBridge;
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
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.7.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
"types": "./lib/types/client/index.d.ts",
|
|
22
22
|
"default": "./lib/client.js"
|
|
23
23
|
},
|
|
24
|
+
"./locale/*.json": "./locale/*.json",
|
|
24
25
|
"./src/*": "./src/*",
|
|
25
26
|
"./package.json": "./package.json"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"lib/",
|
|
30
|
+
"locale/",
|
|
29
31
|
"cordis.patch.yml"
|
|
30
32
|
],
|
|
31
33
|
"dsh": {
|
|
@@ -37,8 +39,8 @@
|
|
|
37
39
|
"@deepseek-ai/dsh-api-session-controller",
|
|
38
40
|
"@deepseek-ai/dsh-client-locale",
|
|
39
41
|
"@deepseek-ai/dsh-client-store",
|
|
42
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager",
|
|
40
43
|
"@deepseek-ai/dsh-client-ui-renderer",
|
|
41
|
-
"@deepseek-ai/dsh-client-ui-settings-plugins",
|
|
42
44
|
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
43
45
|
"@deepseek-ai/dsh-client-ui-slots"
|
|
44
46
|
],
|
|
@@ -47,15 +49,15 @@
|
|
|
47
49
|
},
|
|
48
50
|
"peerDependencies": {
|
|
49
51
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
50
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.1.
|
|
51
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
52
|
-
"@deepseek-ai/dsh-client-store": "^0.1.
|
|
53
|
-
"@deepseek-ai/dsh-client-ui-
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
57
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
58
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
52
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.7-rc.1",
|
|
53
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.7-rc.1",
|
|
54
|
+
"@deepseek-ai/dsh-client-store": "^0.1.7-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.1.7-rc.1",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.1",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.7-rc.1",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.1",
|
|
59
|
+
"@deepseek-ai/dsh-settings": "^0.1.7-rc.1",
|
|
60
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
59
61
|
"react": "^18.2.0"
|
|
60
62
|
},
|
|
61
63
|
"peerDependenciesMeta": {
|
|
@@ -71,10 +73,10 @@
|
|
|
71
73
|
"@deepseek-ai/dsh-client-store": {
|
|
72
74
|
"optional": true
|
|
73
75
|
},
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": {
|
|
75
77
|
"optional": true
|
|
76
78
|
},
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
78
80
|
"optional": true
|
|
79
81
|
},
|
|
80
82
|
"@deepseek-ai/dsh-client-ui-sidebar": {
|
|
@@ -95,13 +97,12 @@
|
|
|
95
97
|
},
|
|
96
98
|
"devDependencies": {
|
|
97
99
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
98
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
100
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
99
101
|
"@types/node": "^22.20.1",
|
|
100
102
|
"@types/react": "~18.3.31",
|
|
101
103
|
"jsdom": "^26.0.0",
|
|
102
104
|
"react": "^18.2.0",
|
|
103
105
|
"react-dom": "^18.2.0",
|
|
104
|
-
"schemastery": "^3.18.0",
|
|
105
106
|
"tsdown": "^0.15.0",
|
|
106
107
|
"typescript": "^5.9.0",
|
|
107
108
|
"vitest": "^3.2.0"
|