@klarkxy/dsh-font 0.0.0-stage → 0.1.0-rc.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/LICENSE ADDED
@@ -0,0 +1,42 @@
1
+ The Star And Thank Author License (SATA)
2
+ Version 2.1, September 2026
3
+
4
+ Copyright © 2026 Klarkxy(278370456@qq.com)
5
+
6
+ Project Url: https://github.com/klarkxy/dsh-editor
7
+ https://github.com/klarkxy/sata-license
8
+ https://github.com/klarkxy/dsh-plugins
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ And wait, one more thing — an invitation, not a condition: it would be best if
21
+ you star/+1/like the project(s) in the project url section above, and thank the
22
+ author(s) in the Copyright section. You may, and arguably you should — but the
23
+ permissions above hold either way, star or no star.
24
+
25
+ Here are some suggested ways:
26
+
27
+ - Email the authors a thank-you letter, and make friends with him/her/them.
28
+ - Report bugs or issues.
29
+ - Tell friends what a wonderful project this is.
30
+ - And, sure, you can just express thanks in your mind without telling the world.
31
+
32
+ Contributors of this project by forking have the option to add his/her name and
33
+ forked project url at copyright and project url sections, but shall not delete
34
+ or modify anything else in these two sections.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,46 @@
1
- # Temporary Holding Version
1
+ # @klarkxy/dsh-font
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <!-- release-state-note -->
4
+ The [repository registry](../../README.md#plugin-lifecycle) tracks Draft → Testing → Published, moving forward only. Fixes, testing and version updates keep published packages Published; each update still passes release checks. First publication explicitly selects Testing packages and records Published only after npm archive verification. See the [release guide](../../RELEASING.md).
5
+
6
+ Font: customize the **interface font**, **code font**, and **conversation font size** of the DeepSeek Harness Web GUI from one settings panel.
7
+
8
+ [中文文档](docs/README.zh-CN.md)
9
+
10
+ ## What it does
11
+
12
+ The plugin adds a settings panel to its bundle page in the Plugins view:
13
+
14
+ - **Interface font** — the typeface of all interface text. Pick a preset (Microsoft YaHei, PingFang SC, SimSun, KaiTi, Source Han Sans/Serif), pick an actually-installed family via **Load system fonts**, or enter any CSS `font-family` stack. Empty restores the host default.
15
+ - **Code font** — the monospace typeface of code blocks, inline code and terminals. Presets include Cascadia, JetBrains Mono, Fira Code, Consolas, Sarasa Mono and Maple Mono; system fonts and custom stacks are accepted too.
16
+ - **Conversation font size** — 10–22 px, driven through the official `ctx.theme.setFontSize()` entry. It stays in sync with the native stepper in Settings → General and persists through the host settings scope.
17
+
18
+ *Load system fonts* uses the Local Font Access API (`window.queryLocalFonts()`): Chromium-only and gated behind a browser permission prompt. Every click re-enumerates — after the first read the button relabels to *Reload system fonts*, so fonts installed later appear on the next click. Each entry commits the exact family name CSS needs, while the label leads with the name the UI locale recognizes — a converted font shows as `华康少女文字W5(P)(DFPShaoNvW5-GB)` in Chinese and `DFPShaoNvW5-GB(华康少女文字W5(P))` in English. Where the API is unavailable or denied (Firefox, Safari, Electron policy), the panel simply keeps the preset + manual-input flow. No font files are bundled — every choice is rendered with fonts already installed on the machine, falling back through the stack when a family is missing.
19
+
20
+ Changes apply immediately through owned inline overrides on `<html>` for the host's `:root` font tokens (`--dsw-font-family`, `--ds-font-family-code`). Derived Markdown, brand, and terminal fonts follow them. Choosing *Default* or unloading restores prior inline values without removing another owner's later updates.
21
+
22
+ ## Where settings live
23
+
24
+ Font choices keep the existing browser `localStorage` key and format. Each browser and machine has its own installed fonts, so this plugin's font choices remain browser-local. Font preferences live in the browser's `localStorage`, so they must be set again after switching browser, domain or port. The font size needs no local copy: the theme service persists it host-side through `setFontSize(px)`.
25
+
26
+ The host half is intentionally empty: no Host service, no RPC, no model calls.
27
+
28
+ ## Install
29
+
30
+ Install the preview channel (DSH 0.2.0-rc.2 or later):
31
+
32
+ ```bash
33
+ dsh plugin --profile web add @klarkxy/dsh-font@next
34
+ ```
35
+
36
+ Replace `web` with your profile name and restart the profile (or reload the page) after installing. Open **Plugins → Font** to change fonts.
37
+
38
+ ## Development
39
+
40
+ ```bash
41
+ pnpm --filter @klarkxy/dsh-font build # tsdown + client wrapper
42
+ pnpm --filter @klarkxy/dsh-font typecheck
43
+ pnpm --filter @klarkxy/dsh-font test
44
+ ```
45
+
46
+ Preview releases use the npm `next` tag. The stable plugin-site catalog requires a `latest` release.
@@ -0,0 +1,5 @@
1
+ # Enabled when installed. Purely additive; touches no built-in row.
2
+ - insert:
3
+ - id: font
4
+ name: '@klarkxy/dsh-font'
5
+ disabled: false
@@ -0,0 +1,46 @@
1
+ # @klarkxy/dsh-font
2
+
3
+ <!-- release-state-note -->
4
+ 插件生命周期见[仓库状态清单](../../../README.zh-CN.md#插件生命周期):草稿 → 测试中 → 已发布,只向前推进。已发布插件的修复、测试和升版保持已发布;每次更新仍须通过发布检查。首次发布须明确选择测试中的包,并在 npm 归档验证成功后登记。详见[发布规则](../../../RELEASING.zh-CN.md)。
5
+
6
+ 字体:在一个设置面板里自定义 DeepSeek Harness Web GUI 的**界面字体**、**代码字体**和**会话字号**。
7
+
8
+ [English](../README.md)
9
+
10
+ ## 功能
11
+
12
+ 插件在「插件」页自己的 Bundle 详情页里提供设置面板:
13
+
14
+ - **界面字体** —— 整个界面文字的字体。可选预设(微软雅黑、苹方、宋体、楷体、思源黑体/宋体),也可以点「读取系统字体」从本机已装字体里挑,或输入任意 CSS `font-family` 字体栈。留空恢复宿主默认。
15
+ - **代码字体** —— 代码块、行内代码与终端的等宽字体。预设含 Cascadia、JetBrains Mono、Fira Code、Consolas、更纱黑体、Maple Mono,同样支持系统字体与自定义。
16
+ - **会话字号** —— 10–22 px,走官方 `ctx.theme.setFontSize()` 入口,与「设置 → 通用」里的字号步进器实时同步,并由宿主设置域持久化。
17
+
18
+ 「读取系统字体」用的是 Local Font Access API(`window.queryLocalFonts()`):仅 Chromium 系可用,首次会弹浏览器权限授权。每次点击都重新枚举——首次读取后按钮变为「重新读取系统字体」,新装字体再点一次即可刷新。列表项写入的始终是 CSS 精确匹配需要的族名,但显示以界面语言为准——同一款转换字体在中文界面显示 `华康少女文字W5(P)(DFPShaoNvW5-GB)`,在英文界面显示 `DFPShaoNvW5-GB(华康少女文字W5(P))`。在不支持或被拒绝的环境(Firefox、Safari、Electron 权限策略)里,面板退回预设 + 手填,不受影响。包内不带任何字体文件——所有选择都靠本机已装字体渲染,缺字体时按栈回退。
19
+
20
+ 改动立即生效:字体覆盖写入 `<html>` 上的宿主 `:root` 字体 token(`--dsw-font-family`、`--ds-font-family-code`),Markdown、品牌和终端的派生字体随之更新。选择「默认」或卸载插件时,恢复原来的内联值,并保留其他写入者后来的修改。
21
+
22
+ ## 设置存在哪里
23
+
24
+ 字体选择沿用原有浏览器 `localStorage` 键和格式。每个浏览器、每台机器装的字体不同,所以本插件的字体选择仍留在浏览器本地。字体偏好保存在浏览器 localStorage,更换浏览器、域名或端口后需重新设置。字号不需要本地副本:theme 服务通过 `setFontSize(px)` 将它保存在宿主侧。
25
+
26
+ 宿主侧(host half)是刻意留空的:没有 Host service、没有 RPC、不调模型。
27
+
28
+ ## 安装
29
+
30
+ 安装预发布通道(需要 DSH 0.2.0-rc.2 或更高版本):
31
+
32
+ ```bash
33
+ dsh plugin --profile web add @klarkxy/dsh-font@next
34
+ ```
35
+
36
+ 把 `web` 换成你的 profile 名,安装后重启 profile(或刷新页面),然后打开「插件 → 字体」调整。
37
+
38
+ ## 开发
39
+
40
+ ```bash
41
+ pnpm --filter @klarkxy/dsh-font build # tsdown + client wrapper
42
+ pnpm --filter @klarkxy/dsh-font typecheck
43
+ pnpm --filter @klarkxy/dsh-font test
44
+ ```
45
+
46
+ 预发布使用 npm `next` 标签;有 `latest` 版本后再收录到稳定插件目录。
package/icon.svg ADDED
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36" fill="none">
2
+ <defs>
3
+ <linearGradient id="glyph" x1="8" y1="8" x2="28" y2="28" gradientUnits="userSpaceOnUse">
4
+ <stop stop-color="#4D75F5"/>
5
+ <stop offset="1" stop-color="#8EB6FF"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <g transform="translate(3.6 3.6) scale(.8)">
9
+ <path d="M9 8H27V12.5H24.5V11H19.5V26H22V28.5H14V26H16.5V11H11.5V12.5H9V8Z" fill="url(#glyph)"/>
10
+ <path d="M6 30H30" stroke="#39ABA9" stroke-width="2" stroke-linecap="round"/>
11
+ </g>
12
+ </svg>