dsh-cyrene-theme-change 0.11.1 → 0.11.2
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/lib/client.js +52 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -918,9 +918,10 @@ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page::before{
|
|
|
918
918
|
border-radius:inherit;
|
|
919
919
|
z-index:-1;
|
|
920
920
|
background:linear-gradient(135deg,rgba(255,255,255,.34),rgba(255,255,255,.10) 52%,rgba(255,255,255,.28));
|
|
921
|
-
backdrop-filter
|
|
922
|
-
|
|
923
|
-
filter:url(#cyrene-theme-change-liquid);
|
|
921
|
+
/* 关键:SVG 滤镜放进 backdrop-filter,而不是给元素加 filter。
|
|
922
|
+
给元素加 filter 会把文字一起扭曲;放进 backdrop-filter 只扭"背后"。 */
|
|
923
|
+
backdrop-filter:url(#cyrene-theme-change-liquid) blur(6px) saturate(150%);
|
|
924
|
+
-webkit-backdrop-filter:url(#cyrene-theme-change-liquid) blur(6px) saturate(150%);
|
|
924
925
|
box-shadow:
|
|
925
926
|
inset 0 1px 0 rgba(255,255,255,.85),
|
|
926
927
|
inset 0 -1px 0 rgba(255,255,255,.30),
|
|
@@ -1408,6 +1409,54 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
|
|
|
1408
1409
|
// 但本插件早有一套写死在本文件里的 --dsw-* 覆盖,选择器在 body[...] 上,
|
|
1409
1410
|
// 优先级高于主题服务在 :root 写的值——结果服务覆写根本没生效。
|
|
1410
1411
|
// 现在统一成本文件里的 CSS 变量 + --cyre-glass-a 滑块,只保留一条路。
|
|
1412
|
+
/**
|
|
1413
|
+
* 真·液态玻璃的折射滤镜。
|
|
1414
|
+
*
|
|
1415
|
+
* 技术点全部来自 dsh-plugin-liquid-glass(神猫君,MIT)的实测参数:
|
|
1416
|
+
* · feTurbulence baseFrequency 0.006 / 0.010、numOctaves 2 —— 频率再高就变成"水波抖";
|
|
1417
|
+
* · feDisplacementMap scale 26,R/G 通道取位移;
|
|
1418
|
+
* · 滤镜区域放到 124%,否则边缘会被裁掉一圈;
|
|
1419
|
+
* · 每 120ms 微微漂移一次噪声频率,让折射"活着",慢到不抢注意力。
|
|
1420
|
+
*
|
|
1421
|
+
* 用法上和它一致:SVG 滤镜塞进 `backdrop-filter: url(#id)`,**不是**给元素加 filter
|
|
1422
|
+
* (那样文字会一起扭)。只作用于本插件自己的 .cyre-* 面,不碰 shell 槽位。
|
|
1423
|
+
*
|
|
1424
|
+
* 尊重 prefers-reduced-motion:会晕的人不该被强制看动效。
|
|
1425
|
+
*/
|
|
1426
|
+
const LIQUID_ID = PACKAGE_ID + "-liquid"
|
|
1427
|
+
let liquidDrift = null
|
|
1428
|
+
function ensureLiquidFilter() {
|
|
1429
|
+
if (typeof document.getElementById === "function" && document.getElementById(LIQUID_ID) !== null) return
|
|
1430
|
+
if (typeof document.createElementNS !== "function") return
|
|
1431
|
+
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg")
|
|
1432
|
+
svg.setAttribute("id", LIQUID_ID + "-holder")
|
|
1433
|
+
svg.setAttribute("width", "0")
|
|
1434
|
+
svg.setAttribute("height", "0")
|
|
1435
|
+
svg.setAttribute("aria-hidden", "true")
|
|
1436
|
+
svg.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none"
|
|
1437
|
+
svg.innerHTML = '<filter id="' + LIQUID_ID + '" x="-12%" y="-12%" width="124%" height="124%"'
|
|
1438
|
+
+ ' color-interpolation-filters="sRGB">'
|
|
1439
|
+
+ '<feTurbulence type="fractalNoise" baseFrequency="0.006 0.010" numOctaves="2" seed="7" result="noise"></feTurbulence>'
|
|
1440
|
+
+ '<feDisplacementMap in="SourceGraphic" in2="noise" scale="26"'
|
|
1441
|
+
+ ' xChannelSelector="R" yChannelSelector="G"></feDisplacementMap>'
|
|
1442
|
+
+ "</filter>"
|
|
1443
|
+
document.body.appendChild(svg)
|
|
1444
|
+
let reduced = false
|
|
1445
|
+
try { reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches } catch { reduced = false }
|
|
1446
|
+
if (reduced || liquidDrift !== null) return
|
|
1447
|
+
const turb = typeof svg.querySelector === "function" ? svg.querySelector("feTurbulence") : null
|
|
1448
|
+
if (turb === null) return
|
|
1449
|
+
let phase = 0
|
|
1450
|
+
liquidDrift = setInterval(() => {
|
|
1451
|
+
phase += 0.006
|
|
1452
|
+
try {
|
|
1453
|
+
turb.setAttribute("baseFrequency",
|
|
1454
|
+
(0.006 + Math.sin(phase) * 0.0012).toFixed(5) + " "
|
|
1455
|
+
+ (0.010 + Math.cos(phase * 0.8) * 0.0016).toFixed(5))
|
|
1456
|
+
} catch { /* 元素已被回收 */ }
|
|
1457
|
+
}, 120)
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1411
1460
|
function applySkin() {
|
|
1412
1461
|
if (!document.body) return;
|
|
1413
1462
|
document.body.setAttribute(SKIN_ATTR, state.theme ? "on" : "off");
|
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.2",
|
|
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",
|