dsh-anthropic-fonts 0.2.0 → 0.3.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/LICENSE CHANGED
@@ -1,29 +1,29 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Isilsolme and contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
22
-
23
- ---
24
-
25
- Font files notice: `fonts/AnthropicSansWebText.ttf`, `fonts/AnthropicSerifWebText.ttf`
26
- and `fonts/AnthropicMonoVariable.ttf` are proprietary typefaces of Anthropic,
27
- extracted from Anthropic's web products. They are included in this repository
28
- for personal use only and are **not** covered by the MIT license above; all
29
- rights remain with Anthropic. The npm package does not ship these files.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Isilsolme and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ Font files notice: `fonts/AnthropicSansWebText.ttf`, `fonts/AnthropicSerifWebText.ttf`
26
+ and `fonts/AnthropicMonoVariable.ttf` are proprietary typefaces of Anthropic,
27
+ extracted from Anthropic's web products. They are included in this repository
28
+ for personal use only and are **not** covered by the MIT license above; all
29
+ rights remain with Anthropic. The npm package does not ship these files.
package/README.en.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-anthropic-fonts
2
2
 
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
3
5
  Apply Anthropic's typefaces to the [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web UI:
4
6
 
5
7
  - **Interface** (sidebar, headings, buttons, settings): `Anthropic Sans Web Text`
@@ -61,7 +63,7 @@ bundle to `dsh.profile.bundles`. Restart the web surface afterwards.
61
63
  // ~/.dsh/profiles/web/package.json
62
64
  {
63
65
  "dependencies": {
64
- "dsh-anthropic-fonts": "^0.2.0"
66
+ "dsh-anthropic-fonts": "^0.3.0"
65
67
  },
66
68
  "dsh": {
67
69
  "profile": {
@@ -94,13 +96,104 @@ dsh plugin --profile web remove dsh-anthropic-fonts
94
96
  (or remove it from `dependencies` and `bundles`, then `pnpm install`).
95
97
  Restart to restore the default fonts.
96
98
 
99
+ ## Interaction with DSH's own font settings
100
+
101
+ DSH 0.2 added **Text font** / **Code font** fields under *Settings → Appearance*.
102
+ The plugin targets the **empty (default)** state of those fields: a value typed
103
+ there is written as an inline custom property on `body`, which outranks the
104
+ plugin's stylesheet, so body and code text fall back to your font (the
105
+ conversation serif is still owned by the plugin). Leave both fields empty to use
106
+ the plugin's typefaces.
107
+
108
+ ## Compatibility & permissions
109
+
110
+ | Field | Declared in | Value |
111
+ |---|---|---|
112
+ | DSH range (enforced by DSH) | `engines.dsh` | `>=0.1.0-rc.7 <0.3.0` |
113
+ | DSH range (docs / market display) | `dsh.compatibility.dsh` | `>=0.1.0-rc.7 <0.3.0` |
114
+ | DSH per release | `dsh.compatibility.dshReleases` | see below |
115
+ | Node.js | `engines.node` | `>=22` |
116
+ | Profile | `dsh.compatibility.profiles`, `dsh.client.platform` | `web` |
117
+
118
+ Since 0.2, DSH runs a compatibility preflight before starting a profile and
119
+ **disables** any plugin row whose `engines.dsh` (or `@deepseek-ai/dsh*` peer
120
+ range) is unmet. Declaring `engines.dsh` makes an out-of-range install fail
121
+ loudly instead of silently doing nothing.
122
+
123
+ `dshReleases` records every DSH release as `compatible`, `incompatible`, or
124
+ `unknown`. **Only releases actually smoke-tested in a disposable profile are
125
+ marked `compatible`**; releases covered by the range but not individually tested
126
+ stay `unknown` — a range is never presented as verified evidence.
127
+
128
+ Smoke-tested releases (disposable profile, `DSH_HOME` pointed at a temp
129
+ directory, never the real profile):
130
+
131
+ | DSH release | install | start | uninstall |
132
+ |---|---|---|---|
133
+ | 0.1.5-alpha.2 | ✅ | ✅ | ✅ |
134
+ | 0.1.5-rc.1 | ✅ | ✅ | ✅ |
135
+ | 0.1.5-rc.2 | ✅ | ✅ | ✅ |
136
+ | 0.2.1-rc.5 | ✅ | ✅ | ✅ |
137
+
138
+ 0.2.1-rc.5 additionally got an in-browser acceptance check: computed styles were
139
+ read from the live page — interface `--dsw-font-family` resolves to Anthropic
140
+ Sans; the Markdown container, h1–h4, p, strong, em and tables resolve to
141
+ Anthropic Serif; inline code and code blocks resolve to Anthropic Mono — while
142
+ sizes, line heights and weights stay identical to the DSH defaults
143
+ (h1 21px/700/30px, body 14px/24px, tables 13px/22px, …).
144
+
145
+ How each release was checked:
146
+
147
+ ```sh
148
+ DSH_HOME=/tmp/dsh-smoke dsh plugin --profile web add /path/to/dsh-anthropic-fonts # install
149
+ DSH_HOME=/tmp/dsh-smoke dsh --profile web --dump-config # entry anthropic-fonts in the composed tree
150
+ DSH_HOME=/tmp/dsh-smoke dsh --profile web --port 39123 --no-open # start, prints the served URL
151
+ DSH_HOME=/tmp/dsh-smoke dsh plugin --profile web remove dsh-anthropic-fonts # uninstall
152
+ ```
153
+
154
+ Covered: dependency installed into the profile, bundle appended to
155
+ `dsh.profile.bundles`, bundle patch inserting entry `anthropic-fonts` (and not
156
+ disabled by the compatibility preflight), the web server binding and serving a
157
+ page whose boot payload registers `dsh-anthropic-fonts/client.js`, and full
158
+ removal of both the dependency and the bundle row. **Not covered**: an
159
+ independent security audit.
160
+
161
+ **Permissions**: the client half injects a single `<style>` element into
162
+ `document.head`; no file, network, command, or credential access. The host half
163
+ (`lib/index.js`) is empty.
164
+
165
+ After a new DSH release: re-run the four steps in a disposable profile, add that
166
+ release to `dsh.compatibility.dshReleases` as `compatible`, bump this plugin's
167
+ SemVer, and push.
168
+
97
169
  ## How it works
98
170
 
99
- Overrides only the **font-family** part of the DSH typography tokens:
100
- `--dsw-font-family` (UI) and the non-code `--dsw-font-markdown-*-font-family`
101
- tokens (conversation body), keeping DSH's official font sizes and line heights;
102
- code font goes through `--ds-font-family-code`. The injected `<style>` is
103
- owned by the client fiber and removed on uninstall.
171
+ Since DSH 0.2 the typography tokens come in two layers:
172
+
173
+ - `--dsh-font-family-{text,code}` is the single source of truth (the *Text font*
174
+ / *Code font* settings write exactly these);
175
+ - the theme derives `--dsw-font-family` / `--ds-font-family-code` from them on
176
+ `body`, and every other typography token references those two.
177
+
178
+ The plugin therefore overrides the `--dsh-*` layer. **Writing only
179
+ `--dsw-font-family` stopped working in 0.2**: the derivation rule on `body`
180
+ overrides the inherited `:root` value, which is why the plugin appeared to fall
181
+ back to the default fonts after the 0.2.1 update. 0.1.x has no `--dsh-*` layer
182
+ and reads `--dsw-font-family` directly, so both sets are written.
183
+
184
+ The serif conversation text comes from the Markdown shorthand tokens. In 0.2.x
185
+ Markdown body and headings use `font: var(--dsw-font-markdown-h1)` style
186
+ shorthands with the family already baked in, so the standalone
187
+ `--dsw-font-markdown-*-font-family` tokens are no longer read by any selector.
188
+ The plugin rebuilds those shorthands from the host's own `-font-style` /
189
+ `-font-weight` / `-font-size` / `-line-height` components, swapping only the
190
+ family: sizes, line heights and weights keep following DSH (including the size
191
+ settings), with DSH defaults as fallbacks so 0.1.x keeps working too.
192
+
193
+ The code font goes through `--dsh-font-family-code` / `--ds-font-family-code`;
194
+ the terminal font (`--dsh-font-family-terminal`) is out of scope.
195
+
196
+ The injected `<style>` is owned by the client fiber and removed on uninstall.
104
197
 
105
198
  ## Structure
106
199
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-anthropic-fonts
2
2
 
3
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
4
+
3
5
  给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Web 界面换上 Anthropic 字体:
4
6
 
5
7
  - **界面**(侧栏、标题、按钮、设置):`Anthropic Sans Web Text`
@@ -54,7 +56,7 @@ dsh plugin --profile web add "github:Isilsolme/dsh-anthropic-fonts"
54
56
  // ~/.dsh/profiles/web/package.json
55
57
  {
56
58
  "dependencies": {
57
- "dsh-anthropic-fonts": "^0.2.0"
59
+ "dsh-anthropic-fonts": "^0.3.0"
58
60
  },
59
61
  "dsh": {
60
62
  "profile": {
@@ -84,9 +86,64 @@ dsh plugin --profile web remove dsh-anthropic-fonts
84
86
 
85
87
  (或从 `dependencies` 和 `bundles` 里移除,再 `pnpm install`)。重启即恢复默认字体。
86
88
 
89
+ ## 与 DSH 自带字体设置的关系
90
+
91
+ DSH 0.2 起「设置 → 外观」里有「正文字体 / 代码字体」。插件针对的是**这两栏留空(默认)**的情况:如果你在那里填了自己的字体,DSH 会把它写成 `body` 上的内联变量,优先级高于插件注入的样式表——正文和代码会回落到你填的字体(对话衬线仍由插件接管)。想用插件的字体,保持这两栏为空即可。
92
+
93
+ ## 兼容性与权限
94
+
95
+ | 项目 | 声明位置 | 值 |
96
+ |---|---|---|
97
+ | DSH 范围(DSH 实际校验) | `engines.dsh` | `>=0.1.0-rc.7 <0.3.0` |
98
+ | DSH 范围(文档 / 市场展示) | `dsh.compatibility.dsh` | `>=0.1.0-rc.7 <0.3.0` |
99
+ | DSH 逐版本 | `dsh.compatibility.dshReleases` | 见下 |
100
+ | Node.js | `engines.node` | `>=22` |
101
+ | Profile | `dsh.compatibility.profiles`、`dsh.client.platform` | `web` |
102
+
103
+ DSH 0.2 起,启动 profile 前会先按 `engines.dsh`(没有则看 `@deepseek-ai/dsh*` 的 peer 依赖)做一次兼容性 preflight,不满足的插件行会被**直接禁用**。这里写 `engines.dsh` 是为了让超出范围时失败得明确,而不是静默不生效。
104
+
105
+ `dshReleases` 对每个 DSH 版本逐项写 `compatible` / `incompatible` / `unknown`。**只有实际跑过一次性 Profile 冒烟验证的版本才写 `compatible`**;范围覆盖但未逐版本验证的一律是 `unknown`,范围声明不会被当作已验证。
106
+
107
+ 已验证版本(一次性 Profile,`DSH_HOME` 指向临时目录,不触碰真实 Profile):
108
+
109
+ | DSH 版本 | 安装 | 启动 | 卸载 |
110
+ |---|---|---|---|
111
+ | 0.1.5-alpha.2 | ✅ | ✅ | ✅ |
112
+ | 0.1.5-rc.1 | ✅ | ✅ | ✅ |
113
+ | 0.1.5-rc.2 | ✅ | ✅ | ✅ |
114
+ | 0.2.1-rc.5 | ✅ | ✅ | ✅ |
115
+
116
+ 0.2.1-rc.5 额外做了浏览器内验收:在真实页面里读取计算样式,界面 `--dsw-font-family` 为 Anthropic Sans,Markdown 容器 / h1–h4 / p / strong / em / 表格为 Anthropic Serif,行内代码与代码块为 Anthropic Mono,且字号、行高、字重与 DSH 默认值逐项一致(h1 21px/700/30px、正文 14px/24px、表格 13px/22px 等)。
117
+
118
+ 验证步骤(每个版本各跑一次):
119
+
120
+ ```sh
121
+ DSH_HOME=/tmp/dsh-smoke dsh plugin --profile web add /path/to/dsh-anthropic-fonts # 安装
122
+ DSH_HOME=/tmp/dsh-smoke dsh --profile web --dump-config # 入口 anthropic-fonts 出现在组合配置里
123
+ DSH_HOME=/tmp/dsh-smoke dsh --profile web --port 39123 --no-open # 启动并输出访问地址
124
+ DSH_HOME=/tmp/dsh-smoke dsh plugin --profile web remove dsh-anthropic-fonts # 卸载
125
+ ```
126
+
127
+ 覆盖到的证据:依赖写入 profile、bundle 追加进 `dsh.profile.bundles`、bundle patch 插入入口 `anthropic-fonts`(且没被兼容性 preflight 禁用)、web 服务正常监听并返回页面(启动载荷里已注册 `dsh-anthropic-fonts/client.js`)、卸载后依赖与 bundle 行都被移除。**未覆盖**:独立安全审计。
128
+
129
+ **权限**:客户端只往 `document.head` 注入一个 `<style>`;不读写文件、不访问网络、不执行命令、不接触凭据。Host 半边(`lib/index.js`)为空。
130
+
131
+ 新的 DSH 版本发布后:在一次性 Profile 里重跑上面四步,把该版本写进 `dsh.compatibility.dshReleases`(`compatible`),并提升本插件 SemVer 后推送。
132
+
87
133
  ## 原理
88
134
 
89
- 只覆盖 DSH 排版 token 的**字体族**部分:`--dsw-font-family`(UI 用)与全部非代码的 `--dsw-font-markdown-*-font-family`(对话正文用),保留 DSH 官方字号与行高;代码字体走 `--ds-font-family-code`。注入的 `<style>` 归属 client fiber,卸载时一并清理。
135
+ DSH 0.2 起排版 token 分成两层:
136
+
137
+ - `--dsh-font-family-{text,code}` 是唯一事实来源(「设置 → 外观」里的正文字体 / 代码字体写的就是它们);
138
+ - theme 在 `body` 上把它们拼进 `--dsw-font-family` / `--ds-font-family-code`,其余所有排版 token 再引用这两个。
139
+
140
+ 所以插件覆盖的是 `--dsh-*` 这一层。**只写 `--dsw-font-family` 在 0.2 起会失效**:`body` 上那条派生声明会盖掉 `:root` 上的继承值——这正是 0.2.1 版本更新后插件「整体回到默认字体」的原因。0.1.x 没有 `--dsh-*` 层、直接读 `--dsw-font-family`,因此两套都写,两条曲线同时可用。
141
+
142
+ 对话的衬线来自 Markdown 简写 token。0.2.x 起 Markdown 正文与标题改用 `font: var(--dsw-font-markdown-h1)` 这类简写,字体族已经烧进简写值里,单独的 `--dsw-font-markdown-*-font-family` 不再被任何选择器读取。插件改用宿主自己的 `-font-style` / `-font-weight` / `-font-size` / `-line-height` 分量重建这些简写,只把字体族换成衬线:字号、行高、字重仍然跟着 DSH(包括设置里的字号调整),分量缺失时回退到 DSH 默认值,0.1.x 也照常工作。
143
+
144
+ 代码字体走 `--dsh-font-family-code` / `--ds-font-family-code`;终端字体(`--dsh-font-family-terminal`)不在插件范围内。
145
+
146
+ 注入的 `<style>` 归属 client fiber,卸载时一并清理。
90
147
 
91
148
  ## 结构
92
149
 
package/cordis.patch.yml CHANGED
@@ -1,4 +1,4 @@
1
- # dsh-anthropic-fonts: Anthropic Sans (UI) / Serif (conversation) for the DSH web surface.
2
- - insert:
3
- - id: anthropic-fonts
4
- name: 'dsh-anthropic-fonts'
1
+ # dsh-anthropic-fonts: Anthropic Sans (UI) / Serif (conversation) for the DSH web surface.
2
+ - insert:
3
+ - id: anthropic-fonts
4
+ name: 'dsh-anthropic-fonts'
package/lib/client.js CHANGED
@@ -4,29 +4,81 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
 
7
- // P3: 只覆盖 -font-family 系列(保留 DSH 官方字号/行高),代码字体走 --ds-font-family-code
8
- var css = "html:root{--dsw-font-family:'Anthropic Sans Web Text','Noto Sans SC','Source Han Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei','Helvetica Neue',Helvetica,Arial,sans-serif;--dsw-font-serif:'Anthropic Serif Web Text',Georgia,'Times New Roman','Noto Serif SC','Source Han Serif SC','Songti SC','SimSun',serif;--ds-font-family-code:'Anthropic Mono Variable','Source Han Sans SC',ui-monospace,'SF Mono','JetBrains Mono','Fira Code',Consolas,'Liberation Mono',Menlo,Courier,monospace}" +
9
- "html body{" +
10
- "--dsw-font-markdown-h1-font-family:var(--dsw-font-serif);" +
11
- "--dsw-font-markdown-h2-font-family:var(--dsw-font-serif);" +
12
- "--dsw-font-markdown-h3-font-family:var(--dsw-font-serif);" +
13
- "--dsw-font-markdown-h4-font-family:var(--dsw-font-serif);" +
14
- "--dsw-font-markdown-base-font-family:var(--dsw-font-serif);" +
15
- "--dsw-font-markdown-base-strong-font-family:var(--dsw-font-serif);" +
16
- "--dsw-font-markdown-base-italic-font-family:var(--dsw-font-serif);" +
17
- "--dsw-font-markdown-base-strong-italic-font-family:var(--dsw-font-serif);" +
18
- "--dsw-font-markdown-table-font-family:var(--dsw-font-serif);" +
19
- "--dsw-font-markdown-table-head-font-family:var(--dsw-font-serif);" +
20
- "--dsw-font-markdown-small-font-family:var(--dsw-font-serif);" +
21
- "--dsw-font-markdown-small-strong-font-family:var(--dsw-font-serif);" +
22
- "--dsw-font-markdown-small-italic-font-family:var(--dsw-font-serif);" +
23
- "--dsw-font-markdown-small-strong-italic-font-family:var(--dsw-font-serif);" +
7
+ // 只覆盖字体族,字号 / 行高 / 字重全部交给 DSH 自己的排版 token。
8
+ var SANS =
9
+ "'Anthropic Sans Web Text','Noto Sans SC','Source Han Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei','Helvetica Neue',Helvetica,Arial,sans-serif";
10
+ var SERIF =
11
+ "'Anthropic Serif Web Text',Georgia,'Times New Roman','Noto Serif SC','Source Han Serif SC','Songti SC','SimSun',serif";
12
+ var MONO =
13
+ "'Anthropic Mono Variable','Source Han Sans SC',ui-monospace,'SF Mono','JetBrains Mono','Fira Code',Consolas,'Liberation Mono',Menlo,Courier,monospace";
14
+
15
+ // DSH >= 0.2 的排版分两层:--dsh-font-family-{text,code} 是唯一事实来源(设置里的
16
+ // 「正文字体 / 代码字体」写的就是它们),theme 再在 body 上把它们拼进 --dsw-font-family /
17
+ // --ds-font-family-code。所以必须覆盖 --dsh-* 这一层:只写 --dsw-font-family 会被 body 上那条
18
+ // 派生声明盖掉(0.1.x 没有 --dsh-* 层,故两套都写,两条曲线同时可用)。
19
+ var ROOT =
20
+ "html:root{" +
21
+ "--dsh-font-family-text:" + SANS + ";" +
22
+ "--dsh-font-family-code:" + MONO + ";" +
23
+ "--dsw-font-family:" + SANS + ";" +
24
+ "--ds-font-family-code:" + MONO + ";" +
25
+ "--dsw-font-serif:" + SERIF +
24
26
  "}";
25
27
 
28
+ // 0.2.x 起 Markdown 正文与标题都走 font 简写 token(font:var(--dsw-font-markdown-h1)),
29
+ // 字体族已经烧进简写里,单独的 --dsw-font-markdown-*-font-family 不再被任何选择器读取。
30
+ // 这里用宿主自己的 style / weight / size / line-height 分量重建简写:字号行高继续跟随 DSH
31
+ // (含设置里的字号调整),只把字体族换成衬线。分量缺失时回退到 DSH 的默认值。
32
+ var DELTA = "var(--dsh-content-font-delta)";
33
+ var DELTA_2 = "var(--dsh-content-font-delta-secondary,0px)";
34
+ var SIZE = "var(--dsh-content-font-size,14px)";
35
+ var SIZE_2 = "var(--dsh-content-font-size-secondary,13px)";
36
+ // [variant, font-style, font-weight, font-size, line-height]
37
+ var VARIANTS = [
38
+ ["h1", "normal", "700", "calc(21px + " + DELTA + ")", "calc(30px + " + DELTA + ")"],
39
+ ["h2", "normal", "700", "calc(19px + " + DELTA + ")", "calc(28px + " + DELTA + ")"],
40
+ ["h3", "normal", "700", "calc(18px + " + DELTA + ")", "calc(26px + " + DELTA + ")"],
41
+ ["h4", "normal", "600", SIZE, "calc(24px + " + DELTA + ")"],
42
+ ["base", "normal", "400", SIZE, "calc(24px + " + DELTA + ")"],
43
+ ["base-strong", "normal", "600", SIZE, "calc(24px + " + DELTA + ")"],
44
+ ["base-italic", "italic", "400", SIZE, "calc(24px + " + DELTA + ")"],
45
+ ["base-strong-italic", "italic", "600", SIZE, "calc(24px + " + DELTA + ")"],
46
+ ["table", "normal", "400", SIZE_2, "calc(22px + " + DELTA_2 + ")"],
47
+ ["table-head", "normal", "500", SIZE_2, "calc(22px + " + DELTA_2 + ")"],
48
+ ["small", "normal", "400", "12px", "20px"],
49
+ ["small-strong", "normal", "600", "12px", "20px"],
50
+ ["small-italic", "italic", "400", "12px", "20px"],
51
+ ["small-strong-italic", "italic", "600", "12px", "20px"]
52
+ ];
53
+
54
+ function part(variant, field, fallback) {
55
+ return "var(--dsw-font-markdown-" + variant + "-" + field + "," + fallback + ")";
56
+ }
57
+
58
+ function markdownTokens() {
59
+ var decls = [];
60
+ for (var i = 0; i < VARIANTS.length; i++) {
61
+ var variant = VARIANTS[i][0];
62
+ // 0.1.x 的选择器读的是这个族 token;0.2.x 已没有选择器读它,保留不影响新版本。
63
+ decls.push("--dsw-font-markdown-" + variant + "-font-family:var(--dsw-font-serif)");
64
+ decls.push(
65
+ "--dsw-font-markdown-" + variant + ":" +
66
+ part(variant, "font-style", VARIANTS[i][1]) + " " +
67
+ part(variant, "font-weight", VARIANTS[i][2]) + " " +
68
+ part(variant, "font-size", VARIANTS[i][3]) + "/" +
69
+ part(variant, "line-height", VARIANTS[i][4]) + " " +
70
+ "var(--dsw-font-serif)"
71
+ );
72
+ }
73
+ return "html body{" + decls.join(";") + "}";
74
+ }
75
+
76
+ var css = ROOT + markdownTokens();
77
+
26
78
  function apply(ctx) {
27
79
  if (typeof document === "undefined") return;
28
80
  var tagId = "dsh-anthropic-fonts/fonts.css";
29
- if (document.querySelector('style[data-plugin-css=' + JSON.stringify(tagId) + ']') !== null) return;
81
+ if (document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") !== null) return;
30
82
  var tag = document.createElement("style");
31
83
  tag.dataset.plugin = "dsh-anthropic-fonts";
32
84
  tag.dataset.pluginCss = tagId;
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- /** Host half is intentionally empty; the font effect is browser-only. */
2
- export const name = 'dsh-anthropic-fonts'
3
- export function apply() {}
1
+ /** Host half is intentionally empty; the font effect is browser-only. */
2
+ export const name = 'dsh-anthropic-fonts'
3
+ export function apply() {}
package/package.json CHANGED
@@ -1,53 +1,79 @@
1
- {
2
- "name": "dsh-anthropic-fonts",
3
- "version": "0.2.0",
4
- "description": "Switch the DSH web interface to Anthropic Sans Web Text and model conversation to Anthropic Serif Web Text.",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/Isilsolme/dsh-anthropic-fonts.git"
9
- },
10
- "homepage": "https://github.com/Isilsolme/dsh-anthropic-fonts#readme",
11
- "bugs": {
12
- "url": "https://github.com/Isilsolme/dsh-anthropic-fonts/issues"
13
- },
14
- "type": "module",
15
- "main": "lib/index.js",
16
- "exports": {
17
- ".": "./lib/index.js",
18
- "./client": "./lib/client.js",
19
- "./package.json": "./package.json"
20
- },
21
- "files": [
22
- "lib",
23
- "cordis.patch.yml",
24
- "README.md",
25
- "README.en.md",
26
- "LICENSE"
27
- ],
28
- "keywords": [
29
- "dsh",
30
- "deepseek-harness",
31
- "dsh-plugin",
32
- "cordis",
33
- "web-ui",
34
- "font",
35
- "anthropic"
36
- ],
37
- "engines": {
38
- "node": ">=22"
39
- },
40
- "dsh": {
41
- "bundle": {
42
- "patch": "./cordis.patch.yml"
43
- },
44
- "client": {
45
- "inject": [],
46
- "platform": "web",
47
- "immediately": true
48
- }
49
- },
50
- "peerDependencies": {
51
- "@deepseek-ai/cordis": "^4.0.1"
52
- }
53
- }
1
+ {
2
+ "name": "dsh-anthropic-fonts",
3
+ "version": "0.3.0",
4
+ "description": "Switch the DSH web interface to Anthropic Sans Web Text and model conversation to Anthropic Serif Web Text.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Isilsolme/dsh-anthropic-fonts.git"
9
+ },
10
+ "homepage": "https://github.com/Isilsolme/dsh-anthropic-fonts#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/Isilsolme/dsh-anthropic-fonts/issues"
13
+ },
14
+ "type": "module",
15
+ "main": "lib/index.js",
16
+ "exports": {
17
+ ".": "./lib/index.js",
18
+ "./client": "./lib/client.js",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "lib",
23
+ "cordis.patch.yml",
24
+ "README.md",
25
+ "README.en.md",
26
+ "LICENSE"
27
+ ],
28
+ "keywords": [
29
+ "dsh",
30
+ "deepseek-harness",
31
+ "dsh-plugin",
32
+ "cordis",
33
+ "web-ui",
34
+ "font",
35
+ "anthropic"
36
+ ],
37
+ "engines": {
38
+ "node": ">=22",
39
+ "dsh": ">=0.1.0-rc.7 <0.3.0"
40
+ },
41
+ "dsh": {
42
+ "bundle": {
43
+ "patch": "./cordis.patch.yml"
44
+ },
45
+ "client": {
46
+ "inject": [],
47
+ "platform": "web",
48
+ "immediately": true
49
+ },
50
+ "compatibility": {
51
+ "dsh": ">=0.1.0-rc.7 <0.3.0",
52
+ "dshReleases": {
53
+ "rc.7": "unknown",
54
+ "rc.8": "unknown",
55
+ "0.1.1-rc.1": "unknown",
56
+ "0.1.1-rc.2": "unknown",
57
+ "0.1.2-alpha.2": "unknown",
58
+ "0.1.2-alpha.3": "unknown",
59
+ "0.1.2-alpha.4": "unknown",
60
+ "0.1.2-alpha.5": "unknown",
61
+ "0.1.2-rc.1": "unknown",
62
+ "0.1.3-alpha.1": "unknown",
63
+ "0.1.3-alpha.2": "unknown",
64
+ "0.1.5-alpha.1": "unknown",
65
+ "0.1.5-alpha.2": "compatible",
66
+ "0.1.5-rc.1": "compatible",
67
+ "0.1.5-rc.2": "compatible",
68
+ "0.2.1-rc.2": "unknown",
69
+ "0.2.1-rc.5": "compatible"
70
+ },
71
+ "profiles": [
72
+ "web"
73
+ ]
74
+ }
75
+ },
76
+ "peerDependencies": {
77
+ "@deepseek-ai/cordis": "^4.0.1"
78
+ }
79
+ }