dsh-cyrene-theme-change 0.11.2 → 0.11.4
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/NOTICE +13 -0
- package/README.md +8 -2
- package/lib/client.js +33 -6
- package/lib/index.js +4 -0
- package/package.json +1 -1
package/NOTICE
CHANGED
|
@@ -26,6 +26,19 @@ SPDX-License-Identifier: MIT
|
|
|
26
26
|
backdrop-filter 会创建 containing block、破坏弹窗浮层,因此不做全局面模糊。
|
|
27
27
|
本项目未复制其代码,仅采用其公开的结论与 API 用法。
|
|
28
28
|
|
|
29
|
+
dsh-plugin-liquid-glass(神猫君,MIT)
|
|
30
|
+
https://github.com/smj-1680/dsh-plugin-liquid-glass
|
|
31
|
+
参考点:backdrop-filter:url(#svg) 的真折射用法、feTurbulence/feDisplacementMap
|
|
32
|
+
的实测参数(baseFrequency 0.006/0.010、numOctaves 2、scale 26、滤镜区域 124%)、
|
|
33
|
+
以及噪声缓慢漂移让折射"活着"的做法。本项目未复制其代码。
|
|
34
|
+
|
|
35
|
+
dsh-liquid-glass(Ultronen)与 dsh-plugin-liquid-glass(神猫君)是两个不同项目,
|
|
36
|
+
前者只做透明度,后者做折射;本项目两种结论都采用了。
|
|
37
|
+
https://github.com/Ultronen/dsh-liquid-glass
|
|
38
|
+
参考点:用 ctx.theme.overrideTokens 做半透明而不是自写 --dsw-* 变量;
|
|
39
|
+
backdrop-filter 会创建 containing block、破坏弹窗浮层,因此不做全局面模糊。
|
|
40
|
+
本项目未复制其代码,仅采用其公开的结论与 API 用法。
|
|
41
|
+
|
|
29
42
|
本项目以 MIT 许可证发布,完整条款见同目录的 LICENSE 文件。
|
|
30
43
|
使用、修改、再分发与商用均被允许,只需保留本 NOTICE 与 LICENSE 中的版权声明。
|
|
31
44
|
注意:第三方素材(见三、四节)不因本许可证而改变归属。
|
package/README.md
CHANGED
|
@@ -45,8 +45,14 @@
|
|
|
45
45
|
|
|
46
46
|
折射档的操作开销来自 `feDisplacementMap` 的逐像素采样,手机上明显吃 GPU,所以默认关闭。
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
感谢两个不同的参考项目(它们不是同一个东西):
|
|
49
|
+
|
|
50
|
+
| 项目 | 做法 | 我们借了什么 |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| [`dsh-liquid-glass`](https://github.com/Ultronen/dsh-liquid-glass)(Ultronen,MIT) | 只做透明度,**不用** `backdrop-filter`;用 `ctx.theme.overrideTokens` 换 token;设置存 localStorage | 「全局面不要用 backdrop-filter」这条结论 |
|
|
53
|
+
| [`dsh-plugin-liquid-glass`](https://github.com/smj-1680/dsh-plugin-liquid-glass)(神猫君,MIT) | 真折射:`backdrop-filter: url(#svg)` + `feTurbulence`/`feDisplacementMap`,噪声缓慢漂移 | 滤镜参数(频率 0.006/0.010、scale 26、区域 124%)与「滤镜放进 backdrop-filter、不要给元素加 filter」的用法 |
|
|
54
|
+
|
|
55
|
+
两者走了相反的路线,这正好说明:**透明度是便宜的,折射是贵的**,所以我们把它做成开关。
|
|
50
56
|
|
|
51
57
|
## 与上游的差异
|
|
52
58
|
|
package/lib/client.js
CHANGED
|
@@ -559,6 +559,21 @@ body[data-dsh-cyrene][data-ds-dark-theme]{
|
|
|
559
559
|
user-select:none;
|
|
560
560
|
}
|
|
561
561
|
.cyre-switch input{accent-color:var(--cy-ui-accent)}
|
|
562
|
+
/* 玻璃不透明度滑块:给个明确的轨道和拇指,默认外观在部分 WebView 上是细线,很难拖 */
|
|
563
|
+
.cyre-range{
|
|
564
|
+
width:120px;height:18px;margin:0 2px;cursor:pointer;
|
|
565
|
+
accent-color:var(--cy-ui-accent,#e8699f);
|
|
566
|
+
}
|
|
567
|
+
.cyre-range::-webkit-slider-runnable-track{
|
|
568
|
+
height:4px;border-radius:999px;
|
|
569
|
+
background:linear-gradient(90deg,var(--cy-ui-accent,#e8699f),rgba(160,120,150,.28));
|
|
570
|
+
}
|
|
571
|
+
.cyre-range::-webkit-slider-thumb{
|
|
572
|
+
-webkit-appearance:none;appearance:none;
|
|
573
|
+
width:14px;height:14px;margin-top:-5px;border-radius:50%;
|
|
574
|
+
background:#fff;border:1.5px solid var(--cy-ui-accent,#e8699f);
|
|
575
|
+
box-shadow:0 1px 4px rgba(160,90,130,.35);
|
|
576
|
+
}
|
|
562
577
|
.cyre-status{margin-left:auto;font-size:12px;color:var(--cy-ui-soft)}
|
|
563
578
|
.cyre-status[data-tone="ok"]{color:#3f9d76}
|
|
564
579
|
.cyre-status[data-tone="error"]{color:#d4518f}
|
|
@@ -2573,6 +2588,7 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
|
|
|
2573
2588
|
const stickersBox = pick("stickers");
|
|
2574
2589
|
const petBox = pick("pet");
|
|
2575
2590
|
const glassHeavyBox = pick("glassHeavy");
|
|
2591
|
+
let sliding = false;
|
|
2576
2592
|
const glassAlphaRange = pick("glassAlpha");
|
|
2577
2593
|
const glassAlphaVal = pick("glassAlphaVal");
|
|
2578
2594
|
const petEmotionLine = pick("pet-emotion");
|
|
@@ -2880,7 +2896,8 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
|
|
|
2880
2896
|
stickersBox.checked = state.stickers !== false;
|
|
2881
2897
|
petBox.checked = state.pet === true;
|
|
2882
2898
|
if (glassHeavyBox !== null) glassHeavyBox.checked = state.glassHeavy === true;
|
|
2883
|
-
|
|
2899
|
+
// 正在拖的时候不要回写,否则每次状态刷新都会把滑块拽回去
|
|
2900
|
+
if (glassAlphaRange !== null && sliding !== true) {
|
|
2884
2901
|
const alpha = Number.isFinite(state.glassAlpha) ? state.glassAlpha : 0.55;
|
|
2885
2902
|
glassAlphaRange.value = String(alpha);
|
|
2886
2903
|
if (glassAlphaVal !== null) glassAlphaVal.textContent = Math.round(alpha * 100) + "%";
|
|
@@ -2942,16 +2959,26 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
|
|
|
2942
2959
|
});
|
|
2943
2960
|
petBox.addEventListener("change", () => {
|
|
2944
2961
|
void save({ pet: petBox.checked }).then(paint);
|
|
2945
|
-
|
|
2962
|
+
});
|
|
2963
|
+
// 玻璃的两个控件要挂在这一层——之前误放进桌宠的 change 回调里,
|
|
2964
|
+
// 结果只有勾过桌宠之后滑块才"活",表现就是怎么拖都没反应。
|
|
2965
|
+
if (glassHeavyBox !== null) {
|
|
2966
|
+
glassHeavyBox.addEventListener("change", () => {
|
|
2946
2967
|
void save({ glassHeavy: glassHeavyBox.checked }).then(paint);
|
|
2947
2968
|
});
|
|
2948
|
-
|
|
2949
|
-
|
|
2969
|
+
}
|
|
2970
|
+
if (glassAlphaRange !== null) {
|
|
2971
|
+
glassAlphaRange.addEventListener("input", () => {
|
|
2972
|
+
sliding = true;
|
|
2973
|
+
if (glassAlphaVal !== null) {
|
|
2974
|
+
glassAlphaVal.textContent = Math.round(Number(glassAlphaRange.value) * 100) + "%";
|
|
2975
|
+
}
|
|
2950
2976
|
});
|
|
2951
|
-
|
|
2977
|
+
glassAlphaRange.addEventListener("change", () => {
|
|
2978
|
+
sliding = false;
|
|
2952
2979
|
void save({ glassAlpha: Number(glassAlphaRange.value) }).then(paint);
|
|
2953
2980
|
});
|
|
2954
|
-
}
|
|
2981
|
+
}
|
|
2955
2982
|
|
|
2956
2983
|
// 状态筛选只重画卡片,不发请求(筛选是纯本地的)。
|
|
2957
2984
|
memxFilter.addEventListener("change", () => {
|
package/lib/index.js
CHANGED
|
@@ -548,6 +548,10 @@ function publicState() {
|
|
|
548
548
|
pet: state.pet,
|
|
549
549
|
/** 聊天里贴图的最大边长(px)。 */
|
|
550
550
|
stickerSize: state.stickerSize,
|
|
551
|
+
/** 液态玻璃:不透明度(0.25 很透 → 0.95 几乎不透明)。 */
|
|
552
|
+
glassAlpha: state.glassAlpha,
|
|
553
|
+
/** 液态玻璃:真折射(SVG 位移滤镜),开销大,默认关。 */
|
|
554
|
+
glassHeavy: state.glassHeavy,
|
|
551
555
|
/** 自添加的表情包(条目在状态文件、文件在 stickers-custom/)。 */
|
|
552
556
|
customStickers: state.customStickers.map((entry) => ({ ...entry })),
|
|
553
557
|
/** 整页背景图的设定;可用素材清单走 /cyrene/backgrounds。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cyrene-theme-change",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "昔涟(Cyrene)主题:粉白渐变毛玻璃 UI + 侧边栏可编辑的人格设定 + 表情包 / 背景图 / 世界书 + 认知记忆(L0/L1/L2 分层、成色衰减、语义召回、账本与健康行、压缩反思)与关系情绪 | A Cyrene (Honkai: Star Rail) theme for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|