dsh-cyrene-theme-change 0.11.3 → 0.11.5

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.
Files changed (2) hide show
  1. package/lib/client.js +105 -27
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -559,6 +559,39 @@ 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
+ /* 折射档的底光:几团彩色径向渐变铺满整页,给位移滤镜提供纹理。
564
+ pointer-events:none 且 z-index:-1,不挡任何交互。 */
565
+ #cyrene-theme-change-glow{
566
+ position:fixed;inset:-10%;z-index:-1;pointer-events:none;
567
+ background:
568
+ radial-gradient(46% 38% at 18% 12%, rgba(255,150,205,.85), transparent 70%),
569
+ radial-gradient(42% 34% at 84% 8%, rgba(150,190,255,.80), transparent 72%),
570
+ radial-gradient(50% 40% at 72% 88%, rgba(255,205,160,.78), transparent 72%),
571
+ radial-gradient(44% 36% at 8% 82%, rgba(190,160,255,.72), transparent 74%);
572
+ filter:saturate(1.15);
573
+ }
574
+ body[data-dsh-cyrene][data-dsh-cyrene][data-theme="dark"] #cyrene-theme-change-glow{
575
+ background:
576
+ radial-gradient(46% 38% at 18% 12%, rgba(120,60,110,.85), transparent 70%),
577
+ radial-gradient(42% 34% at 84% 8%, rgba(50,80,140,.80), transparent 72%),
578
+ radial-gradient(50% 40% at 72% 88%, rgba(140,90,60,.75), transparent 72%);
579
+ filter:saturate(1.05) brightness(.85);
580
+ }
581
+ .cyre-range{
582
+ width:120px;height:18px;margin:0 2px;cursor:pointer;
583
+ accent-color:var(--cy-ui-accent,#e8699f);
584
+ }
585
+ .cyre-range::-webkit-slider-runnable-track{
586
+ height:4px;border-radius:999px;
587
+ background:linear-gradient(90deg,var(--cy-ui-accent,#e8699f),rgba(160,120,150,.28));
588
+ }
589
+ .cyre-range::-webkit-slider-thumb{
590
+ -webkit-appearance:none;appearance:none;
591
+ width:14px;height:14px;margin-top:-5px;border-radius:50%;
592
+ background:#fff;border:1.5px solid var(--cy-ui-accent,#e8699f);
593
+ box-shadow:0 1px 4px rgba(160,90,130,.35);
594
+ }
562
595
  .cyre-status{margin-left:auto;font-size:12px;color:var(--cy-ui-soft)}
563
596
  .cyre-status[data-tone="ok"]{color:#3f9d76}
564
597
  .cyre-status[data-tone="error"]{color:#d4518f}
@@ -900,26 +933,38 @@ body[data-dsh-cyrene][data-cyrene-skin="on"] [data-code-block-content]{
900
933
  那会创建 containing block,把设置弹窗和浮层搞坏。
901
934
  开销:feTurbulence + feDisplacementMap 是逐像素算的,手机上明显吃 GPU,
902
935
  所以做成开关,默认 off。 */
903
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card,
936
+ /* 折射要铺在**大面积**上才看得出来。只给小卡片加滤镜,视觉上仍然像塑料。 */
937
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] [data-dockkit-pane],
938
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] [data-dockkit-float],
939
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] [role="dialog"]{
940
+ backdrop-filter:url(#cyrene-theme-change-liquid) blur(10px) saturate(170%);
941
+ -webkit-backdrop-filter:url(#cyrene-theme-change-liquid) blur(10px) saturate(170%);
942
+ }
943
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page,
904
944
  body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-editor,
905
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-panel,
906
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page{
945
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-panel{
946
+ background-color:transparent;
947
+ background-image:none;
948
+ }
949
+ /* 宿主的插件面板/设置面板容器:折射档下也让它透明,
950
+ 否则我们的页面透明、它自己的白底还在,交界处就是一条硬边(截图里的"分层")。 */
951
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] [data-cordis-panel],
952
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] [data-plugin-panel]{
953
+ background-color:transparent;
954
+ background-image:none;
955
+ }
956
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card{
907
957
  position:relative;
908
958
  isolation:isolate;
909
959
  background-color:transparent;
910
960
  }
911
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card::before,
912
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-editor::before,
913
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-panel::before,
914
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page::before{
961
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card::before{
915
962
  content:"";
916
963
  position:absolute;
917
964
  inset:0;
918
965
  border-radius:inherit;
919
966
  z-index:-1;
920
967
  background:linear-gradient(135deg,rgba(255,255,255,.34),rgba(255,255,255,.10) 52%,rgba(255,255,255,.28));
921
- /* 关键:SVG 滤镜放进 backdrop-filter,而不是给元素加 filter。
922
- 给元素加 filter 会把文字一起扭曲;放进 backdrop-filter 只扭"背后"。 */
923
968
  backdrop-filter:url(#cyrene-theme-change-liquid) blur(6px) saturate(150%);
924
969
  -webkit-backdrop-filter:url(#cyrene-theme-change-liquid) blur(6px) saturate(150%);
925
970
  box-shadow:
@@ -927,22 +972,16 @@ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page::before{
927
972
  inset 0 -1px 0 rgba(255,255,255,.30),
928
973
  0 10px 30px rgba(176,120,156,.16);
929
974
  }
930
- body[data-dsh-cyrene][data-cyrene-glass="heavy"][data-theme="dark"] .cyre-card::before,
931
- body[data-dsh-cyrene][data-cyrene-glass="heavy"][data-theme="dark"] .cyre-editor::before,
932
- body[data-dsh-cyrene][data-cyrene-glass="heavy"][data-theme="dark"] .cyre-panel::before,
933
- body[data-dsh-cyrene][data-cyrene-glass="heavy"][data-theme="dark"] .cyre-page::before{
975
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"][data-theme="dark"] .cyre-card::before{
934
976
  background:linear-gradient(135deg,rgba(64,46,62,.42),rgba(38,30,42,.20) 52%,rgba(58,42,56,.36));
935
977
  box-shadow:
936
978
  inset 0 1px 0 rgba(255,255,255,.22),
937
979
  inset 0 -1px 0 rgba(255,255,255,.06),
938
980
  0 10px 30px rgba(0,0,0,.34);
939
981
  }
940
- @supports not ((backdrop-filter:blur(1px)) and (filter:url(#x))){
941
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card::before,
942
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-editor::before,
943
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-panel::before,
944
- body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-page::before{
945
- filter:none;
982
+ @supports not (backdrop-filter:url(#x)){
983
+ body[data-dsh-cyrene][data-cyrene-glass="heavy"] .cyre-card::before{
984
+ backdrop-filter:blur(10px) saturate(175%);
946
985
  }
947
986
  }
948
987
  body[data-dsh-cyrene][data-cyrene-skin="on"] [data-slot="sidebar"]{
@@ -1423,6 +1462,28 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
1423
1462
  *
1424
1463
  * 尊重 prefers-reduced-motion:会晕的人不该被强制看动效。
1425
1464
  */
1465
+ /**
1466
+ * 折射光晕层。
1467
+ *
1468
+ * 为什么必须有它:feDisplacementMap 扭的是「背后的像素」。背后要是纯白,
1469
+ * 扭完还是纯白——看起来就是一块塑料。所以折射档下要先铺一层彩色渐变当"底光",
1470
+ * 折射才有东西可弯。(dsh-plugin-liquid-glass 里的 GLOW / STRIPES 就是这个作用,
1471
+ * 它注释写的是「demo backlight,有壁纸就关掉」。)
1472
+ */
1473
+ const GLOW_ID = PACKAGE_ID + "-glow"
1474
+ function ensureGlow() {
1475
+ if (typeof document.getElementById !== "function") return
1476
+ if (document.getElementById(GLOW_ID) !== null) return
1477
+ if (typeof document.createElement !== "function") return
1478
+ const layer = document.createElement("div")
1479
+ layer.id = GLOW_ID
1480
+ document.body.prepend(layer)
1481
+ }
1482
+ function removeGlow() {
1483
+ if (typeof document.getElementById !== "function") return
1484
+ const layer = document.getElementById(GLOW_ID)
1485
+ if (layer !== null) layer.remove()
1486
+ }
1426
1487
  const LIQUID_ID = PACKAGE_ID + "-liquid"
1427
1488
  let liquidDrift = null
1428
1489
  function ensureLiquidFilter() {
@@ -1461,7 +1522,12 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
1461
1522
  if (!document.body) return;
1462
1523
  document.body.setAttribute(SKIN_ATTR, state.theme ? "on" : "off");
1463
1524
  document.body.setAttribute("data-cyrene-glass", state.glassHeavy === true ? "heavy" : "off");
1464
- if (state.theme === true && state.glassHeavy === true) ensureLiquidFilter();
1525
+ if (state.theme === true && state.glassHeavy === true) {
1526
+ ensureLiquidFilter();
1527
+ ensureGlow();
1528
+ } else {
1529
+ removeGlow();
1530
+ }
1465
1531
  const size = Number.isFinite(state.stickerSize) ? Math.round(state.stickerSize) : 96;
1466
1532
  document.body.style.setProperty("--cyre-sticker-size", size + "px");
1467
1533
  // 液态玻璃的不透明度:0.25(很透)→ 0.95(几乎不透明)
@@ -2497,7 +2563,7 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
2497
2563
  '<label class="cyre-switch"><input type="checkbox" data-role="theme"><span>粉白毛玻璃主题</span></label>',
2498
2564
  '<label class="cyre-switch"><input type="checkbox" data-role="stickers"><span>允许发表情包</span></label>',
2499
2565
  '<label class="cyre-switch"><input type="checkbox" data-role="pet"><span>桌宠</span></label>',
2500
- '<label class="cyre-switch"><input type="checkbox" data-role="glassHeavy"><span>液态玻璃 · 折射(开销大)</span></label>',
2566
+ '<label class="cyre-switch"><input type="checkbox" data-role="glassHeavy"><span>液态玻璃 · 强烈折射(开销大)</span></label>',
2501
2567
  '<label class="cyre-switch"><span>玻璃不透明度</span><input type="range" class="cyre-range" min="0.25" max="0.95" step="0.05" data-role="glassAlpha"><span data-role="glassAlphaVal">55%</span></label>',
2502
2568
  '<span class="cyre-status" data-role="status"></span>',
2503
2569
  "</div>",
@@ -2573,6 +2639,7 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
2573
2639
  const stickersBox = pick("stickers");
2574
2640
  const petBox = pick("pet");
2575
2641
  const glassHeavyBox = pick("glassHeavy");
2642
+ let sliding = false;
2576
2643
  const glassAlphaRange = pick("glassAlpha");
2577
2644
  const glassAlphaVal = pick("glassAlphaVal");
2578
2645
  const petEmotionLine = pick("pet-emotion");
@@ -2880,7 +2947,8 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
2880
2947
  stickersBox.checked = state.stickers !== false;
2881
2948
  petBox.checked = state.pet === true;
2882
2949
  if (glassHeavyBox !== null) glassHeavyBox.checked = state.glassHeavy === true;
2883
- if (glassAlphaRange !== null) {
2950
+ // 正在拖的时候不要回写,否则每次状态刷新都会把滑块拽回去
2951
+ if (glassAlphaRange !== null && sliding !== true) {
2884
2952
  const alpha = Number.isFinite(state.glassAlpha) ? state.glassAlpha : 0.55;
2885
2953
  glassAlphaRange.value = String(alpha);
2886
2954
  if (glassAlphaVal !== null) glassAlphaVal.textContent = Math.round(alpha * 100) + "%";
@@ -2942,16 +3010,26 @@ body[data-dsh-cyrene] [data-composer-input][data-placeholder^="Describe what you
2942
3010
  });
2943
3011
  petBox.addEventListener("change", () => {
2944
3012
  void save({ pet: petBox.checked }).then(paint);
2945
- if (glassHeavyBox !== null) glassHeavyBox.addEventListener("change", () => {
3013
+ });
3014
+ // 玻璃的两个控件要挂在这一层——之前误放进桌宠的 change 回调里,
3015
+ // 结果只有勾过桌宠之后滑块才"活",表现就是怎么拖都没反应。
3016
+ if (glassHeavyBox !== null) {
3017
+ glassHeavyBox.addEventListener("change", () => {
2946
3018
  void save({ glassHeavy: glassHeavyBox.checked }).then(paint);
2947
3019
  });
2948
- if (glassAlphaRange !== null) glassAlphaRange.addEventListener("input", () => {
2949
- if (glassAlphaVal !== null) glassAlphaVal.textContent = Math.round(Number(glassAlphaRange.value) * 100) + "%";
3020
+ }
3021
+ if (glassAlphaRange !== null) {
3022
+ glassAlphaRange.addEventListener("input", () => {
3023
+ sliding = true;
3024
+ if (glassAlphaVal !== null) {
3025
+ glassAlphaVal.textContent = Math.round(Number(glassAlphaRange.value) * 100) + "%";
3026
+ }
2950
3027
  });
2951
- if (glassAlphaRange !== null) glassAlphaRange.addEventListener("change", () => {
3028
+ glassAlphaRange.addEventListener("change", () => {
3029
+ sliding = false;
2952
3030
  void save({ glassAlpha: Number(glassAlphaRange.value) }).then(paint);
2953
3031
  });
2954
- });
3032
+ }
2955
3033
 
2956
3034
  // 状态筛选只重画卡片,不发请求(筛选是纯本地的)。
2957
3035
  memxFilter.addEventListener("change", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cyrene-theme-change",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
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",