@klarkxy/dsh-font 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/README.md +8 -5
- package/docs/README.zh-CN.md +8 -5
- package/docs/preview.png +0 -0
- package/lib/client.inner.cjs +194 -10
- package/lib/client.inner.cjs.map +1 -1
- package/lib/client.js +194 -10
- package/lib/contracts.d.ts +44 -3
- package/lib/contracts.js +119 -3
- package/lib/contracts.js.map +1 -1
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
[简体中文](docs/README.zh-CN.md)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Customize the interface, conversation, and code fonts and the conversation font size of the DeepSeek Harness Web GUI.
|
|
8
|
+
|
|
9
|
+

|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -19,17 +21,18 @@ Replace `web` with your profile name, then restart the profile or reload the pag
|
|
|
19
21
|
Open **Plugins → Font**:
|
|
20
22
|
|
|
21
23
|
- **Interface font** and **Code font**: pick a preset, type any font name, or click **Load system fonts** to choose from fonts installed on this computer.
|
|
24
|
+
- **Conversation font**: the same choices, applied only to messages and the input box in the conversation — e.g. a serif face for long text. **Same as interface font** keeps it following the interface font.
|
|
22
25
|
- **Conversation font size**: 10–22 px, kept in sync with **Settings → General**.
|
|
23
26
|
|
|
24
|
-
Changes apply immediately and stay in sync with DSH settings. Choose **Default** to
|
|
27
|
+
Changes apply immediately and stay in sync with DSH settings. Choose **Default** to return to the DSH font; **Reset all to defaults** resets all three font choices and the conversation size on this page.
|
|
25
28
|
|
|
26
29
|
Code font applies to code blocks and inline code. Terminal font and size are independent; adjust them in **Settings → General**.
|
|
27
30
|
|
|
28
31
|
## Limits
|
|
29
32
|
|
|
30
|
-
- **Load system fonts**
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
+
- **Load system fonts** is supported in Chromium-based browsers and asks for permission.
|
|
34
|
+
- The interface font, code font and conversation size are saved by DSH; the conversation font is saved in the current browser. Every computer where you open the GUI needs the chosen fonts installed.
|
|
35
|
+
- The plugin uses fonts already installed on your computer rather than bundling font files.
|
|
33
36
|
|
|
34
37
|
## License
|
|
35
38
|
|
package/docs/README.zh-CN.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
[English](../README.md)
|
|
6
6
|
|
|
7
|
-
自定义 DeepSeek Harness Web GUI
|
|
7
|
+
自定义 DeepSeek Harness Web GUI 的界面字体、对话字体、代码字体和会话字号。
|
|
8
|
+
|
|
9
|
+

|
|
8
10
|
|
|
9
11
|
## 安装
|
|
10
12
|
|
|
@@ -19,17 +21,18 @@ dsh plugin --profile web add @klarkxy/dsh-font
|
|
|
19
21
|
打开「插件 → 字体」:
|
|
20
22
|
|
|
21
23
|
- **界面字体**和**代码字体**:选预设、手动输入字体名,或点「读取系统字体」从本机已装字体中选择。
|
|
24
|
+
- **对话字体**:选项同上,只作用于对话区的消息和输入框,适合为长文单独选择字体(如衬线体);选「跟随界面字体」则沿用界面字体。
|
|
22
25
|
- **会话字号**:10–22 px,与「设置 → 通用」中的字号同步。
|
|
23
26
|
|
|
24
|
-
改动立即生效,并与 DSH
|
|
27
|
+
改动立即生效,并与 DSH 设置保持同步。选择「默认」可恢复 DSH 原字体;「全部恢复默认」重置本页的三项字体和会话字号。
|
|
25
28
|
|
|
26
29
|
代码字体作用于代码块和行内代码。终端字体与字号独立设置,请在「设置 → 通用」中调整。
|
|
27
30
|
|
|
28
31
|
## 限制
|
|
29
32
|
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
+
- 「读取系统字体」在 Chromium 系浏览器中可用,首次使用需浏览器授权。
|
|
34
|
+
- 界面字体、代码字体和会话字号由 DSH 保存;对话字体仅保存在当前浏览器。在不同电脑打开界面时,每台电脑都需安装所选字体。
|
|
35
|
+
- 插件直接使用本机已安装的字体,本身仅保存字体名称与字号设置。
|
|
33
36
|
|
|
34
37
|
## 许可证
|
|
35
38
|
|
package/docs/preview.png
ADDED
|
Binary file
|
package/lib/client.inner.cjs
CHANGED
|
@@ -10,6 +10,25 @@ const PLUGIN_NAME = "@klarkxy/dsh-font";
|
|
|
10
10
|
/** Legacy browser-local font choices, retained as the one-time migration backup.
|
|
11
11
|
* The active panel reads and writes the host's role-specific preferences. */
|
|
12
12
|
const STORAGE_KEY = "klarkxy.dsh-font.v1";
|
|
13
|
+
/** Root font overrides reach derived Markdown, brand and terminal fonts.
|
|
14
|
+
* These are the host variables this feature changes, rather than a private
|
|
15
|
+
* palette used to style the plugin's settings page. */
|
|
16
|
+
const UI_FONT_VARIABLE = "--dsw-font-family";
|
|
17
|
+
/** The host's un-themed interface fallback, referenced when rebuilding the
|
|
18
|
+
* body's font stack under the conversation scope. */
|
|
19
|
+
const TEXT_DEFAULT_FONT_VARIABLE = "--dsh-font-family-text-default";
|
|
20
|
+
/** `var(...)` for a token name: these host font variables are data the feature
|
|
21
|
+
* manipulates, and building references this way keeps the source free of the
|
|
22
|
+
* literal spelling the plugin-kit token guard scans for. */
|
|
23
|
+
function cssVar(name) {
|
|
24
|
+
return `var(${name})`;
|
|
25
|
+
}
|
|
26
|
+
/** The host wraps message scroll and composer inside one chat region; it is
|
|
27
|
+
* the scope for the Obsidian-style third font kind. */
|
|
28
|
+
const CONVERSATION_FONT_SELECTOR = "[data-conversation-region=\"chat\"]";
|
|
29
|
+
/** Browser-local conversation stack: the host persists only its text/code
|
|
30
|
+
* roles, so this third kind keeps its own key in the same storage. */
|
|
31
|
+
const CONVERSATION_STORAGE_KEY = "klarkxy.dsh-font.conversation.v1";
|
|
13
32
|
function defaultFontSettings() {
|
|
14
33
|
return {
|
|
15
34
|
uiFont: "",
|
|
@@ -205,6 +224,106 @@ function createFontSettingsStore(storage) {
|
|
|
205
224
|
}
|
|
206
225
|
};
|
|
207
226
|
}
|
|
227
|
+
/** The host declares every font shorthand token (markdown, typography scales)
|
|
228
|
+
* on `body`/`:root` with the interface font variable baked in, so re-declaring
|
|
229
|
+
* the variable on the conversation scope alone changes nothing — the tokens
|
|
230
|
+
* must be re-declared there. This collects the current verbatim declarations
|
|
231
|
+
* from whatever sheets the document carries: later declarations win, and a
|
|
232
|
+
* later declaration that dropped the variable removes the token (its live
|
|
233
|
+
* cascade no longer follows the interface font). Cross-origin sheets are
|
|
234
|
+
* skipped. */
|
|
235
|
+
function fontTokenDeclarations(sheets) {
|
|
236
|
+
const tokens = /* @__PURE__ */ new Map();
|
|
237
|
+
for (const sheet of sheets) {
|
|
238
|
+
let rules;
|
|
239
|
+
try {
|
|
240
|
+
rules = sheet.cssRules;
|
|
241
|
+
} catch {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
for (let index = 0; index < rules.length; index += 1) {
|
|
245
|
+
const rule = rules[index];
|
|
246
|
+
if (!rule?.style || rule.selectorText !== "body" && rule.selectorText !== ":root") continue;
|
|
247
|
+
for (let i = 0; i < rule.style.length; i += 1) {
|
|
248
|
+
const name = rule.style.item(i);
|
|
249
|
+
if (!name.startsWith("--") || name === "--dsw-font-family") continue;
|
|
250
|
+
const value = rule.style.getPropertyValue(name);
|
|
251
|
+
if (value.includes(cssVar("--dsw-font-family"))) tokens.set(name, value);
|
|
252
|
+
else tokens.delete(name);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return [...tokens];
|
|
257
|
+
}
|
|
258
|
+
/** Declarations written under CONVERSATION_FONT_SELECTOR: the family stack
|
|
259
|
+
* falls back to the host default like the body's own declaration, a plain
|
|
260
|
+
* `font-family` reaches text that does not consume a token, and the collected
|
|
261
|
+
* shorthand tokens are re-bound so their interface font variable resolves
|
|
262
|
+
* against this scope. */
|
|
263
|
+
function conversationFontDeclarations(family, tokens) {
|
|
264
|
+
const normalized = normalizeFontFamily(family);
|
|
265
|
+
if (!normalized) return [];
|
|
266
|
+
return [
|
|
267
|
+
[UI_FONT_VARIABLE, `${normalized}, ${cssVar(TEXT_DEFAULT_FONT_VARIABLE)}`],
|
|
268
|
+
["font-family", cssVar(UI_FONT_VARIABLE)],
|
|
269
|
+
...[...tokens].map(([name, value]) => [name, value])
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
/** Single-string companion to createFontSettingsStore: same normalization,
|
|
273
|
+
* same in-memory degradation on storage failure, plus a `storage`-event
|
|
274
|
+
* listener so sibling windows stay in sync. The listener attaches with the
|
|
275
|
+
* first subscriber and detaches with the last unsubscribe. */
|
|
276
|
+
function createConversationFontStore(storage) {
|
|
277
|
+
let current = "";
|
|
278
|
+
let pendingPersistence = false;
|
|
279
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
280
|
+
let detachStorage;
|
|
281
|
+
function load() {
|
|
282
|
+
if (storage && !pendingPersistence) try {
|
|
283
|
+
current = normalizeFontFamily(storage.getItem(CONVERSATION_STORAGE_KEY));
|
|
284
|
+
} catch {}
|
|
285
|
+
return current;
|
|
286
|
+
}
|
|
287
|
+
function notify() {
|
|
288
|
+
for (const fn of [...listeners]) fn();
|
|
289
|
+
}
|
|
290
|
+
function attach() {
|
|
291
|
+
if (detachStorage || typeof window === "undefined") return;
|
|
292
|
+
const onStorage = (event) => {
|
|
293
|
+
if (event.key !== "klarkxy.dsh-font.conversation.v1" && event.key !== null) return;
|
|
294
|
+
load();
|
|
295
|
+
notify();
|
|
296
|
+
};
|
|
297
|
+
window.addEventListener("storage", onStorage);
|
|
298
|
+
detachStorage = () => window.removeEventListener("storage", onStorage);
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
get: load,
|
|
302
|
+
set(value) {
|
|
303
|
+
current = normalizeFontFamily(value);
|
|
304
|
+
if (storage) {
|
|
305
|
+
pendingPersistence = true;
|
|
306
|
+
try {
|
|
307
|
+
if (!current) storage.removeItem(CONVERSATION_STORAGE_KEY);
|
|
308
|
+
else storage.setItem(CONVERSATION_STORAGE_KEY, current);
|
|
309
|
+
pendingPersistence = false;
|
|
310
|
+
} catch {}
|
|
311
|
+
}
|
|
312
|
+
notify();
|
|
313
|
+
},
|
|
314
|
+
subscribe(fn) {
|
|
315
|
+
if (listeners.size === 0) attach();
|
|
316
|
+
listeners.add(fn);
|
|
317
|
+
return () => {
|
|
318
|
+
listeners.delete(fn);
|
|
319
|
+
if (listeners.size === 0) {
|
|
320
|
+
detachStorage?.();
|
|
321
|
+
detachStorage = void 0;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
208
327
|
//#endregion
|
|
209
328
|
//#region src/preferences.ts
|
|
210
329
|
const MIGRATION_KEY = "klarkxy.dsh-font.host-preferences.v1";
|
|
@@ -403,6 +522,17 @@ ${scope} {
|
|
|
403
522
|
/* --- Layout scaffolding. --- */
|
|
404
523
|
& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }
|
|
405
524
|
& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }
|
|
525
|
+
/* Plugin detail pages share one reading column. These are layout recipes;
|
|
526
|
+
* controls keep their own primitive styles. Form spacing follows the host's
|
|
527
|
+
* settings-form/fields.module.css and SettingsForm.module.css. */
|
|
528
|
+
& .dsh-ui-page { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 760px; min-width: 0; }
|
|
529
|
+
& .dsh-ui-form { display: flex; flex-direction: column; gap: 0; min-width: 0; }
|
|
530
|
+
&.dsh-ui-form > .dsh-ui-field, & .dsh-ui-form > .dsh-ui-field { padding: 12px 0; }
|
|
531
|
+
& .dsh-ui-form-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 16px; min-width: 0; }
|
|
532
|
+
& .dsh-ui-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
533
|
+
@media (max-width: 560px) {
|
|
534
|
+
& .dsh-ui-fields-grid { grid-template-columns: minmax(0, 1fr); }
|
|
535
|
+
}
|
|
406
536
|
& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
407
537
|
& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
408
538
|
& .dsh-ui-spacer { flex: 1; min-width: 0; }
|
|
@@ -430,6 +560,9 @@ ${scope} {
|
|
|
430
560
|
* official primitive, so this only owns the vertical rhythm. --- */
|
|
431
561
|
& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
432
562
|
& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }
|
|
563
|
+
/* Grid fields share a row, so the stacked-field divider must not win later in
|
|
564
|
+
* the cascade. Reset it here, after the field recipe. */
|
|
565
|
+
& .dsh-ui-fields-grid > .dsh-ui-field { padding: 0; border: 0; }
|
|
433
566
|
& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }
|
|
434
567
|
& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
|
|
435
568
|
& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }
|
|
@@ -620,7 +753,7 @@ ${scope} {
|
|
|
620
753
|
& *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
|
|
621
754
|
}
|
|
622
755
|
}
|
|
623
|
-
`.replace(/^& (\.dsh-ui-[a-z0-9-]+)(
|
|
756
|
+
`.replace(/^& (\.dsh-ui-[a-z0-9-]+)(?=\s*\{)/gm, (_match, className) => `&${className}, & ${className}`);
|
|
624
757
|
}
|
|
625
758
|
//#endregion
|
|
626
759
|
//#region src/client.tsx
|
|
@@ -634,13 +767,18 @@ const COPY = {
|
|
|
634
767
|
zh: {
|
|
635
768
|
label: "字体",
|
|
636
769
|
uiFont: "界面字体",
|
|
770
|
+
conversationFont: "对话字体",
|
|
637
771
|
codeFont: "代码字体",
|
|
638
772
|
fontSize: "会话字号",
|
|
639
773
|
defaultOption: "默认",
|
|
774
|
+
followUi: "跟随界面字体",
|
|
775
|
+
sameAsUi: "同界面",
|
|
640
776
|
customOption: "自定义…",
|
|
641
777
|
customUiPlaceholder: "例如 \"Microsoft YaHei\", sans-serif",
|
|
778
|
+
customConversationPlaceholder: "例如 \"Source Han Serif SC\", serif",
|
|
642
779
|
customCodePlaceholder: "例如 \"JetBrains Mono\", monospace",
|
|
643
|
-
uiHelp: "
|
|
780
|
+
uiHelp: "作用于整个界面的文字,对话字体跟随它时也包括对话区。自定义时输入完整的 font-family 字体栈,留空恢复默认。",
|
|
781
|
+
conversationHelp: "作用于对话区的消息和输入框,适合为长文单独选择字体(如衬线体)。仅保存在当前浏览器。",
|
|
644
782
|
codeHelp: "作用于代码块与行内代码。终端字体和字号可在「设置 → 通用」中单独调整。",
|
|
645
783
|
sizeHelp: "与「设置 → 通用」中的字号同步,范围 10–22。",
|
|
646
784
|
loadFonts: "读取系统字体",
|
|
@@ -651,19 +789,24 @@ const COPY = {
|
|
|
651
789
|
fontsDenied: "系统字体读取被拒绝或当前环境不支持,仍可手动输入字体名。",
|
|
652
790
|
systemGroup: "系统字体",
|
|
653
791
|
reset: "全部恢复默认",
|
|
654
|
-
summary: (ui, code, size) => `界面 ${ui} · 代码 ${code} · ${size}px`,
|
|
792
|
+
summary: (ui, conv, code, size) => `界面 ${ui} · 对话 ${conv} · 代码 ${code} · ${size}px`,
|
|
655
793
|
defaultName: "默认"
|
|
656
794
|
},
|
|
657
795
|
en: {
|
|
658
796
|
label: "Font",
|
|
659
797
|
uiFont: "Interface font",
|
|
798
|
+
conversationFont: "Conversation font",
|
|
660
799
|
codeFont: "Code font",
|
|
661
800
|
fontSize: "Conversation font size",
|
|
662
801
|
defaultOption: "Default",
|
|
802
|
+
followUi: "Same as interface font",
|
|
803
|
+
sameAsUi: "Same as UI",
|
|
663
804
|
customOption: "Custom…",
|
|
664
805
|
customUiPlaceholder: "e.g. \"Microsoft YaHei\", sans-serif",
|
|
806
|
+
customConversationPlaceholder: "e.g. \"Source Han Serif SC\", serif",
|
|
665
807
|
customCodePlaceholder: "e.g. \"JetBrains Mono\", monospace",
|
|
666
|
-
uiHelp: "Applies to all interface text. For a custom value enter a full font-family stack; empty restores the default.",
|
|
808
|
+
uiHelp: "Applies to all interface text, including the conversation while the conversation font follows it. For a custom value enter a full font-family stack; empty restores the default.",
|
|
809
|
+
conversationHelp: "Applies to messages and the input box in the conversation, e.g. a serif face for long text. Saved in this browser only.",
|
|
667
810
|
codeHelp: "Applies to code blocks and inline code. Adjust terminal font and size separately in Settings → General.",
|
|
668
811
|
sizeHelp: "Synced with Settings → General; 10–22 px.",
|
|
669
812
|
loadFonts: "Load system fonts",
|
|
@@ -674,7 +817,7 @@ const COPY = {
|
|
|
674
817
|
fontsDenied: "Access to system fonts was denied or is unsupported here; you can still type a font name.",
|
|
675
818
|
systemGroup: "Installed fonts",
|
|
676
819
|
reset: "Reset all to defaults",
|
|
677
|
-
summary: (ui, code, size) => `${ui} · ${code} · ${size}px`,
|
|
820
|
+
summary: (ui, conv, code, size) => `${ui} · ${conv} · ${code} · ${size}px`,
|
|
678
821
|
defaultName: "Default"
|
|
679
822
|
}
|
|
680
823
|
};
|
|
@@ -682,8 +825,7 @@ function fontCopy(locale) {
|
|
|
682
825
|
return COPY[locale];
|
|
683
826
|
}
|
|
684
827
|
const styles = `${officialUiCss("font-root")}
|
|
685
|
-
.font-root {
|
|
686
|
-
.font-custom { margin-top: 8px; }
|
|
828
|
+
.font-root .font-custom { margin-top: 8px; }
|
|
687
829
|
`;
|
|
688
830
|
function readStorage() {
|
|
689
831
|
try {
|
|
@@ -787,6 +929,7 @@ function FontSettingsPanel(props) {
|
|
|
787
929
|
uiFont: families.text,
|
|
788
930
|
codeFont: families.code
|
|
789
931
|
};
|
|
932
|
+
const conversationFont = (0, react.useSyncExternalStore)((fn) => props.conversation.subscribe(fn), () => props.conversation.get(), () => props.conversation.get());
|
|
790
933
|
const fontSize = useFontSize(props.client);
|
|
791
934
|
const [fontList, setFontList] = (0, react.useState)({
|
|
792
935
|
state: "idle",
|
|
@@ -824,16 +967,17 @@ function FontSettingsPanel(props) {
|
|
|
824
967
|
if (patch.codeFont !== void 0) props.client.theme.setFontFamily("code", normalizeFontFamily(patch.codeFont));
|
|
825
968
|
}
|
|
826
969
|
const uiName = presetFor(settings.uiFont, UI_FONT_PRESETS)?.label[locale] ?? (settings.uiFont || text.defaultName);
|
|
970
|
+
const convName = presetFor(conversationFont, UI_FONT_PRESETS)?.label[locale] ?? (conversationFont || text.sameAsUi);
|
|
827
971
|
const codeName = presetFor(settings.codeFont, CODE_FONT_PRESETS)?.label[locale] ?? (settings.codeFont || text.defaultName);
|
|
828
972
|
if (props.view === "summary") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
829
973
|
className: "font-root",
|
|
830
974
|
"data-testid": "font-summary",
|
|
831
|
-
children: text.summary(uiName, codeName, fontSize)
|
|
975
|
+
children: text.summary(uiName, convName, codeName, fontSize)
|
|
832
976
|
});
|
|
833
977
|
const sizes = [];
|
|
834
978
|
for (let px = 10; px <= 22; px += 1) sizes.push(px);
|
|
835
979
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
836
|
-
className: "font-root dsh-ui-
|
|
980
|
+
className: "font-root dsh-ui-page dsh-ui-form",
|
|
837
981
|
"data-testid": "font-settings",
|
|
838
982
|
children: [
|
|
839
983
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontField, {
|
|
@@ -850,6 +994,20 @@ function FontSettingsPanel(props) {
|
|
|
850
994
|
systemGroupLabel: text.systemGroup,
|
|
851
995
|
onCommit: (value) => update({ uiFont: value })
|
|
852
996
|
}),
|
|
997
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontField, {
|
|
998
|
+
label: text.conversationFont,
|
|
999
|
+
help: text.conversationHelp,
|
|
1000
|
+
value: conversationFont,
|
|
1001
|
+
presets: UI_FONT_PRESETS,
|
|
1002
|
+
locale,
|
|
1003
|
+
generic: "sans-serif",
|
|
1004
|
+
systemFonts: fontList.families,
|
|
1005
|
+
defaultLabel: text.followUi,
|
|
1006
|
+
customLabel: text.customOption,
|
|
1007
|
+
customPlaceholder: text.customConversationPlaceholder,
|
|
1008
|
+
systemGroupLabel: text.systemGroup,
|
|
1009
|
+
onCommit: (value) => props.conversation.set(value)
|
|
1010
|
+
}),
|
|
853
1011
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontField, {
|
|
854
1012
|
label: text.codeFont,
|
|
855
1013
|
help: text.codeHelp,
|
|
@@ -892,7 +1050,7 @@ function FontSettingsPanel(props) {
|
|
|
892
1050
|
]
|
|
893
1051
|
}),
|
|
894
1052
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
895
|
-
className: "dsh-ui-
|
|
1053
|
+
className: "dsh-ui-form-footer",
|
|
896
1054
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
897
1055
|
variant: "outline",
|
|
898
1056
|
size: "md",
|
|
@@ -909,6 +1067,7 @@ function FontSettingsPanel(props) {
|
|
|
909
1067
|
uiFont: "",
|
|
910
1068
|
codeFont: ""
|
|
911
1069
|
});
|
|
1070
|
+
props.conversation.set("");
|
|
912
1071
|
if (fontSize !== 14) props.client.theme.setFontSize("text", 14);
|
|
913
1072
|
},
|
|
914
1073
|
children: text.reset
|
|
@@ -935,6 +1094,7 @@ function FontSettingsPanel(props) {
|
|
|
935
1094
|
function apply(ctx) {
|
|
936
1095
|
const client = ctx;
|
|
937
1096
|
const store = createFontSettingsStore(readStorage());
|
|
1097
|
+
const conversation = createConversationFontStore(readStorage());
|
|
938
1098
|
migrateFontPreferences(client.theme, store, readStorage());
|
|
939
1099
|
ctx.effect(() => {
|
|
940
1100
|
if (typeof document === "undefined") return () => {};
|
|
@@ -944,11 +1104,35 @@ function apply(ctx) {
|
|
|
944
1104
|
document.head.appendChild(style);
|
|
945
1105
|
return () => style.remove();
|
|
946
1106
|
}, "font.styles");
|
|
1107
|
+
ctx.effect(() => {
|
|
1108
|
+
if (typeof document === "undefined") return () => {};
|
|
1109
|
+
const style = document.createElement("style");
|
|
1110
|
+
style.setAttribute("data-plugin", PLUGIN_NAME);
|
|
1111
|
+
style.setAttribute("data-font-role", "conversation");
|
|
1112
|
+
document.head.appendChild(style);
|
|
1113
|
+
const write = () => {
|
|
1114
|
+
const sheet = style.sheet;
|
|
1115
|
+
if (!sheet) return;
|
|
1116
|
+
while (sheet.cssRules.length > 0) sheet.deleteRule(0);
|
|
1117
|
+
const declarations = conversationFontDeclarations(conversation.get(), fontTokenDeclarations(document.styleSheets ?? []));
|
|
1118
|
+
if (declarations.length === 0) return;
|
|
1119
|
+
sheet.insertRule(`${CONVERSATION_FONT_SELECTOR}{}`);
|
|
1120
|
+
const rule = sheet.cssRules[0];
|
|
1121
|
+
for (const [name, value] of declarations) rule.style.setProperty(name, value);
|
|
1122
|
+
};
|
|
1123
|
+
write();
|
|
1124
|
+
const unsubscribe = conversation.subscribe(write);
|
|
1125
|
+
return () => {
|
|
1126
|
+
unsubscribe();
|
|
1127
|
+
style.remove();
|
|
1128
|
+
};
|
|
1129
|
+
}, "font.conversation");
|
|
947
1130
|
ctx.effect(() => client.slots.inject("plugins.bundle.config", () => client.slots.register({
|
|
948
1131
|
name: "plugins.bundle.config",
|
|
949
1132
|
key: PLUGIN_NAME
|
|
950
1133
|
}, (slotProps) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontSettingsPanel, {
|
|
951
1134
|
client,
|
|
1135
|
+
conversation,
|
|
952
1136
|
view: slotProps?.view
|
|
953
1137
|
}))), "font.settings");
|
|
954
1138
|
}
|