@linxin666/dsh-client-ui-skin-center 0.1.16 → 0.1.18
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.i18n.yaml +2 -2
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/lib/client.js +345 -69
- package/lib/client.js.map +1 -1
- package/lib/index.js +166 -41
- package/package.json +1 -1
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 0f2055eff6d26f61407584e4e18f70e716a815c2
|
|
6
|
+
README.zh.md: 4747255cf51b02f43009eb8723d230f8e75c4990
|
package/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
`@linxin666/dsh-client-ui-skin-center` (cordis plugin id `ui-skin-center`)
|
|
5
|
+
`@linxin666/dsh-client-ui-skin-center` (cordis plugin id `ui-skin-center`) puts the skin list / try-on / apply into the real dsh Web GUI as a first-level settings section (settings → 皮肤中心 / Skin Center), a sibling nav item of General / Models / Plugins / Agent presets and of the Web UI Plugins group and Pet sections. The card carries its own enable switch (off disables try-on, apply and the background controls).
|
|
6
6
|
|
|
7
7
|
- List: shows "官方默认" (official default) plus every skin in the repo (qq98 / ths / xp / blue-fantasy / dragon-heir / minecraft) with its name, tagline, and accent color; the currently active target carries the Active marker.
|
|
8
8
|
- Try-on: clicking "Try on" loads that skin's client bundle on demand — the host route `/api/skin-center/bundle/<id>` serves `lib/client.js` as a same-origin script (the same mechanism the core uses to load plugins), the factory registers with the page's own `window.__ModuleLoader__`, and `window.__DSH_MODULES__.import` materializes it (a real loader, not a simulator and no eval); the chrome takes effect immediately; light/dark switching rides the official theme service; "Exit try-on" restores everything — the current skin's styles, DOM, favicon, title, and body inline styles are all restored. "官方默认" (official default) can also be tried on: one click immediately withdraws the skin and returns to the official look preview.
|
|
9
9
|
- Mutual exclusion: during try-on, the active skin's visual writes (body attribute, background inline styles, chrome child nodes, xp's footer taskbar) are temporarily withdrawn per the prescription, and restored verbatim on exit; only one skin is on the page at a time.
|
|
10
10
|
- Apply: the host half (`src/index.ts` + `src/routes.ts`) exposes `/api/skin-center/apply` and `/api/skin-center/bundle/<id>` (serves skin bundles on demand); clicking "Apply / 恢复默认" (Apply / Restore default) runs the embedded in-process `dsh-skin use` port (`src/skin-switch.ts`) server-side, writes `<harness-home>/cordis.patch.yml`, and the DSH config watcher hot-loads it within seconds and the page auto-refreshes — **no dsh web restart, no copying a command, no `dsh-skin` binary on PATH**. On failure the error message includes a terminal fallback command. Harness home follows the dsh launcher: an injected HOME maps to `<home>/.dsh`, else a trimmed non-empty `$DSH_HOME` is used directly, else `~/.dsh`. The target profile resolves as: explicit option, then `$DSH_SKIN_PROFILE`, then `$DSH_PROFILE`, then `process.cwd()` when it is a directory directly under `<harness-home>/profiles/<name>`, then `web`. Windows compatibility: the same resolution rules apply with no `$HOME` or fixed paths, and profile links fall back to directory junctions when symlink privileges are missing.
|
|
11
11
|
|
|
12
|
+
- Background controls: a background-occlusion slider (0–100%) veils the backdrop behind the panels for skins that paint one (blue-fantasy / whale-song), plus two per-state Gaussian-blur sliders (0–20 px) — 空对话 (blur when the conversation is empty) and 有对话 (blur once it has content). The active blur is applied through a fixed `backdrop-filter` element behind the shell; 0 disables it entirely (no element, no GPU cost). These apply only to skins that paint a backdrop; the official default has none.
|
|
13
|
+
|
|
12
14
|
## Install (official plugin bundle)
|
|
13
15
|
|
|
14
16
|
Install the family skin aggregate package `@linxin666/dsh-skins` first (all skins plus the skin center in one); for this package alone use the `link:` commands below.
|
|
@@ -39,7 +41,7 @@ skins/skin-center/
|
|
|
39
41
|
src/index.ts # host side: registers /api/skin-center/* routes
|
|
40
42
|
src/routes.ts # host routes (proxy to the dsh-skin CLI)
|
|
41
43
|
src/invariant.ts # invariant companion plugin (no assertions)
|
|
42
|
-
src/client/index.ts # apply: registers the
|
|
44
|
+
src/client/index.ts # apply: registers the first-level settings section + body scope
|
|
43
45
|
src/client/SkinCenter.tsx # card component (official default + list/try-on/light-dark/one-click apply)
|
|
44
46
|
src/client/try-on.ts # try-on engine (real loader + mutual-exclusion restore, incl. official try-on)
|
|
45
47
|
src/client/locales.ts # en/zh copy
|
|
@@ -82,7 +84,7 @@ ln -sfn ~/code/dsh-web-ui/packages/skins/skin-center \
|
|
|
82
84
|
# - id: ui-skin-center
|
|
83
85
|
# name: '@linxin666/dsh-client-ui-skin-center'
|
|
84
86
|
|
|
85
|
-
# 3. the config watcher hot-loads in seconds; refresh the page to see the skin-center
|
|
87
|
+
# 3. the config watcher hot-loads in seconds; refresh the page to see the skin-center section in 设置 → 皮肤中心
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
## Try-on mutual-exclusion restore prescription (try-on.ts)
|
|
@@ -96,7 +98,7 @@ Exit try-on = try-on skin disposer (real code path) → module invalidate + styl
|
|
|
96
98
|
|
|
97
99
|
## Acceptance checklist (top-level README contract)
|
|
98
100
|
|
|
99
|
-
- [x] The skin-center
|
|
101
|
+
- [x] The skin-center section appears in 设置 → 皮肤中心 without console errors
|
|
100
102
|
- [x] The list contains the official default plus all skins; the currently active one is marked
|
|
101
103
|
- [x] Try-on really takes effect (chrome/background/title/favicon); light/dark correct; the official default can be tried on
|
|
102
104
|
- [x] Exit fully restores; mutual exclusion (no two title bars)
|
package/README.zh.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
`@linxin666/dsh-client-ui-skin-center`(cordis 插件 id `ui-skin-center
|
|
5
|
+
`@linxin666/dsh-client-ui-skin-center`(cordis 插件 id `ui-skin-center`)把皮肤列表/试穿/应用放进真实 dsh Web GUI 的设置页,作为一级菜单项(设置 → 皮肤中心),与通用设置 / 模式 / 插件 / Agent 预设以及 Web UI 插件组、宠物同级。卡片自带启用开关(关闭后停用试穿、应用与背景控件)。
|
|
6
6
|
|
|
7
7
|
- 列表:展示「官方默认」+ 仓库里全部皮肤(qq98 / ths / xp / blue-fantasy / dragon-heir / minecraft)的名称、tagline、强调色;当前激活的目标带 Active 标记。
|
|
8
8
|
- 试穿:点击「Try on」后按需加载该皮肤的 client bundle——host 路由 `/api/skin-center/bundle/<id>` 以同源 script 提供 `lib/client.js`(内核加载插件的同一机制),factory 注册到页面自己的 `window.__ModuleLoader__`,`window.__DSH_MODULES__.import` 物化(不是模拟器、不用 eval),chrome 立即生效;亮/暗切换走官方 theme 服务;「Exit try-on」完全还原——当前皮肤的样式、DOM、favicon、标题、body 内联样式全部恢复。「官方默认」也可试穿:点一下皮肤立即收回、回到官方外观预览。
|
|
9
9
|
- 互斥:试穿期间会按配方暂时收回当前激活皮肤的视觉写面(body 属性、背景内联样式、chrome 子节点、xp 的 footer taskbar),退出后原样恢复;同一时刻页面上只有一套皮肤。
|
|
10
10
|
- 应用:host 半区(`src/index.ts` + `src/routes.ts`)暴露 `/api/skin-center/apply` 与 `/api/skin-center/bundle/<id>`(按需提供皮肤 bundle),点击「Apply / 恢复默认」即在服务端执行内嵌的 `dsh-skin use` 进程内移植版(`src/skin-switch.ts`),写入 `<harness-home>/cordis.patch.yml` 后由 DSH 配置 watcher 秒级热载入,页面自动刷新生效——**无需重启 dsh web,无需复制命令,也不要求 PATH 上有 `dsh-skin` 二进制**。应用失败时错误提示里附带终端兜底命令。harness home 与 dsh 启动器一致:注入的 HOME 映射为 `<home>/.dsh`,否则优先使用去除首尾空白后非空的 `$DSH_HOME`(直接使用,不再追加后缀),最后回退到 `~/.dsh`。目标 profile 依次取:显式选项、`$DSH_SKIN_PROFILE`、`$DSH_PROFILE`、`process.cwd()` 直接位于 `<harness-home>/profiles/<name>` 下时的 `<name>`,最后 `web`。Windows 兼容性:同一套解析规则不依赖 `$HOME` 与固定路径,符号链接权限不足时 profile 链接回退为目录 junction。
|
|
11
11
|
|
|
12
|
+
- 背景控制:背景遮挡滑块(0–100%)为带背景插画的皮肤(blue-fantasy / whale-song)背后的背景加遮罩;另有两条按对话状态区分的背景高斯模糊滑块(0–20 px)——「空对话」在对话为空时生效、「有对话」在出现内容后生效。生效的模糊通过 shell 背后的一个固定 `backdrop-filter` 元素施加;设为 0 即完全关闭(无元素、无 GPU 开销)。这些控件仅对带背景插画的皮肤可见有效;官方默认无背景图。
|
|
13
|
+
|
|
12
14
|
## 安装(官方 plugin bundle 方式)
|
|
13
15
|
|
|
14
16
|
推荐先装皮肤全家桶聚合包 `@linxin666/dsh-skins` 一次到位(含全部皮肤与皮肤中心);只装本包时用下列 link 命令。
|
|
@@ -39,7 +41,7 @@ skins/skin-center/
|
|
|
39
41
|
src/index.ts # host 侧:注册 /api/skin-center/* 路由
|
|
40
42
|
src/routes.ts # host 路由(代理 dsh-skin CLI)
|
|
41
43
|
src/invariant.ts # invariant 伴随插件(无断言)
|
|
42
|
-
src/client/index.ts # apply
|
|
44
|
+
src/client/index.ts # apply:注册一级设置菜单项 + body 作用域
|
|
43
45
|
src/client/SkinCenter.tsx # 卡片组件(官方默认 + 列表/试穿/亮暗/一键应用)
|
|
44
46
|
src/client/try-on.ts # 试穿引擎(真实 loader + 互斥还原,含官方试穿)
|
|
45
47
|
src/client/locales.ts # en/zh 文案
|
|
@@ -82,7 +84,7 @@ ln -sfn ~/code/dsh-web-ui/packages/skins/skin-center \
|
|
|
82
84
|
# - id: ui-skin-center
|
|
83
85
|
# name: '@linxin666/dsh-client-ui-skin-center'
|
|
84
86
|
|
|
85
|
-
# 3. 配置 watcher 秒级热载入;刷新页面即在
|
|
87
|
+
# 3. 配置 watcher 秒级热载入;刷新页面即在 设置 → 皮肤中心 看到皮肤中心菜单项
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
## 试穿互斥的还原配方(try-on.ts)
|
|
@@ -96,7 +98,7 @@ ln -sfn ~/code/dsh-web-ui/packages/skins/skin-center \
|
|
|
96
98
|
|
|
97
99
|
## 验收对照(README 顶层契约)
|
|
98
100
|
|
|
99
|
-
- [x]
|
|
101
|
+
- [x] 设置 → 皮肤中心 出现皮肤中心菜单项,无 console 报错
|
|
100
102
|
- [x] 列表含官方默认 + 全部皮肤,当前激活有标记
|
|
101
103
|
- [x] 试穿真实生效(chrome/背景/标题/favicon),亮/暗正确;官方默认可试穿
|
|
102
104
|
- [x] 退出完全还原;互斥(不出现两套标题栏)
|