dsh-tidy-display 0.2.0 → 0.2.2
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/lib/client.js +125 -0
- package/lib/client.js.map +1 -1
- package/lib/dsh-tidy-display.js +81 -1
- package/lib/types/client/config-bridge.d.ts +10 -0
- package/lib/types/client/config-bridge.d.ts.map +1 -0
- package/lib/types/client/config-bridge.js +89 -0
- package/lib/types/client/config-bridge.js.map +1 -0
- package/lib/types/client/config-card.d.ts +15 -0
- package/lib/types/client/config-card.d.ts.map +1 -0
- package/lib/types/client/config-card.js +17 -0
- package/lib/types/client/config-card.js.map +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +2 -0
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/settings-slots.d.ts +12 -0
- package/lib/types/client/settings-slots.d.ts.map +1 -1
- package/lib/types/client/settings.d.ts.map +1 -1
- package/lib/types/client/settings.js +2 -0
- package/lib/types/client/settings.js.map +1 -1
- package/lib/types/config.d.ts +7 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +48 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/dsh-tidy-display.d.ts +2 -0
- package/lib/types/dsh-tidy-display.d.ts.map +1 -1
- package/lib/types/dsh-tidy-display.js +1 -0
- package/lib/types/dsh-tidy-display.js.map +1 -1
- package/lib/types/reader-prefs.d.ts +30 -0
- package/lib/types/reader-prefs.d.ts.map +1 -0
- package/lib/types/reader-prefs.js +44 -0
- package/lib/types/reader-prefs.js.map +1 -0
- package/package.json +142 -141
- package/src/client/config-bridge.ts +118 -0
- package/src/client/config-card.tsx +22 -0
- package/src/client/index.tsx +270 -268
- package/src/client/settings-slots.ts +8 -0
- package/src/client/settings.tsx +2 -0
- package/src/config.ts +53 -0
- package/src/dsh-tidy-display.ts +3 -0
- package/src/reader-prefs.ts +67 -0
package/package.json
CHANGED
|
@@ -1,141 +1,142 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-tidy-display",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for the Harness 0.2.0 line.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"publishConfig": {
|
|
8
|
-
"registry": "https://registry.npmjs.org",
|
|
9
|
-
"access": "public",
|
|
10
|
-
"tag": "dsh-0.
|
|
11
|
-
},
|
|
12
|
-
"main": "lib/dsh-tidy-display.js",
|
|
13
|
-
"types": "lib/types/dsh-tidy-display.d.ts",
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./lib/types/dsh-tidy-display.d.ts",
|
|
17
|
-
"default": "./lib/dsh-tidy-display.js"
|
|
18
|
-
},
|
|
19
|
-
"./client": {
|
|
20
|
-
"types": "./lib/types/client/index.d.ts",
|
|
21
|
-
"default": "./lib/client.js"
|
|
22
|
-
},
|
|
23
|
-
"./package.json": "./package.json"
|
|
24
|
-
},
|
|
25
|
-
"dsh": {
|
|
26
|
-
"bundle": {
|
|
27
|
-
"patch": "./cordis.patch.yml"
|
|
28
|
-
},
|
|
29
|
-
"client": {
|
|
30
|
-
"platform": "web",
|
|
31
|
-
"inject": [
|
|
32
|
-
"@deepseek-ai/dsh-api-session-controller",
|
|
33
|
-
"@deepseek-ai/dsh-client-ui-chat",
|
|
34
|
-
"@deepseek-ai/dsh-client-ui-conversation",
|
|
35
|
-
"@deepseek-ai/dsh-client-ui-renderer",
|
|
36
|
-
"@deepseek-ai/dsh-client-ui-session"
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "node scripts/check-harness-compat.mjs && tsc -p tsconfig.json && tsdown",
|
|
42
|
-
"check:harness": "node scripts/check-harness-compat.mjs",
|
|
43
|
-
"test:official": "node scripts/verify-official-bridge.mjs",
|
|
44
|
-
"test:auto-fold": "node scripts/verify-auto-fold.mjs",
|
|
45
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
-
"test": "node --import tsx/esm --test tests/*.test.ts",
|
|
47
|
-
"link:harness": "node scripts/link-harness-dependencies.mjs",
|
|
48
|
-
"lint": "eslint .",
|
|
49
|
-
"check": "npm run typecheck && npm run lint && npm test"
|
|
50
|
-
},
|
|
51
|
-
"peerDependencies": {
|
|
52
|
-
"@deepseek-ai/cordis": "~4.0.4",
|
|
53
|
-
"@deepseek-ai/dsh-api-session-controller": ">=0.2.0-rc.1 <0.2.1-0",
|
|
54
|
-
"@deepseek-ai/dsh-attachment": ">=0.2.0-rc.1 <0.2.1-0",
|
|
55
|
-
"@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1 <0.2.1-0",
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.0-rc.1 <0.2.1-0",
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.1 <0.2.1-0",
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1 <0.2.1-0",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-session": ">=0.2.0-rc.1 <0.2.1-0",
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0",
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-tool": ">=0.2.0-rc.1 <0.2.1-0",
|
|
63
|
-
"@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0",
|
|
64
|
-
"@deepseek-ai/dsh-util-workspace-path": ">=0.2.0-rc.1 <0.2.1-0",
|
|
65
|
-
"react": "^18.2.0"
|
|
66
|
-
},
|
|
67
|
-
"devDependencies": {
|
|
68
|
-
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
69
|
-
"@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
|
|
70
|
-
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
71
|
-
"@deepseek-ai/dsh-session-turn-outline": "0.2.0-rc.2",
|
|
72
|
-
"@eslint/js": "^10.0.1",
|
|
73
|
-
"@types/mdast": "^4.0.4",
|
|
74
|
-
"@types/node": "^22.20.0",
|
|
75
|
-
"@types/react": "~18.3.1",
|
|
76
|
-
"eslint": "^10.11.0",
|
|
77
|
-
"globals": "^17.12.0",
|
|
78
|
-
"lightningcss": "^1.33.0",
|
|
79
|
-
"tsdown": "^0.22.2",
|
|
80
|
-
"tsx": "^4.22.4",
|
|
81
|
-
"typescript": "^6.0.3",
|
|
82
|
-
"typescript-eslint": "^8.70.1"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"mdast-util-
|
|
89
|
-
"mdast-util-
|
|
90
|
-
"
|
|
91
|
-
"micromark-
|
|
92
|
-
"micromark-extension-
|
|
93
|
-
"micromark-
|
|
94
|
-
"micromark-
|
|
95
|
-
"micromark-util-
|
|
96
|
-
"micromark-util-
|
|
97
|
-
"micromark-util-
|
|
98
|
-
"micromark-util-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"cordis.
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"README.
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
"dsh
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-tidy-display",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "One plugin for a calmer DeepSeek Harness: reading view + message rail + smart history loading, for the Harness 0.2.0 line.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org",
|
|
9
|
+
"access": "public",
|
|
10
|
+
"tag": "dsh-0.2.0"
|
|
11
|
+
},
|
|
12
|
+
"main": "lib/dsh-tidy-display.js",
|
|
13
|
+
"types": "lib/types/dsh-tidy-display.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./lib/types/dsh-tidy-display.d.ts",
|
|
17
|
+
"default": "./lib/dsh-tidy-display.js"
|
|
18
|
+
},
|
|
19
|
+
"./client": {
|
|
20
|
+
"types": "./lib/types/client/index.d.ts",
|
|
21
|
+
"default": "./lib/client.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"dsh": {
|
|
26
|
+
"bundle": {
|
|
27
|
+
"patch": "./cordis.patch.yml"
|
|
28
|
+
},
|
|
29
|
+
"client": {
|
|
30
|
+
"platform": "web",
|
|
31
|
+
"inject": [
|
|
32
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
33
|
+
"@deepseek-ai/dsh-client-ui-chat",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-session"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "node scripts/check-harness-compat.mjs && tsc -p tsconfig.json && tsdown",
|
|
42
|
+
"check:harness": "node scripts/check-harness-compat.mjs",
|
|
43
|
+
"test:official": "node scripts/verify-official-bridge.mjs",
|
|
44
|
+
"test:auto-fold": "node scripts/verify-auto-fold.mjs",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
+
"test": "node --import tsx/esm --test tests/*.test.ts",
|
|
47
|
+
"link:harness": "node scripts/link-harness-dependencies.mjs",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"check": "npm run typecheck && npm run lint && npm test"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
53
|
+
"@deepseek-ai/dsh-api-session-controller": ">=0.2.0-rc.1 <0.2.1-0",
|
|
54
|
+
"@deepseek-ai/dsh-attachment": ">=0.2.0-rc.1 <0.2.1-0",
|
|
55
|
+
"@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1 <0.2.1-0",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.0-rc.1 <0.2.1-0",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.1 <0.2.1-0",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.2.1-0",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1 <0.2.1-0",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-session": ">=0.2.0-rc.1 <0.2.1-0",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.2.1-0",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-tool": ">=0.2.0-rc.1 <0.2.1-0",
|
|
63
|
+
"@deepseek-ai/dsh-session": ">=0.2.0-rc.1 <0.2.1-0",
|
|
64
|
+
"@deepseek-ai/dsh-util-workspace-path": ">=0.2.0-rc.1 <0.2.1-0",
|
|
65
|
+
"react": "^18.2.0"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2",
|
|
69
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.0-rc.2",
|
|
70
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
71
|
+
"@deepseek-ai/dsh-session-turn-outline": "0.2.0-rc.2",
|
|
72
|
+
"@eslint/js": "^10.0.1",
|
|
73
|
+
"@types/mdast": "^4.0.4",
|
|
74
|
+
"@types/node": "^22.20.0",
|
|
75
|
+
"@types/react": "~18.3.1",
|
|
76
|
+
"eslint": "^10.11.0",
|
|
77
|
+
"globals": "^17.12.0",
|
|
78
|
+
"lightningcss": "^1.33.0",
|
|
79
|
+
"tsdown": "^0.22.2",
|
|
80
|
+
"tsx": "^4.22.4",
|
|
81
|
+
"typescript": "^6.0.3",
|
|
82
|
+
"typescript-eslint": "^8.70.1",
|
|
83
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"clsx": "^2.0.0",
|
|
87
|
+
"katex": "^0.16.47",
|
|
88
|
+
"mdast-util-from-markdown": "^2.0.3",
|
|
89
|
+
"mdast-util-gfm": "^3.1.0",
|
|
90
|
+
"mdast-util-math": "^3.0.0",
|
|
91
|
+
"micromark-core-commonmark": "^2.0.3",
|
|
92
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
93
|
+
"micromark-extension-math": "^3.1.0",
|
|
94
|
+
"micromark-factory-space": "^2.0.1",
|
|
95
|
+
"micromark-util-character": "^2.1.1",
|
|
96
|
+
"micromark-util-classify-character": "^2.0.1",
|
|
97
|
+
"micromark-util-sanitize-uri": "^2.0.1",
|
|
98
|
+
"micromark-util-symbol": "^2.0.1",
|
|
99
|
+
"micromark-util-types": "^2.0.2"
|
|
100
|
+
},
|
|
101
|
+
"files": [
|
|
102
|
+
"lib",
|
|
103
|
+
"skills",
|
|
104
|
+
"src",
|
|
105
|
+
"tests",
|
|
106
|
+
"scripts",
|
|
107
|
+
"cordis.yml",
|
|
108
|
+
"cordis.patch.yml",
|
|
109
|
+
"dshx.yml",
|
|
110
|
+
"tsconfig.json",
|
|
111
|
+
"tsdown.config.ts",
|
|
112
|
+
"README.md",
|
|
113
|
+
"README.en.md",
|
|
114
|
+
"DESIGN.md",
|
|
115
|
+
"LICENSE",
|
|
116
|
+
"THIRD_PARTY_NOTICES.md",
|
|
117
|
+
"CHANGELOG.md",
|
|
118
|
+
"compat",
|
|
119
|
+
"docs"
|
|
120
|
+
],
|
|
121
|
+
"engines": {
|
|
122
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
123
|
+
},
|
|
124
|
+
"repository": {
|
|
125
|
+
"type": "git",
|
|
126
|
+
"url": "git+https://github.com/drscrewdriver/dsh-tidy-display.git"
|
|
127
|
+
},
|
|
128
|
+
"homepage": "https://github.com/drscrewdriver/dsh-tidy-display#readme",
|
|
129
|
+
"bugs": {
|
|
130
|
+
"url": "https://github.com/drscrewdriver/dsh-tidy-display/issues"
|
|
131
|
+
},
|
|
132
|
+
"keywords": [
|
|
133
|
+
"deepseek-harness",
|
|
134
|
+
"dsh",
|
|
135
|
+
"dsh-plugin",
|
|
136
|
+
"dshx",
|
|
137
|
+
"conversation",
|
|
138
|
+
"reasoning",
|
|
139
|
+
"streaming",
|
|
140
|
+
"accessibility"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { READER_CONFIG_DEFAULTS, READER_CONFIG_FIELDS, type ReaderConfig, type ReaderConfigField } from '../reader-prefs.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Two-way bridge between the entry config (namespace = entry id `tidy-display`,
|
|
6
|
+
* the volatile fields of `src/config.ts`) and the reader root store (persist key
|
|
7
|
+
* `dsh.reader.v1`).
|
|
8
|
+
*
|
|
9
|
+
* Direction 1 (preference edits): every writer — the family-tab card, the
|
|
10
|
+
* Plugins-page card, the reader chrome — acts on the store; the bridge pushes
|
|
11
|
+
* changed fields into the config form. Volatile-only commits never remount.
|
|
12
|
+
*
|
|
13
|
+
* Direction 2 (config edits from elsewhere — profile patch hand-edits, another
|
|
14
|
+
* device): form snapshots apply back into the store.
|
|
15
|
+
*
|
|
16
|
+
* Migration: per field, an absent config value adopts the store's non-default
|
|
17
|
+
* value once, on the first ready snapshot. Idempotent — an override (even one
|
|
18
|
+
* equal to the default) is never touched again.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Minimal structural face of the configForms service (avoid a hard peer). */
|
|
22
|
+
interface ConfigFormsFace {
|
|
23
|
+
get?<T = unknown>(entryId: string): ConfigFormFace<T> | undefined;
|
|
24
|
+
whileServed?(namespaces: readonly string[], register: () => void): () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ConfigFormFace<T = unknown> {
|
|
28
|
+
getSnapshot(): { status: 'loading' | 'ready' | 'unavailable'; value: Partial<T> | undefined; writable: boolean };
|
|
29
|
+
subscribe(listener: () => void): () => void;
|
|
30
|
+
set(field: string, value: unknown): Promise<boolean>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Store-facing slice the bridge needs (baked actions + snapshot source). */
|
|
34
|
+
interface PrefsFace {
|
|
35
|
+
getSnapshot(): Record<string, unknown>;
|
|
36
|
+
subscribe(fn: () => void): () => void;
|
|
37
|
+
actions: Record<string, ((value: never) => void) | undefined>;
|
|
38
|
+
}
|
|
39
|
+
function configFormsOf(ctx: Context): ConfigFormsFace | undefined {
|
|
40
|
+
const forms = (ctx as unknown as { get?: (name: string) => unknown }).get?.('configForms') as ConfigFormsFace | undefined;
|
|
41
|
+
if (forms && typeof forms.get === 'function') return forms;
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function installConfigBridge(ctx: Context, prefs: PrefsFace): void {
|
|
46
|
+
const forms = configFormsOf(ctx);
|
|
47
|
+
if (!forms) return; // legacy host: the persist key stays the only copy
|
|
48
|
+
|
|
49
|
+
const lastKnown = new Map<string, unknown>();
|
|
50
|
+
const disposers: Array<() => void> = [];
|
|
51
|
+
|
|
52
|
+
const push = (field: ReaderConfigField, value: unknown, form: ConfigFormFace): void => {
|
|
53
|
+
lastKnown.set(field, value);
|
|
54
|
+
void form.set(field, value).catch(() => {});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const applyField = (field: ReaderConfigField, value: unknown): void => {
|
|
58
|
+
const set = prefs.actions[`set${field[0]!.toUpperCase()}${field.slice(1)}`];
|
|
59
|
+
set?.(value as never);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const attach = (form: ConfigFormFace): void => {
|
|
63
|
+
// store → config
|
|
64
|
+
disposers.push(prefs.subscribe(() => {
|
|
65
|
+
const snap = form.getSnapshot();
|
|
66
|
+
if (snap.status !== 'ready' || !snap.writable) return;
|
|
67
|
+
const store = prefs.getSnapshot();
|
|
68
|
+
for (const field of READER_CONFIG_FIELDS) {
|
|
69
|
+
const value = store[field];
|
|
70
|
+
if (value === undefined || Object.is(value, lastKnown.get(field))) continue;
|
|
71
|
+
push(field, value, form);
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
const drain = (): void => {
|
|
75
|
+
const snap = form.getSnapshot();
|
|
76
|
+
if (snap.status !== 'ready') return;
|
|
77
|
+
const store = prefs.getSnapshot();
|
|
78
|
+
for (const field of READER_CONFIG_FIELDS) {
|
|
79
|
+
const configValue = (snap.value as Partial<ReaderConfig> | undefined)?.[field];
|
|
80
|
+
if (configValue === undefined) {
|
|
81
|
+
// migration: an absent config field adopts a non-default store value once
|
|
82
|
+
const storeValue = store[field];
|
|
83
|
+
if (snap.writable && storeValue !== undefined && !Object.is(storeValue, READER_CONFIG_DEFAULTS[field]) && !lastKnown.has(field)) {
|
|
84
|
+
push(field, storeValue, form);
|
|
85
|
+
} else if (storeValue !== undefined && !lastKnown.has(field)) {
|
|
86
|
+
// default-valued absent field: pin it so later unrelated store
|
|
87
|
+
// changes don't sweep the default into the config section
|
|
88
|
+
lastKnown.set(field, storeValue);
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (Object.is(configValue, lastKnown.get(field))) continue;
|
|
93
|
+
lastKnown.set(field, configValue);
|
|
94
|
+
if (!Object.is(configValue, store[field])) applyField(field, configValue);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
// config → store
|
|
98
|
+
disposers.push(form.subscribe(drain));
|
|
99
|
+
drain(); // in case the form was already ready before this attach
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const form = forms.get?.<ReaderConfig>('tidy-display');
|
|
103
|
+
if (form) attach(form);
|
|
104
|
+
// attach later when the host starts serving the namespace
|
|
105
|
+
if (typeof forms.whileServed === 'function') {
|
|
106
|
+
disposers.push(forms.whileServed(['tidy-display'], () => {
|
|
107
|
+
if (!form) {
|
|
108
|
+
const again = forms.get?.<ReaderConfig>('tidy-display');
|
|
109
|
+
if (again) attach(again);
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
ctx.effect(() => () => {
|
|
114
|
+
for (const off of disposers) {
|
|
115
|
+
try { off(); } catch { /* already gone */ }
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { BetterDisplaySettingsInjected } from './SettingsSection.js';
|
|
4
|
+
import { SettingsSection } from './SettingsSection.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Plugins-page configuration card (`plugins.bundle.config`, keyed by the
|
|
8
|
+
* package name `dsh-tidy-display`): renders the SAME settings section as the
|
|
9
|
+
* family tab, over the same OpenPrefs face — both surfaces stay one source of
|
|
10
|
+
* truth, and the config-bridge commits edits into the entry's volatile config.
|
|
11
|
+
*
|
|
12
|
+
* The page hands its own `form` prop (keyed by package name), but this entry's
|
|
13
|
+
* namespace is the entry id `tidy-display` ≠ package name, so the page's handle
|
|
14
|
+
* would never resolve; the card renders from prefs instead and the bridge owns
|
|
15
|
+
* the config writes.
|
|
16
|
+
*/
|
|
17
|
+
export function installPluginConfigCard(ctx: Context, injected: () => BetterDisplaySettingsInjected): void {
|
|
18
|
+
ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register(
|
|
19
|
+
{ name: 'plugins.bundle.config', key: 'dsh-tidy-display' },
|
|
20
|
+
() => createElement(SettingsSection, injected()),
|
|
21
|
+
));
|
|
22
|
+
}
|