dsh-claude-style 0.3.0 → 0.3.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/CHANGELOG.md +22 -2
- package/LICENSE +9 -0
- package/README.en.md +3 -2
- package/README.md +3 -14
- package/docs/STYLE.md +10 -4
- package/docs/architecture.md +74 -0
- package/fonts/GoogleSansFlexPicker.woff2 +0 -0
- package/fonts/OFL-GoogleSansFlex.txt +93 -0
- package/lib/client.js +429 -79
- package/lib/index.js +6 -4
- package/lib/model-descriptions.json +2 -2
- package/package.json +7 -2
- package/docs/REFACTOR.md +0 -294
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.3.1] - 2026-09-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **声明最低运行时与商店截图清单**:`package.json` 的 `dsh` 对象新增 `engines.dsh: ">=0.1.5-rc.2"`(README 标注的实测版本),dsh-market.com 的插件卡片、插件管理器的更新检查与 awesome-dsh-plugin 商店的 host-aware 过滤都会读取它,避免在不满足条件的宿主上被安装或被误判不兼容;仓库根新增 `screenshots.json` 指向 `docs/light.png` 与 `docs/dark.png`,供 dsh-market 等商店以 App Store 式截图展示——截图随仓库推送更新、商店夜间构建自动拾取,之后换图不必再提任何 PR。
|
|
9
|
+
- **模型选择器里 Gemini 行的名称改用 Google Sans Flex**:模型行自 0.2.7 起带厂商标识,但名称仍与其他行同一字体——「这是 Google 的模型」这个信号只给了一半,同一行里标识说厂商、字体说本主题。现在 Gemini 行的名称用上游 Google Sans Flex 的标准字重正体绘制,与标识构成同一个信号。字体由 `scripts/slim-google-sans.py`(手工工具,不进构建——它需要 Python 与 fontTools,而本仓库的 Node 构建必须保持零依赖)从 4.2 MB 的六轴可变字体得到:6 个轴全部钉在**字体自身的默认值**(wght 400 / slnt 0 / wdth 100 / GRAD 0 / ROND 0 / opsz 18,默认值读自 `fvar` 而非写死,上游改默认值时这里不会静默改变「标准」的含义),只保留拉丁字母、数字与标签用得到的标点(ASCII 可打印、不换行空格、间隔号、长/短破折号、弯引号、省略号),并且只保留 `kern` 特性——标签里不该发生连字替换。产物 9 KB,随 npm 包分发,采用 SIL OFL 1.1(`fonts/OFL-GoogleSansFlex.txt` 带上游版权声明与许可证全文)。家族名改为 `Google Sans Flex Picker`:上游没有声明 Reserved Font Name,子集沿用原名并不违规,但一个只含拉丁字符的同名字体会在页面上盖掉用户系统里安装的完整版。样式表的挂载点是行上的 `data-brand`(厂商标识 id):今天只有 Gemini 解析到字体,其他厂商的行保持界面字体,将来给别的厂商加字体是加一行 CSS 的事;字体栈把界面字体留在后面,子集覆盖不到的字符逐个回落而不是变豆腐块。
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **亮暗切换时输入框一带「先色后样」已修复**:皮肤为 hover/focus 调的 0.12s 边框/阴影过渡(composer 卡、输入域、附件轨、hero 托盘)在主题翻转时被重放——画布随 CSS 变量一帧重绘,输入框的边框与 halo 却慢半拍缓入,亮暗切换的瞬间输入区一带肉眼可见分两步换。现在翻转瞬间在 `<html>`/`<body>` 上挂一个只存活约 0.3s 的抑制属性(`html[data-dsh-theme-transitioning] body[data-dsh-claude-style][data-dsh-theme-transitioning] * { transition: none !important }`),并在同一微任务里强制刷一次样式后取消所有进行中的绘制类过渡(`getAnimations()` 里 `transitionProperty` 属于边框/阴影/颜色/背景的 `cancel()`)——属性当帧跳到终值,盖住抑制规则特异性够不着的几条高优先级规则(输入域 (0,6,1)、附件轨 (0,7,1))。窗口结束即恢复,日常 hover/focus 的 0.12s 手感不受影响;只取消主题会改的绘制属性,transform/opacity 过渡(悬停、菜单反馈)照常运行。
|
|
13
|
+
- **composer 形态判断从 CSS 结构感知的 `:has()` 改为 JS 写属性,降低流式输出期间的样式重算开销**:皮肤原先用约 60 处 `[class*="composerStack"]` 上的 hero/inline 分支(`[class*="composerStack"]:has([class*="heroWorkspaceRow"])` 及其 `:not()` 形式)在 CSS 里判断输入卡处于主屏 hero 形态还是会话内联形态。流式输出时每秒几十次 DOM 变更,每次都要重算这些昂贵的选择器,是渲染压力的主要来源。现在 `syncSegments()` 在每轮 pass 里把同一个 `data-composer-variant="hero|inline"` 属性镜像写到卡片所属的 `composerStack` 祖先上(写前比对旧值避免同值重复写触发无谓的样式失效,同轮去重避免多卡命中同一栈反复写),CSS 改为直接读属性:hero 分支读 `[class*="composerStack"][data-composer-variant="hero"]`,inline 分支读 `[class*="composerStack"]:not([data-composer-variant="hero"])`。属性缺席时按 inline 渲染——inline 是流式高频路径,首帧不闪;hero 屏无流式,属性在首个 pass 补上即可。交互驱动与低频的 `:has()`(`:hover`、`:focus-within`、弹窗、placeholder)按原样保留。
|
|
14
|
+
- **设置页 Claude Style 导航 Tab 图标替换为 Claude 标识**:设置弹窗内「Claude Style」Tab 默认由宿主回退为通用的齿轮图标(`IconSettingsOutline16`)。现通过 CSS 蒙版与调度器轻量属性标记,将其替换为黑色的 Claude 经典星芒图标(亮色模式下为纯正墨黑,暗色模式下随文字主色白亮),与左侧导航栏其他选项的视觉语汇保持一致。
|
|
15
|
+
- **亮色模式背景层级色调调优**:为解决浅色界面在纯白控件反衬下局部偏黄的问题,将亮色模式的背景层级收敛至更清爽中性的象牙白阶梯:一级层级(`--dsw-alias-bg-layer-1`)对齐主画布采用 `#FCFCFB`,二级层级(`--dsw-alias-bg-layer-2`)调整为 `#FBFBF9`,三级层级(`--dsw-alias-bg-layer-3`)调整为 `#F9F9F6`;设置弹窗面板亦对齐主画布底色(`#FCFCFB`),保持整体视觉明净统一。
|
|
16
|
+
- **去 AI 化与精简**:清理 `.debug/` 临时调试日志与历史规划文档;移除 `src/overrides/` 拆分残留的旧章节编号与重复注释;精简 README 冗余功能表格并修正更新日志中对内部开发路径的提及。
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- **新对话页只贴图不打字时 hint 发黑、位置跑到输入框外**:宿主只在「草稿为空**且**没有附件」时才渲染自己的 placeholder(`draft === "" && attachments.length === 0`),所以在新对话页贴一张图、不打字,它会把自己的 hint 摘掉,改由皮肤的兜底节点接手——可那个节点身上没有任何宿主类名,而皮肤原有的 hint 规则只覆盖对话里的单行输入框(`data-composer-variant="inline"`),于是它退回成普通块级元素:用卡片正文的墨色(看着发黑),并且排在输入框**下面**而不是里面。现在给 hero 变体的兜底节点补上宿主那套定位与墨色(`position: absolute` + 宿主自己的 `inset: 4px 8px auto 14px`,caption 灰、单行省略),hint 回到输入框首行。验证时把宿主 composer 的样式表与构建产物里的皮肤样式表拼成 mock,逐项对照兜底节点与宿主自带 placeholder 的计算样式(8 项检查,含「修复前不成立」的反证)。
|
|
20
|
+
- **inline 输入框聚焦时的底纹把输入框刷成了另一种颜色**:会话内单行输入框聚焦时,画布色的三层底纹(`box-shadow`)原本挂在 rail 上,而 rail 是 `z-index: 4`、输入框本体是 `z-index: 2`——底纹于是刷在输入框**上面**:盖住输入框自己的背景(两个盒子读起来不同色),也盖住草稿第一行。现在底纹移到卡片(`[data-composer-card]`)身上,与 hero 卡片同一位置,所有子元素共用一个底纹,谁也压不住谁;rail 那份去掉,亮暗两态的 rail 规则只保留描边色。
|
|
21
|
+
- **封号彩蛋语言选不动**:设置里选「中文」立刻弹回英文,且没有任何提示。根因是宿主半边(`lib/index.js`)只在 app 启动时被 import 一次,而它是后来才认识 `banLocale` 这个字段的——旧宿主半边的写入口不认这个键,把它丢掉之后按「没有可写字段」当成一次读取返回,客户端拿到原值就把刚做的选择覆盖回去了(浏览器半边每次刷新都是新的,宿主半边不是,两边版本就此错位)。现在 `banLocale` 与用户名走同一套浏览器本地兜底:宿主不认这个键时把选择存在本地(`localStorage`)并立刻按它渲染,页面刷新后仍在;等宿主半边重启、第一次读取时自动把待写入的值补写一次,宿主回显确认后本地兜底才清除——所以选择既不会丢,也不会和宿主长期打架。
|
|
22
|
+
|
|
3
23
|
## [0.3.0] - 2026-09-20
|
|
4
24
|
|
|
5
25
|
### Added
|
|
@@ -8,7 +28,7 @@
|
|
|
8
28
|
|
|
9
29
|
### Changed
|
|
10
30
|
- **封号页的锁改为手绘描摹**:那页顶部的锁此前是 `rect` + `circle` 拼出来的标准图标,跟参考草图的手绘气质不搭。现在整把锁按参考图(89×92px)的墨迹中心线逐锚点描摹成三条三次贝塞尔路径——方框的每条「直」边都带一点自己的倾斜与漂移(顶边右低、底边微垂、左边下行时外移、右边绕过锁孔处外鼓再收回),四角用一小段斜线收口,锁梁里外两拱不同心、两条腿停在方框顶边上而不穿过它,锁孔的头部比正圆扁、腰身偏右、底座比头更宽。手绘感来自锚点本身,不是滤镜也不是随机抖动,所以缩放到任何尺寸都成立;锚点数值整体映射到图标集统一的 24 单位格(墨迹 15.3×20 单位居中),图标框 58px → 75px(墨迹 47.5px → 62.8px,约 +32%),描边 0.5 单位。选这两个数是量出来的:参考页里「锁的墨迹高 ÷ 标题墨迹高」是 3.08,改完是 2.70(此前 2.05);参考页的「线宽 ÷ 锁高」是 0.025,改完实测 0.0250(此前 0.075,粗了近三倍)。
|
|
11
|
-
- **修掉 `banSvg` 的重复属性**:图标助手此前把 `stroke-width` 追加在 `<svg>` 已有的一条之后,形成重复属性——HTML 解析器只认第一条,于是覆盖静默失效,锁实际按图标集的 1.6 画(在 58px 框里近 3.9px),这正是它看起来「线条太粗」的原因。现在粗细是 `banSvg(body, strokeWidth)`
|
|
31
|
+
- **修掉 `banSvg` 的重复属性**:图标助手此前把 `stroke-width` 追加在 `<svg>` 已有的一条之后,形成重复属性——HTML 解析器只认第一条,于是覆盖静默失效,锁实际按图标集的 1.6 画(在 58px 框里近 3.9px),这正是它看起来「线条太粗」的原因。现在粗细是 `banSvg(body, strokeWidth)` 的形参,只发一条属性,杜绝属性覆盖失效。
|
|
12
32
|
- **点击展开的账户弹层不再被鼠标移出关掉**:此前点账户按钮展开弹层后,指针一离开按钮(弹层挂在按钮下方,指针必须离开)就被 `mouseleave` 关掉,等于点开即关、弹层里的条目够不着;现在点击展开的弹层改为由「点击别处」或「移出整个底栏」关闭,悬停展开仍按原来的延迟关闭逻辑。
|
|
13
33
|
- **账户弹层:账号名下的横线移出 hover 区**:弹层顶部原来是「整块(含横线)在 hover 时整体铺底」,指针扫过横线也会亮;现在横线是账号行的兄弟节点、归弹层所有(左右通栏到弹层内边距边缘),hover 底板只覆盖账号名那一行。
|
|
14
34
|
- **封号页排版**:内容列由靠左改为水平居中;页头(左上角品牌标 + 右上角 Sign out 与窗口控制)整体下移 30px。
|
|
@@ -17,7 +37,7 @@
|
|
|
17
37
|
### Fixed
|
|
18
38
|
- **回退引用块的链接材质**:0.2.7 把 Markdown 引用块(`blockquote`)改成了链接材质(蓝字 + 蓝色下划线 + 蓝色底纹/竖条),但引用是**容器**而不是链接,这套样式会连同块内的行内代码、文件引用一起染蓝,等于让链接材质泄露进引用块。现回退为原来的中性灰:文字 `#B0AEA5`(亮色 `#6E6A60`)、灰底 + 灰竖条,块内的链接、行内代码片、文件引用各自保持自己的材质,互不串色。`padding` 也不再需要 `!important` 钉死。
|
|
19
39
|
- **文件引用(行内文件名)颜色与超链接不一致**:聊天里的 `` `CHANGELOG.md` `` 这类**文件引用**是宿主把行内代码里的文件路径解析成按钮(`.fileMention`)后的产物,但皮肤的通配行内代码规则(`code:not(pre code)`,特异性 (0,2,1))压过宿主自己的链接色类((0,1,0)),于是同一段话里文件引用是代码片的暖红、真正的超链接是链接蓝。现在文件引用的文字改用链接色(亮 `#184F95` / 暗 `#8AB4F8`)、字重 500,下划线沿用超链接那一套(静止态实线、链接色调 60%、1.5px、offset 2px;hover/focus 同样实线、换成不透明的链接色,**线宽与线位不变**),**代码片本身完全不动**——底纹、描边、圆角、内边距与普通行内代码逐项相同,只有文字颜色不同。hover 规则只改颜色:先前用 `text-decoration` 简写会把 `text-decoration-thickness` 重置为 `auto`,导致 hover 时下划线反而变细。普通行内代码仍是暖红代码片;宿主类名带哈希,故按仓库纪律取最长稳定片段 `[class*="_fileMention"]`。
|
|
20
|
-
- **修复 Markdown 表格左侧空隙**:删除旧的全局 `table { width:100% }`、`table th` 背景与 `td/th { padding: 0.6em 0.85em !important }` 规则,避免覆盖宿主 `th:first-child { padding-left: 0 }` 和 `width: max-content`,表格过宽时不再出现左侧空白与外部边框错位。 同时对全部 `.tableScroll` 包装器强制 table margin/padding/border-spacing 归零,首/末单元格恢复 16px 内边距,并把表头背景与行线覆盖到 `thead th/td` 和每行首末单元格(th 或 td),使首列的留白看起来是表格内部区域而不是空隙。
|
|
40
|
+
- **修复 Markdown 表格左侧空隙**:删除旧的全局 `table { width:100% }`、`table th` 背景与 `td/th { padding: 0.6em 0.85em !important }` 规则,避免覆盖宿主 `th:first-child { padding-left: 0 }` 和 `width: max-content`,表格过宽时不再出现左侧空白与外部边框错位。 同时对全部 `.tableScroll` 包装器强制 table margin/padding/border-spacing 归零,首/末单元格恢复 16px 内边距,并把表头背景与行线覆盖到 `thead th/td` 和每行首末单元格(th 或 td),使首列的留白看起来是表格内部区域而不是空隙。 另外,窄表不再被宿主 `.tableFill` 拉满:`.tableScroll` 宽度限制到正文内容块 `--dsh-chat-content-width` 并居中,表格用 `min-width: 100%` 撑满内容块;宽表保持 `max-content` 并保留横向滚动。
|
|
21
41
|
|
|
22
42
|
## [0.2.7] - 2026-09-20
|
|
23
43
|
|
package/LICENSE
CHANGED
|
@@ -39,3 +39,12 @@ owners.
|
|
|
39
39
|
are JetBrains Mono, distributed under the SIL Open Font License
|
|
40
40
|
(`fonts/OFL.txt`). They may be redistributed with this plugin.
|
|
41
41
|
|
|
42
|
+
- `fonts/GoogleSansFlexPicker.woff2` is a Latin-only subset of Google Sans Flex
|
|
43
|
+
(standard weight, upright), built by `scripts/slim-google-sans.py` and renamed
|
|
44
|
+
to `Google Sans Flex Picker`. Google Sans Flex is distributed under the SIL
|
|
45
|
+
Open Font License (`fonts/OFL-GoogleSansFlex.txt`, Copyright 2022 The Google
|
|
46
|
+
Sans Flex Project Authors); upstream declares no Reserved Font Name, and this
|
|
47
|
+
subset is renamed so it cannot shadow a full system-installed copy. It ships
|
|
48
|
+
with the npm package and may be redistributed with this plugin, under no other
|
|
49
|
+
licence.
|
|
50
|
+
|
package/README.en.md
CHANGED
|
@@ -25,17 +25,18 @@
|
|
|
25
25
|
|
|
26
26
|
## Fonts
|
|
27
27
|
|
|
28
|
-
> **Important: the JetBrains Mono code font
|
|
28
|
+
> **Important: the JetBrains Mono code font, plus the Google Sans Flex Picker face used only by Gemini rows in the model picker, ship with the plugin and are served to the browser as webfonts by the plugin host — no installation needed. The Anthropic Sans/Serif fonts are NOT shipped with the npm package**; they remain in the repository [`fonts/`](fonts/) for download. You can either install them on the system, or skip installation entirely: drop the two `.ttf` files into the plugin package's `fonts/` directory and the host serves them as webfonts the same way (identical files, identical result). Either way, refresh / restart web afterwards.
|
|
29
29
|
|
|
30
30
|
| Font | Used for | File |
|
|
31
31
|
|---|---|---|
|
|
32
32
|
| Anthropic Sans Web Text | UI chrome | [`fonts/AnthropicSansWebText.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/AnthropicSansWebText.ttf) |
|
|
33
33
|
| Anthropic Serif Web Text | Conversation body / markdown | [`fonts/AnthropicSerifWebText.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/AnthropicSerifWebText.ttf) |
|
|
34
34
|
| JetBrains Mono Variable | Code / code blocks | [`fonts/JetBrainsMonoVariable.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/JetBrainsMonoVariable.ttf), [`fonts/JetBrainsMonoItalicVariable.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/JetBrainsMonoItalicVariable.ttf) |
|
|
35
|
+
| Google Sans Flex Picker | Model picker · Gemini row name | Shipped with the package: [`fonts/GoogleSansFlexPicker.woff2`](fonts/GoogleSansFlexPicker.woff2) |
|
|
35
36
|
|
|
36
37
|
Enabling the Anthropic faces (pick one): ① install on the system — double-click the `.ttf` on Windows → *Install*, or import via *Font Book* on macOS; ② no-install — copy the `.ttf` files into the plugin package's `fonts/` directory (next to `JetBrainsMonoVariable.ttf`). Refresh the page afterwards.
|
|
37
38
|
|
|
38
|
-
> JetBrains Mono is distributed under the [SIL Open Font License](fonts/OFL.txt). The Anthropic Sans/Serif typefaces are Anthropic's property, provided for personal use only and not covered by the MIT license above. See [LICENSE](LICENSE) for the font notice.
|
|
39
|
+
> JetBrains Mono is distributed under the [SIL Open Font License](fonts/OFL.txt). Google Sans Flex Picker is a renamed Latin-only subset of Google Sans Flex, distributed under the same [SIL Open Font License](fonts/OFL-GoogleSansFlex.txt). The Anthropic Sans/Serif typefaces are Anthropic's property, provided for personal use only and not covered by the MIT license above. See [LICENSE](LICENSE) for the font notice.
|
|
39
40
|
|
|
40
41
|
## Install
|
|
41
42
|
|
package/README.md
CHANGED
|
@@ -26,17 +26,18 @@
|
|
|
26
26
|
|
|
27
27
|
## 字体
|
|
28
28
|
|
|
29
|
-
> **重要:JetBrains Mono
|
|
29
|
+
> **重要:JetBrains Mono 代码字体、以及模型选择器里 Gemini 行专用的 Google Sans Flex Picker,都随插件库分发,由插件宿主以 webfont 形式直接提供给浏览器,无需安装。Anthropic 字体(Sans/Serif)不随 npm 包分发,仅在仓库 [`fonts/`](fonts/) 供下载**——既可以直接安装到系统,也可以免安装:把两个 `.ttf` 放进插件包的 `fonts/` 目录,宿主会以同样的 webfont 方式提供它们(两种方式的字体文件完全一致,效果相同)。生效均需刷新 / 重启 web。
|
|
30
30
|
|
|
31
31
|
| 字体 | 用途 | 文件 |
|
|
32
32
|
|---|---|---|
|
|
33
33
|
| Anthropic Sans Web Text | 界面 / UI | [`fonts/AnthropicSansWebText.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/AnthropicSansWebText.ttf) |
|
|
34
34
|
| Anthropic Serif Web Text | 对话正文 / Markdown | [`fonts/AnthropicSerifWebText.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/AnthropicSerifWebText.ttf) |
|
|
35
35
|
| JetBrains Mono Variable | 代码 / 代码块 | [`fonts/JetBrainsMonoVariable.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/JetBrainsMonoVariable.ttf)、[`fonts/JetBrainsMonoItalicVariable.ttf`](https://github.com/Nwflower/dsh-claude-style/raw/main/fonts/JetBrainsMonoItalicVariable.ttf) |
|
|
36
|
+
| Google Sans Flex Picker | 模型选择器 · Gemini 行名称 | 随包分发:[`fonts/GoogleSansFlexPicker.woff2`](fonts/GoogleSansFlexPicker.woff2) |
|
|
36
37
|
|
|
37
38
|
Anthropic 字体启用(二选一):① 安装到系统——Windows 双击 `.ttf` → 「安装」,macOS 用「字体册」导入;② 免安装——把 `.ttf` 复制到插件包的 `fonts/` 目录(与 `JetBrainsMonoVariable.ttf` 同目录)。完成后刷新页面生效。
|
|
38
39
|
|
|
39
|
-
> JetBrains Mono 以 [SIL Open Font License](fonts/OFL.txt) 分发;Anthropic Sans/Serif 字体版权归 Anthropic 所有,仅供个人使用,不适用 MIT 许可(详见 [LICENSE](LICENSE) 字体声明)。
|
|
40
|
+
> JetBrains Mono 以 [SIL Open Font License](fonts/OFL.txt) 分发;Google Sans Flex Picker 是 Google Sans Flex 的拉丁子集(已改名),同样以 [SIL Open Font License](fonts/OFL-GoogleSansFlex.txt) 分发;Anthropic Sans/Serif 字体版权归 Anthropic 所有,仅供个人使用,不适用 MIT 许可(详见 [LICENSE](LICENSE) 字体声明)。
|
|
40
41
|
|
|
41
42
|
## 安装
|
|
42
43
|
|
|
@@ -79,18 +80,6 @@ dsh plugin --profile web remove dsh-claude-style # 卸载
|
|
|
79
80
|
|
|
80
81
|
然后重启 `dsh web`;若曾在 `cordis.patch.yml` 手工添加过本主题的条目,一并删除。
|
|
81
82
|
|
|
82
|
-
## 功能一览
|
|
83
|
-
|
|
84
|
-
| 能力 | 入口 | 说明 |
|
|
85
|
-
| --- | --- | --- |
|
|
86
|
-
| Claude 视觉 | 全局 | 象牙白/暖黑双画布、陶烬橙唯一强调色、衬线展示标题 + 无衬线界面 + 等宽代码三字体分工 |
|
|
87
|
-
| 权限控制器 | 输入框浮层 / 新会话分段 | Read · Edit · Auto 三段切换会话权限,Auto 走宿主安全确认 |
|
|
88
|
-
| 模型选择器 | 输入框模型席位 | 两级弹层(官方模型 / 推理等级 / 更多模型);模型行按厂商、分组标题按 provider 显示单色品牌标识 |
|
|
89
|
-
| 品牌切换 | 设置 → Claude Style | Claude(星芒 + Claude 字标)与 Anthropic(`A\`)双标识,选择持久化 |
|
|
90
|
-
| 状态动画 | 会话运行中 | 185 个思考动词随机展示;Windows 11 Fluent 风格圆形加载器 |
|
|
91
|
-
| 账户抽屉 | 侧栏底栏 | 悬停展开弹层,直达设置与管理插件 |
|
|
92
|
-
| 封号页彩蛋 | 账户弹层顶部的用户名横条 | 复刻 Claude「Your account is on hold」整页,点任意按钮或按 `Esc` 退出(切走窗口不关);语言由「封号彩蛋语言」设置决定(默认英文) |
|
|
93
|
-
|
|
94
83
|
## 文档
|
|
95
84
|
|
|
96
85
|
| 文档 | 说明 |
|
package/docs/STYLE.md
CHANGED
|
@@ -6,10 +6,10 @@ Design tokens for `dsh-claude-style`, recreating the Claude Code Desktop aesthet
|
|
|
6
6
|
|
|
7
7
|
| Token | Value | Use |
|
|
8
8
|
|---|---|---|
|
|
9
|
-
| ivory light | `#FCFCFB` | light canvas |
|
|
10
|
-
| sidebar light | `#FBFBF9` | light sidebar |
|
|
11
|
-
| ivory | `#
|
|
12
|
-
| ivory
|
|
9
|
+
| ivory light | `#FCFCFB` | light canvas / layer 1 |
|
|
10
|
+
| sidebar light | `#FBFBF9` | light sidebar / layer 2 |
|
|
11
|
+
| ivory neutral | `#F9F9F6` | layer 3 / section bg |
|
|
12
|
+
| ivory border | `#E8E6DC` | border l1 |
|
|
13
13
|
| slate dark | `#141413` | text (light mode), canvas (dark mode) |
|
|
14
14
|
| warm gray | `#B0AEA5` | metadata |
|
|
15
15
|
| clay | `#D97757` | single accent — CTA / links |
|
|
@@ -26,6 +26,12 @@ Rules:
|
|
|
26
26
|
- **Serif display** — headings / editorial statements (`--dsw-font-serif`).
|
|
27
27
|
- **Sans UI** — chrome, body (`--dsw-font-family`).
|
|
28
28
|
- **Mono** — code, technical labels (`--dsw-font-code`).
|
|
29
|
+
- **Vendor face** — one model name in the picker, where the row already wears the
|
|
30
|
+
vendor's mark (`--dsw-font-brand-gemini`: a Latin-only Google Sans Flex subset,
|
|
31
|
+
standard weight, SIL OFL 1.1). A vendor face is a *material*, not a new UI role:
|
|
32
|
+
it never replaces the sans stack, it sits in front of it, so text the subset does
|
|
33
|
+
not cover falls through instead of turning to tofu. Rebuilt with
|
|
34
|
+
`scripts/slim-google-sans.py`; licence in `fonts/OFL-GoogleSansFlex.txt`.
|
|
29
35
|
|
|
30
36
|
## Shapes
|
|
31
37
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# 架构决策记录
|
|
2
|
+
|
|
3
|
+
本文件记录本仓库**为什么**是现在这个样子:每条决策写背景、决定、代价,以及什么情况下允许重审。
|
|
4
|
+
操作手册看 README,硬性规则看 AGENTS.md,视觉令牌看 docs/STYLE.md;本文件只管「权衡」。
|
|
5
|
+
|
|
6
|
+
执行约束:
|
|
7
|
+
|
|
8
|
+
- 任何重构/拆分方案若与本文件已记录的决策冲突,必须先修改对应条目、说明旧决策为何失效,再动手。禁止静默推翻。
|
|
9
|
+
- 新决策追加在文末,编号递增,不删旧条目;被推翻的条目改为「已废弃 + 指向新决策」。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## D1. 零构建工具链,构建期逐字拼接
|
|
14
|
+
|
|
15
|
+
- **背景**:DSH Web 的模块加载器没有相对 require、没有资产 URL 机制,常规打包器(esbuild/rollup)产出的 chunk 拆分与资产引用无处安放。
|
|
16
|
+
- **决定**:`scripts/build.mjs` 把 `src/` 碎片按固定顺序逐字拼接成单个 `lib/client.js`;所有碎片共享一个工厂作用域,禁止 import/export,React 只能经加载器 `require('react')` 取得;资产(SVG/字体)构建期内联为 data URI 或走宿主路由。
|
|
17
|
+
- **代价**:碎片写法受限(ES5 风格、4 空格基础缩进、`%%TOKEN%%` 占位);没有 tree-shaking,bundle 体积靠自律控制。
|
|
18
|
+
- **重审条件**:DSH 加载器原生支持 ES module 相对导入与资产 URL 之时。
|
|
19
|
+
|
|
20
|
+
## D2. 纯浏览器半边实现,不动宿主
|
|
21
|
+
|
|
22
|
+
- **背景**:主题是皮肤,不应 fork DSH;宿主升级要快跟随。
|
|
23
|
+
- **决定**:一切效果通过 CSS 覆盖与客户端 DOM override 实现;宿主半边(`lib/index.js`)只提供静态路由(模型文案 JSON、位图图标)。
|
|
24
|
+
- **代价**:依赖宿主带哈希的 CSS-module 类名,宿主改版可能击穿选择器——用 D3 的纪律和 probe 回归对冲。
|
|
25
|
+
- **重审条件**:DSH 官方开放主题 API / 插槽覆盖所 target 的区域时,逐步迁移过去。
|
|
26
|
+
|
|
27
|
+
## D3. 宿主选择器纪律:最长稳定片段
|
|
28
|
+
|
|
29
|
+
- **背景**:宿主类名带哈希(`_54WpYG_imageItem`),短子串(`[class*="row"]`)极易误伤不相关组件,曾出过事故。
|
|
30
|
+
- **决定**:子串匹配只用最长稳定片段(`[class*="_row"]`);不得覆盖 `[class*="viewArea"]` 的活跃期布局契约;新增子串选择器必须检查误伤面。
|
|
31
|
+
- **代价**:选择器冗长;需要人肉维护「哪些片段稳定」的经验。
|
|
32
|
+
- **重审条件**:宿主提供稳定的 data-* 契约后全面迁移。
|
|
33
|
+
|
|
34
|
+
## D4. composer 样式构建期门控(composer-gate)
|
|
35
|
+
|
|
36
|
+
- **背景**:composer 是性能与正确性最敏感的区域;皮肤规则若在未启用皮肤时泄漏到宿主 DOM 会造成事故。
|
|
37
|
+
- **决定**:composer 相关规则必须位于 `/* @composer-gate */` 标记之下,构建把 `[%%COMPOSER_ATTR%%]` 门控盖到标记以下每条规则,漏盖即构建失败。
|
|
38
|
+
- **代价**:写 composer 样式多一道心智负担;构建脚本要维护门控逻辑。
|
|
39
|
+
- **重审条件**:无(这是安全网,不是权衡)。
|
|
40
|
+
|
|
41
|
+
## D5. 模型文案是数据,不进 bundle
|
|
42
|
+
|
|
43
|
+
- **背景**:模型目录日新月异,文案更新不应要求改 JS 发版。
|
|
44
|
+
- **决定**:`src/model-descriptions.json` 构建期校验后复制到 `lib/`,浏览器首次绘制选择器时经宿主路由 fetch;查找按 精确条目 → 家族规则 → 档位规则 → 目录自带文本 逐级降级;不写「最强/旗舰」等最高级(钉住版本的精确条目除外)。
|
|
45
|
+
- **代价**:首次绘制选择器有一次异步 fetch;文案体系有学习成本。
|
|
46
|
+
- **重审条件**:宿主模型目录 API 直接提供本地化文案时。
|
|
47
|
+
|
|
48
|
+
## D6. 单一 scheduler 统一所有 override 的生命周期
|
|
49
|
+
|
|
50
|
+
- **背景**:多个 override 各自挂 observer/listener 会互相踩踏、泄漏、重复扫树。
|
|
51
|
+
- **决定**:`overrides/scheduler.js` 持有唯一的 MutationObserver(body 子树、attributes 过滤到 aria-label/aria-selected),用 requestAnimationFrame 合并为每帧一次 pass,统一驱动各 `ui.*.sync()`;teardown 统一清理。
|
|
52
|
+
- **代价**:每个 sync 必须有廉价的 early-out;新增 override 要接入同一调度器而不是自立门户。
|
|
53
|
+
- **已知代价与对策**:流式输出期间每帧一次全量 pass 是性能热点,见 D9。
|
|
54
|
+
|
|
55
|
+
## D7. UI 行为优化内置在本插件,不拆独立插件(2026-09 定)
|
|
56
|
+
|
|
57
|
+
- **背景**:模型选择器、权限分段、账户抽屉等「UI 优化」与皮肤共享同一套宿主锚点(选择器纪律)、同一调度器(D6)、同一 popover 工具与 teardown。
|
|
58
|
+
- **决定**:行为层(`src/overrides/`)与皮肤层(`src/styles/`、tokens、品牌资产)在源码内保持分离,但发布为同一个包。不想要 Claude 皮肤的用户用设置里的品牌切换回到接近宿主的观感。
|
|
59
|
+
- **代价**:包名与主题绑定,「只用 UI 优化不要皮」的诉求没有独立入口。
|
|
60
|
+
- **重审条件**:出现第二个真实消费者(另一个主题包或宿主官方)需要复用 overrides 层时,把 overrides 抽成独立包,皮肤包依赖它。
|
|
61
|
+
|
|
62
|
+
## D8. 多主题走「单仓库构建期分包」,不多合一、不抽运行时公共包(2026-09 定)
|
|
63
|
+
|
|
64
|
+
- **背景**:做 Codex / Kimi Code 等第二个主题时,多合一会让包名(claude)名不副实;分仓库会让共享机制(build.mjs、scheduler、popover-utils、选择器纪律)多处漂移;抽 npm 运行时公共包则违反 D1(加载器没有相对 require)。
|
|
65
|
+
- **决定**:第二个主题立项时,把本仓库改为单仓库多主题:共享碎片留仓库级 `src/`,主题私有碎片(tokens、品牌资产、copy、主题特有 overrides)收进 `themes/<name>/`,`build.mjs` 参数化 `--theme`,每个主题产出自包含单文件、各自发 npm 包。`dsh-claude-style` 包名不动。
|
|
66
|
+
- **触发条件(重要)**:仅当新主题有**行为分叉**(不同的 DOM override、不同的 composer 结构)才动手。若只是换色板与 logo,先用现有品牌切换机制(settings.js)在包内消化,不提前改造。
|
|
67
|
+
- **代价**:改造时 build.mjs 与目录布局有一次性手术;两个主题之后共享碎片的改动需要双主题回归。
|
|
68
|
+
|
|
69
|
+
## D9. composer 的 :has() 分支改 JS 写属性(2026-09 定,性能方向)
|
|
70
|
+
|
|
71
|
+
- **背景**:皮肤在流式输出期间的渲染压力主要来自两处:D6 的每帧全量 pass,以及 CSS 中约 70 处对 DOM 结构敏感的 `:has()`(绝大多数是 `[class*="composerStack"]` 上的 hero/inline 分支)——每次 DOM 变更都触发昂贵的选择器重算。
|
|
72
|
+
- **决定**:把「结构感知」从 CSS 移到 JS:`permissions.js` 的 `syncSegments()` 在 scheduler 每轮 pass 里为 composerStack 祖先写 `data-composer-variant="hero|inline"` 属性(observer 的 attributeFilter 不含 data-*,不会反触发;写前比较旧值防抖动;同轮去重避免多卡命中同一 stack 反复写),CSS 改为读属性。交互敏感的 `:has()`(`:hover`、`:focus-within`)与低频的 dialog `:has()` 保留。
|
|
73
|
+
- **落地**:已执行完毕(代码见 `d0fb6f7`),一次性计划文档 `docs/plans/2026-09-composer-mode-attr.md` 按惯例删除,决策与重审条件保留在本条目。仍未消除的结构感知 `:has()` 只剩 placeholder 那条(`card` 上的 `:not(:has([data-composer-placeholder]))`):`copy.js` 本就管理 placeholder,可在它的 sync 里同步写 `data-has-placeholder` 再改 CSS,属可选的后续优化,不在本次范围。
|
|
74
|
+
- **重审条件**:实测证明 :has() 不再是热点,或宿主提供 hero/inline 的稳定属性契约。
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2022 The Google Sans Flex Project Authors (github.com/googlefonts/googlesans-flex)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://openfontlicense.org
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|