@klarkxy/dsh-font 0.0.0-stage → 0.1.0-rc.1
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 +42 -0
- package/README.md +42 -2
- package/cordis.patch.yml +5 -0
- package/docs/README.zh-CN.md +43 -0
- package/icon.svg +12 -0
- package/lib/client.inner.cjs +975 -0
- package/lib/client.inner.cjs.map +1 -0
- package/lib/client.js +984 -0
- package/lib/contracts.d.ts +102 -0
- package/lib/contracts.js +263 -0
- package/lib/contracts.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +15 -0
- package/lib/index.js.map +1 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +100 -4
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,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @klarkxy/dsh-font
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Font: customize the **interface font**, **code font**, and **conversation font size** of the DeepSeek Harness Web GUI from one settings panel.
|
|
4
|
+
|
|
5
|
+
[中文文档](docs/README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
The plugin adds a settings panel to its bundle page in the Plugins view:
|
|
10
|
+
|
|
11
|
+
- **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.
|
|
12
|
+
- **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.
|
|
13
|
+
- **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.
|
|
14
|
+
|
|
15
|
+
*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.
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
## Where settings live
|
|
20
|
+
|
|
21
|
+
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. The font size needs no local copy: the theme service persists it host-side through `setFontSize(px)`.
|
|
22
|
+
|
|
23
|
+
The host half is intentionally empty: no Host service, no RPC, no model calls.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Install the preview channel (DSH 0.2.0-rc.2 or later):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin --profile web add @klarkxy/dsh-font@next
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Replace `web` with your profile name and restart the profile (or reload the page) after installing. Open **Plugins → Font** to change fonts.
|
|
34
|
+
|
|
35
|
+
## Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm --filter @klarkxy/dsh-font build # tsdown + client wrapper
|
|
39
|
+
pnpm --filter @klarkxy/dsh-font typecheck
|
|
40
|
+
pnpm --filter @klarkxy/dsh-font test
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Preview releases use the npm `next` tag. The stable plugin-site catalog requires a `latest` release.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @klarkxy/dsh-font
|
|
2
|
+
|
|
3
|
+
字体:在一个设置面板里自定义 DeepSeek Harness Web GUI 的**界面字体**、**代码字体**和**会话字号**。
|
|
4
|
+
|
|
5
|
+
[English](../README.md)
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
插件在「插件」页自己的 Bundle 详情页里提供设置面板:
|
|
10
|
+
|
|
11
|
+
- **界面字体** —— 整个界面文字的字体。可选预设(微软雅黑、苹方、宋体、楷体、思源黑体/宋体),也可以点「读取系统字体」从本机已装字体里挑,或输入任意 CSS `font-family` 字体栈。留空恢复宿主默认。
|
|
12
|
+
- **代码字体** —— 代码块、行内代码与终端的等宽字体。预设含 Cascadia、JetBrains Mono、Fira Code、Consolas、更纱黑体、Maple Mono,同样支持系统字体与自定义。
|
|
13
|
+
- **会话字号** —— 10–22 px,走官方 `ctx.theme.setFontSize()` 入口,与「设置 → 通用」里的字号步进器实时同步,并由宿主设置域持久化。
|
|
14
|
+
|
|
15
|
+
「读取系统字体」用的是 Local Font Access API(`window.queryLocalFonts()`):仅 Chromium 系可用,首次会弹浏览器权限授权。每次点击都重新枚举——首次读取后按钮变为「重新读取系统字体」,新装字体再点一次即可刷新。列表项写入的始终是 CSS 精确匹配需要的族名,但显示以界面语言为准——同一款转换字体在中文界面显示 `华康少女文字W5(P)(DFPShaoNvW5-GB)`,在英文界面显示 `DFPShaoNvW5-GB(华康少女文字W5(P))`。在不支持或被拒绝的环境(Firefox、Safari、Electron 权限策略)里,面板退回预设 + 手填,不受影响。包内不带任何字体文件——所有选择都靠本机已装字体渲染,缺字体时按栈回退。
|
|
16
|
+
|
|
17
|
+
改动立即生效:字体覆盖写入 `<html>` 上的宿主 `:root` 字体 token(`--dsw-font-family`、`--ds-font-family-code`),Markdown、品牌和终端的派生字体随之更新。选择「默认」或卸载插件时,恢复原来的内联值,并保留其他写入者后来的修改。
|
|
18
|
+
|
|
19
|
+
## 设置存在哪里
|
|
20
|
+
|
|
21
|
+
字体选择沿用原有浏览器 `localStorage` 键和格式。每个浏览器、每台机器装的字体不同,所以本插件的字体选择仍留在浏览器本地。字号不需要本地副本:theme 服务通过 `setFontSize(px)` 将它保存在宿主侧。
|
|
22
|
+
|
|
23
|
+
宿主侧(host half)是刻意留空的:没有 Host service、没有 RPC、不调模型。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
安装预发布通道(需要 DSH 0.2.0-rc.2 或更高版本):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
dsh plugin --profile web add @klarkxy/dsh-font@next
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
把 `web` 换成你的 profile 名,安装后重启 profile(或刷新页面),然后打开「插件 → 字体」调整。
|
|
34
|
+
|
|
35
|
+
## 开发
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm --filter @klarkxy/dsh-font build # tsdown + client wrapper
|
|
39
|
+
pnpm --filter @klarkxy/dsh-font typecheck
|
|
40
|
+
pnpm --filter @klarkxy/dsh-font test
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
预发布使用 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>
|