@luckylillia-dev/plugin-theme-liuguang 0.0.0-stage → 1.0.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.
- package/GUIDE.md +43 -0
- package/LICENSE +21 -0
- package/assets/icon.svg +12 -0
- package/assets/preview-dark.png +0 -0
- package/assets/preview-light.png +0 -0
- package/lib/build.json +7 -0
- package/lib/client/index.js +91 -0
- package/lib/index.js +3 -0
- package/package.json +72 -4
- package/README.md +0 -3
package/GUIDE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 琉光主题
|
|
2
|
+
|
|
3
|
+
以流动光带、折射玻璃和实时水面倒影,为 LuckyLillia WebUI 换一套悬浮在极光之上的外观。亮色、暗色和跟随系统均使用同一套深蓝底色、青白微光及玻璃配色。
|
|
4
|
+
|
|
5
|
+
背景由本地 Canvas 实时绘制:光带改变曲线与颜色分布,玻璃装置缓慢悬浮,微粒在光中漂移。水面翻转采样同一帧中的极光、玻璃装置和微粒,再按距离施加波纹和衰减。卡片透出模糊后的背景,边缘对场景局部放大,叠加厚边和随指针移动的高光。
|
|
6
|
+
|
|
7
|
+
鼠标移到卡片或玻璃按钮时,表面会随指针方向产生透视倾斜和轻微抬升,离开后平滑回正。触摸输入和系统减弱动态效果下不启用倾斜。侧边栏、弹框和文本输入不参与倾斜。
|
|
8
|
+
|
|
9
|
+
倒影有两层:背景水面映射极光与玻璃场景;卡片下方有留白时,还会显示卡片自身内容的镜像。卡片镜像由浏览器直接渲染,不复制 DOM 或生成第二套按钮;按下一行卡片、页脚及视口底部裁定长度,最长 112 像素。卡片内容倒影需要浏览器支持 `-webkit-box-reflect`(如 Chrome、Edge、Safari),其他浏览器仍保留背景水面倒影。
|
|
10
|
+
|
|
11
|
+
视觉灵感来自 [Cat-bl/liuguang-native](https://github.com/Cat-bl/liuguang-native) 的极光、厚玻璃和水面场景。本插件的配色、CSS、图标和实现为独立编写;不包含原项目的源码、字体或播放器资源。
|
|
12
|
+
|
|
13
|
+
## 使用
|
|
14
|
+
|
|
15
|
+
1. 安装、信任并启用「琉光主题」。无需 QQ 账号或其他协议插件。
|
|
16
|
+
2. 在「页面设置 → 主题与外观」选择「琉光」。启用插件不会自动更改原先选择,插件没有独立设置页或侧边栏入口。
|
|
17
|
+
3. 选择亮色、暗色或跟随系统。
|
|
18
|
+
|
|
19
|
+
选中琉光后,在同一处「主题与外观」中调整四个外观开关:
|
|
20
|
+
|
|
21
|
+
- **极光流动**:控制光带、玻璃悬浮、微粒、水面波纹和鼠标视差。关闭或系统启用减弱动态效果时,场景保持静止。
|
|
22
|
+
- **悬停倾斜**:独立控制卡片和按钮的鼠标倾斜效果;不影响背景动画。
|
|
23
|
+
- **水面倒影**:同时控制背景水面和卡片内容镜像。
|
|
24
|
+
- **降低透明度**:提高玻璃卡片的不透明度,方便阅读。
|
|
25
|
+
|
|
26
|
+
偏好保存在当前浏览器,刷新后保留,同源标签页同步。旧版本偏好会自动补上默认开启的倾斜选项。点击「恢复琉光外观默认值」仅恢复上述四个开关,不修改主题选择或亮暗模式。打开旧版独立设置页的链接时自动转到「页面设置」。
|
|
27
|
+
|
|
28
|
+
停用插件或切换主题会恢复宿主背景,停止场景渲染并移除场景画布和折射边缘;模块卸载后清理所有剩余监听。重新启用后,宿主会恢复仍然保存的主题选择。页面在后台时停止绘制;静态模式只在尺寸、配色、滚动或设置变化时重绘。桌面背景最多 30 帧,背景位图宽度限制为 1440 像素,不按高 DPI 无限增加开销。
|
|
29
|
+
|
|
30
|
+
## 本地构建
|
|
31
|
+
|
|
32
|
+
构建后生成的 `.tgz` 可在 WebUI「插件 → 本地安装」中导入。仅用于源码联调时,也可以把 `package.json`、`lib/`、`assets/`、`GUIDE.md` 和 `LICENSE` 放入 Bot 的一个独立插件目录,再刷新插件列表。
|
|
33
|
+
|
|
34
|
+
```powershell
|
|
35
|
+
npm ci --ignore-scripts
|
|
36
|
+
npm test
|
|
37
|
+
npm run build
|
|
38
|
+
npm pack
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
运行需要已支持 `ctx.theme` / `ctx.style` 的 LuckyLillia WebUI。SDK 兼容范围声明不代表旧版 WebUI 已具备主题运行时;缺少能力时会给出明确提示。样式作用域需要现代浏览器的 CSS `@scope` 支持。
|
|
42
|
+
|
|
43
|
+
包名为 `@luckylillia-dev/plugin-theme-liuguang`,分类为 `theme`。后端入口仅用于插件生命周期,前端入口是 `lib/client/index.js`。前端只使用宿主提供的 React 和公开 WebUI SDK,不加载外部字体、脚本或背景图片。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LuckyLilliaDev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/assets/icon.svg
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" fill="none">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="night" x1="8" y1="6" x2="88" y2="94" gradientUnits="userSpaceOnUse"><stop stop-color="#172a40"/><stop offset="1" stop-color="#2d3154"/></linearGradient>
|
|
4
|
+
<linearGradient id="light" x1="25" y1="20" x2="73" y2="76" gradientUnits="userSpaceOnUse"><stop stop-color="#c5b9ff"/><stop offset=".5" stop-color="#9be7e2"/><stop offset="1" stop-color="#e8d8ed"/></linearGradient>
|
|
5
|
+
</defs>
|
|
6
|
+
<rect width="96" height="96" rx="26" fill="url(#night)"/>
|
|
7
|
+
<path d="M15 65c20-16 43 11 68-8" stroke="#8bd2da" stroke-opacity=".35" stroke-width="1.5"/>
|
|
8
|
+
<path d="M22 73c20-13 35 6 53-5" stroke="#c5b9ff" stroke-opacity=".23"/>
|
|
9
|
+
<rect x="28" y="20" width="42" height="45" rx="13" transform="rotate(-12 28 20)" fill="url(#light)" fill-opacity=".19" stroke="url(#light)" stroke-width="1.5"/>
|
|
10
|
+
<path d="m49 27 3.3 10.7L63 41l-10.7 3.3L49 55l-3.3-10.7L35 41l10.7-3.3L49 27Z" fill="url(#light)"/>
|
|
11
|
+
<circle cx="69" cy="25" r="2" fill="#c9c0ff"/>
|
|
12
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
package/lib/build.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import{createElement as O,useSyncExternalStore as pe}from"react";import{useTheme as ue}from"@luckylillia-dev/plugin-sdk/webui";var _=`.lg-inline { display: grid; gap: 4px; margin-top: 4px; }
|
|
2
|
+
.lg-option { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
|
|
3
|
+
.lg-option-title { margin: 0 0 5px; font-size: 13px; font-weight: 500; color: var(--text-primary); }
|
|
4
|
+
.lg-option-copy { margin: 0; font-size: 12px; line-height: 1.7; color: var(--text-muted); }
|
|
5
|
+
.lg-switch { position: relative; flex: 0 0 42px; width: 42px; height: 25px; padding: 3px; border: 1px solid var(--hairline); border-radius: 99px; background: var(--fill-input); cursor: pointer; }
|
|
6
|
+
.lg-switch::after { content: ''; display: block; width: 17px; height: 17px; border-radius: 50%; background: var(--text-muted); transform: translateX(0); transition: transform .22s, background .22s; }
|
|
7
|
+
.lg-switch[aria-checked=true] { background: linear-gradient(110deg, #477c94, #6978aa); border-color: transparent; }
|
|
8
|
+
.lg-switch[aria-checked=true]::after { background: #fff; transform: translateX(16px); }
|
|
9
|
+
.lg-reset { justify-self: start; margin: 6px 0 0; padding: 5px 0; border: 0; background: transparent; color: var(--text-muted); font-size: 12px; cursor: pointer; }
|
|
10
|
+
.lg-reset:hover { color: var(--accent); }
|
|
11
|
+
@media (prefers-reduced-motion: reduce) {
|
|
12
|
+
.lg-switch::after { transition: none; }
|
|
13
|
+
}
|
|
14
|
+
`;var G=`:scope { background-color: var(--ll-lg-page-base); color-scheme: dark; }
|
|
15
|
+
body { background: var(--ll-lg-page-base); }
|
|
16
|
+
[data-theme-background] { overflow: hidden; contain: strict; }
|
|
17
|
+
.lg-wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
18
|
+
.lg-optics {
|
|
19
|
+
position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; z-index: -1; pointer-events: none;
|
|
20
|
+
mask-image:
|
|
21
|
+
linear-gradient(to bottom, #000, transparent 10px, transparent calc(100% - 10px), #000),
|
|
22
|
+
linear-gradient(to right, #000, transparent 10px, transparent calc(100% - 10px), #000);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* Optical walls; the canvas samples the moving wallpaper at the edges. */
|
|
26
|
+
:is(.card, .glass-regular) {
|
|
27
|
+
backdrop-filter: blur(var(--glass-blur-regular)) saturate(var(--glass-saturate));
|
|
28
|
+
-webkit-backdrop-filter: blur(var(--glass-blur-regular)) saturate(var(--glass-saturate));
|
|
29
|
+
box-shadow:
|
|
30
|
+
inset 0 2px 2px -1px var(--spec-top),
|
|
31
|
+
inset 2px 0 4px -2px var(--spec-side),
|
|
32
|
+
inset -2px -3px 5px -3px var(--spec-bottom),
|
|
33
|
+
inset 0 9px 14px -12px var(--lens-top),
|
|
34
|
+
inset 0 -12px 18px -14px var(--lens-bottom),
|
|
35
|
+
0 0 0 .5px var(--edge-shade),
|
|
36
|
+
0 8px 14px -10px rgb(var(--shade) / .25),
|
|
37
|
+
0 22px 50px -18px rgb(var(--shade) / .28);
|
|
38
|
+
}
|
|
39
|
+
:is(.card, .glass-regular)::before {
|
|
40
|
+
padding: 1.4px;
|
|
41
|
+
background:
|
|
42
|
+
radial-gradient(350px circle at var(--ll-lg-pointer-x, -1000px) var(--ll-lg-pointer-y, -1000px), rgba(223, 255, 255, .85), transparent 70%),
|
|
43
|
+
linear-gradient(135deg, var(--spec-top), var(--spec-side) 23%, transparent 48%, var(--spec-bottom) 80%, var(--spec-side));
|
|
44
|
+
}
|
|
45
|
+
.lg-refracted:not(.glass-dim)::after {
|
|
46
|
+
content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
|
|
47
|
+
background:
|
|
48
|
+
radial-gradient(500px circle at var(--ll-lg-pointer-x, -1000px) var(--ll-lg-pointer-y, -1000px), rgba(218, 250, 255, .09), transparent 65%),
|
|
49
|
+
linear-gradient(125deg, rgba(222, 250, 255, .055), transparent 35%, rgba(165, 183, 255, .025) 70%, rgba(219, 250, 255, .04));
|
|
50
|
+
}
|
|
51
|
+
.lg-tilting {
|
|
52
|
+
transform: perspective(1100px) var(--ll-lg-base-transform, matrix(1,0,0,1,0,0)) rotateX(var(--ll-lg-tilt-x, 0deg)) rotateY(var(--ll-lg-tilt-y, 0deg)) translateY(var(--ll-lg-lift, 0px));
|
|
53
|
+
transform-origin: center;
|
|
54
|
+
transition: transform 180ms cubic-bezier(.2,.7,.25,1), box-shadow 180ms ease;
|
|
55
|
+
will-change: transform;
|
|
56
|
+
}
|
|
57
|
+
.lg-card-reflection {
|
|
58
|
+
-webkit-box-reflect: below 10px linear-gradient(to bottom, transparent calc(100% - var(--ll-lg-mirror-height, 80px)), rgb(0 0 0 / var(--ll-lg-mirror-alpha, .36)));
|
|
59
|
+
}
|
|
60
|
+
main h1, main h2, main h3 { letter-spacing: .01em; }
|
|
61
|
+
.btn-primary, .gradient-primary {
|
|
62
|
+
background-image: linear-gradient(115deg, var(--accent-from), var(--accent-to));
|
|
63
|
+
color: #fff; box-shadow: inset 0 1px rgba(255,255,255,.2), 0 5px 18px -8px var(--accent-ring);
|
|
64
|
+
}
|
|
65
|
+
.btn-primary, .btn-glass { border-radius: var(--r-control); }
|
|
66
|
+
:focus-visible { outline-color: var(--accent); }
|
|
67
|
+
::selection { background: var(--accent-soft); color: var(--text-primary); }
|
|
68
|
+
@media (max-width: 640px) {
|
|
69
|
+
:scope { --glass-blur-regular: 10px; --glass-blur-thick: 20px; }
|
|
70
|
+
}
|
|
71
|
+
@media (prefers-reduced-motion: reduce) {
|
|
72
|
+
:is(.card, .glass-regular) { transition: background-color .15s; }
|
|
73
|
+
.lg-tilting { transform: var(--ll-lg-base-transform, none); transition: none; }
|
|
74
|
+
}
|
|
75
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
76
|
+
:scope { --ll-lg-solid: .98; }
|
|
77
|
+
}
|
|
78
|
+
@media (forced-colors: active) {
|
|
79
|
+
.lg-wallpaper, .lg-optics { display: none; }
|
|
80
|
+
.lg-card-reflection { -webkit-box-reflect: none; }
|
|
81
|
+
}
|
|
82
|
+
@supports not (backdrop-filter: blur(1px)) {
|
|
83
|
+
:scope { --ll-lg-solid: .94; }
|
|
84
|
+
}
|
|
85
|
+
`;var W="liuguang";var ae={"--r-window":"28px","--r-panel":"24px","--r-card":"22px","--r-control":"14px","--r-inner":"10px","--r-capsule":"999px","--glass-blur-regular":"14px","--glass-blur-thick":"28px","--glass-blur-clear":"6px","--glass-saturate":"145%","--glass-brightness":"1","--ease-glass":"cubic-bezier(0.22, 1, 0.36, 1)","--dur-fast":"170ms","--dur-base":"280ms","--dur-slow":"480ms"},J={tokens:{...ae,"--accent":"#addde4","--accent-strong":"#c7eef0","--accent-from":"#315d77","--accent-to":"#5a5c8f","--accent-soft":"rgba(140, 202, 220, 0.12)","--accent-ring":"rgba(155, 206, 223, 0.24)","--text-primary":"#f1f9ff","--text-secondary":"#d4e3f3","--text-muted":"#b5cbe0","--text-hint":"#95b2ca","--glass-tint":"19 29 46","--ll-lg-mirror-alpha":".42","--glass-alpha-clear":"0.3","--glass-alpha-regular":"var(--ll-lg-solid, 0.34)","--glass-alpha-card":"var(--ll-lg-solid, 0.44)","--glass-alpha-thick":"var(--ll-lg-solid, 0.95)","--glass-alpha-raised":"var(--ll-lg-solid, 0.48)","--glass-alpha-dense":"0.98","--glass-alpha-bar":"var(--ll-lg-solid, 0.56)","--spec-top":"rgba(207, 248, 255, 0.65)","--spec-side":"rgba(163, 220, 239, 0.27)","--spec-bottom":"rgba(173, 155, 236, 0.3)","--edge-shade":"rgba(2, 8, 20, 0.42)","--lens-top":"rgba(218, 252, 255, 0.3)","--lens-bottom":"rgba(139, 201, 217, 0.13)","--lens-depth":"rgba(0, 4, 14, 0.22)","--shade":"2 6 17","--shade-alpha-near":"0.2","--shade-alpha-far":"0.3","--fill-quiet":"rgba(194, 218, 255, 0.055)","--fill-quiet-hover":"rgba(194, 218, 255, 0.1)","--fill-input":"rgba(176, 204, 242, 0.07)","--fill-selected":"rgba(137, 190, 211, 0.13)","--hairline":"rgba(170, 200, 240, 0.1)","--ll-lg-aurora-a":"rgba(55, 136, 160, 0.45)","--ll-lg-page-base":"#0d1627","--ll-lg-aurora-b":"rgba(115, 88, 174, 0.4)","--ll-lg-aurora-c":"rgba(173, 111, 145, 0.22)","--ll-lg-horizon":"rgba(96, 130, 180, 0.15)","--ll-lg-wave":"rgba(151, 194, 229, 0.12)"},background:"linear-gradient(150deg, #0b1322 0%, #111b30 48%, #111d2d 100%)"},oe=J;function D(e,a){return{id:W,title:"\u7409\u5149",description:"\u6D41\u52A8\u5149\u5E26\u3001\u6298\u5C04\u73BB\u7483\u4E0E\u5B9E\u65F6\u6C34\u9762\u5012\u5F71\u3002\u4EAE\u6697\u6A21\u5F0F\u7EDF\u4E00\u4F7F\u7528\u6DF1\u8272\u6781\u5149\u3002",light:oe,dark:J,css:`@scope (:root[data-llbot-theme=${JSON.stringify(`${e}|${W}`)}]) {
|
|
86
|
+
${a}
|
|
87
|
+
}`}}var j="llbot-theme-liuguang-v1",N=Object.freeze({motion:!0,tilt:!0,reflection:!0,opaque:!1});function B(e){return Object.fromEntries(Object.entries(N).map(([a,t])=>[a,typeof e?.[a]=="boolean"?e[a]:t]))}function U(e){try{return B(JSON.parse(e))}catch{return{...N}}}function V(e,a){let t;try{t=U(e?.getItem(j))}catch{t={...N}}let c=new Set,r=n=>Object.keys(N).every(d=>t[d]===n[d])?!1:(t=Object.freeze(n),c.forEach(d=>d()),!0),s=n=>{(n.key===j||n.key===null)&&r(U(n.newValue))};return a?.addEventListener("storage",s),{getSnapshot:()=>t,subscribe(n){return c.add(n),()=>c.delete(n)},set(n){if(r(B({...t,...n})))try{e?.setItem(j,JSON.stringify(t))}catch{}},reset(){this.set(N)},dispose(){a?.removeEventListener("storage",s),c.clear()}}}function Y(e,a){let{motion:t,reflection:c,opaque:r}=B(a);return`:root[data-llbot-theme=${JSON.stringify(e)}] {
|
|
88
|
+
--ll-lg-motion:${t?"running":"paused"};
|
|
89
|
+
--ll-lg-reflection:${c?"1":"0"};
|
|
90
|
+
`+(r?`--ll-lg-solid:0.98;
|
|
91
|
+
`:"")+"}"}var K=(e,a,t)=>Math.min(t,Math.max(a,e)),ie=".card, .glass-interactive, .btn-primary, .btn-glass",se=["--ll-lg-tilt-x","--ll-lg-tilt-y","--ll-lg-lift","--ll-lg-base-transform","--ll-lg-pointer-x","--ll-lg-pointer-y"];function Q(e){let a=matchMedia("(prefers-reduced-motion: reduce)"),t=matchMedia("(hover: hover) and (pointer: fine)"),c=new Set,r=new Map,s,n,d=0,i=0,l=!1,u=()=>e.getSnapshot().tilt&&t.matches&&!a.matches,g=o=>{let f=r.get(o);f?.timer&&clearTimeout(f.timer),o.classList.remove("lg-tilting");for(let p of se)o.style.removeProperty(p);r.delete(o)},h=(o=!1)=>{let f=s;if(s=void 0,!f)return;if(o){g(f);return}f.style.setProperty("--ll-lg-tilt-x","0deg"),f.style.setProperty("--ll-lg-tilt-y","0deg"),f.style.setProperty("--ll-lg-lift","0px"),f.style.removeProperty("--ll-lg-pointer-x"),f.style.removeProperty("--ll-lg-pointer-y");let p=r.get(f);p&&(p.timer=setTimeout(()=>g(f),280))},b=()=>{for(let o of c)o.classList.remove("lg-card-reflection"),o.style.removeProperty("--ll-lg-mirror-height");c.clear()},M=()=>{if(i=0,b(),l||!e.getSnapshot().reflection)return;let o=[...document.querySelectorAll("main .card")].filter(p=>!p.parentElement?.closest(".card")&&!p.closest("[role=dialog]")),f=[...o,...document.querySelectorAll("main footer")].map(p=>({element:p,rect:p.getBoundingClientRect()}));for(let p of o){let w=p.getBoundingClientRect();if(w.width<80||w.height<60||w.bottom<0||w.bottom>=innerHeight-22)continue;let A=Math.min(112,innerHeight-w.bottom-20);for(let C of f)C.element===p||C.rect.top<w.bottom-2||Math.min(w.right,C.rect.right)-Math.max(w.left,C.rect.left)<12||(A=Math.min(A,C.rect.top-w.bottom-12));A<12||(p.style.setProperty("--ll-lg-mirror-height",`${Math.floor(A)}px`),p.classList.add("lg-card-reflection"),c.add(p))}},x=()=>{!l&&!i&&(i=requestAnimationFrame(M))},y=()=>{if(d=0,l||!n||!u()){h(!0);return}let o=n.target instanceof Element&&n.target.closest("input, textarea, [contenteditable=true], [role=slider]"),f=n.target instanceof Element&&!o?n.target.closest(ie):null,p=f&&!f.closest("nav, [role=dialog]")&&!f.matches(":disabled")?f:null;if(s!==p&&(h(),p)){let R=r.get(p);R?.timer&&clearTimeout(R.timer);let T=R?.rect??p.getBoundingClientRect(),k=R?.base??getComputedStyle(p).transform;r.set(p,{rect:T,base:k}),p.style.setProperty("--ll-lg-base-transform",k==="none"?"matrix(1,0,0,1,0,0)":k),p.classList.add("lg-tilting"),s=p}if(!s)return;let w=r.get(s).rect,A=K((n.x-w.left)/Math.max(1,w.width),0,1),C=K((n.y-w.top)/Math.max(1,w.height),0,1),$=s.matches(".card")?6.5:10;s.style.setProperty("--ll-lg-tilt-x",`${((.5-C)*$*2).toFixed(2)}deg`),s.style.setProperty("--ll-lg-tilt-y",`${((A-.5)*$*2).toFixed(2)}deg`),s.style.setProperty("--ll-lg-lift",s.matches(".card")?"-4px":"-2px"),s.style.setProperty("--ll-lg-pointer-x",`${A*w.width}px`),s.style.setProperty("--ll-lg-pointer-y",`${C*w.height}px`)},m=o=>{o.pointerType!=="touch"&&(n={x:o.clientX,y:o.clientY,target:o.target},!d&&u()&&(d=requestAnimationFrame(y)))},L=o=>{o.relatedTarget||(n=void 0,h())},S=()=>{n=void 0,h()},v=()=>{S(),x()},E=()=>{if(!u()){h(!0);for(let o of[...r.keys()])g(o)}x()},P=e.subscribe(E);return a.addEventListener("change",E),t.addEventListener("change",E),document.addEventListener("pointermove",m,{passive:!0}),document.addEventListener("pointerout",L),document.addEventListener("pointercancel",S),document.addEventListener("visibilitychange",S),window.addEventListener("blur",S),window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),x(),{refresh:x,dispose(){l=!0,P(),a.removeEventListener("change",E),t.removeEventListener("change",E),document.removeEventListener("pointermove",m),document.removeEventListener("pointerout",L),document.removeEventListener("pointercancel",S),document.removeEventListener("visibilitychange",S),window.removeEventListener("blur",S),window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v),d&&cancelAnimationFrame(d),i&&cancelAnimationFrame(i);for(let o of[...r.keys()])g(o);b()}}}var ee=Math.PI*2,Z=(e,a,t)=>Math.min(t,Math.max(a,e)),q=(e,a)=>`rgba(${e},${a})`;function I(e,a,t,c,r,s){let n=e.createLinearGradient(a,t,c,r);return s.forEach(([d,i])=>n.addColorStop(d,i)),n}function H(e,a,t,c,r,s){let n=e.createRadialGradient(a,t,0,a,t,c);n.addColorStop(0,q(r,s)),n.addColorStop(.38,q(r,s*.5)),n.addColorStop(1,q(r,0)),e.fillStyle=n,e.fillRect(a-c,t-c,c*2,c*2)}function le(e,a,t,c,r,s,n){e.fillStyle=I(e,0,0,a,t,r?[[0,"#071122"],[.55,"#112844"],[1,"#101a33"]]:[[0,"#dce9f5"],[.55,"#b9d9e5"],[1,"#d4caeb"]]),e.fillRect(0,0,a,t);let d=Math.max(a*.52,t*.6);H(e,a*(.22+Math.sin(c*.19)*.15)+n.x*12,t*.25,d,r?"22,165,182":"78,180,198",r?.33:.3),H(e,a*(.76+Math.cos(c*.15)*.15),t*(.18+Math.sin(c*.22)*.1),d*.9,r?"134,73,213":"163,113,208",r?.38:.3),H(e,a*.57,t*.56,d*.6,r?"218,92,171":"238,156,187",.16);let i=u=>{let g=c*.38+u*1.7;e.beginPath(),e.moveTo(-a*.15,t*(.46+Math.sin(g)*.09)),e.bezierCurveTo(a*.18,t*(-.1+Math.cos(g*.8)*.18),a*.34,t*(.72+Math.sin(g)*.16),a*.61,t*(.28+Math.sin(g*.7)*.16)),e.bezierCurveTo(a*.83,t*(-.08+Math.sin(g*.9)*.15),a*1.01,t*(.47+Math.cos(g)*.15),a*1.17,t*.08)};e.save(),e.globalCompositeOperation=r?"screen":"source-over";let l=s?t*.11:t*.1;for(let u=0;u<3;u++){e.strokeStyle=I(e,0,t*.2,a,t*.5,[[0,r?"#22bcca":"#56acb6"],[.35,"#79e5d6"],[.62,"#8795f0"],[.82,"#cb8ce3"],[1,"#ffb3d0"]]);for(let[g,h]of[[2.5,.025],[1.6,.035],[.8,.06],[.28,.13],[.025,.6]])e.lineWidth=Math.max(.6,l*g),e.globalAlpha=h*(r?1:.66)*(u?.55:1),i(u),e.stroke()}e.restore()}function z(e,a,t,c,r,s,n,d=!1){e.save(),e.translate(t,c+Math.sin(s*.7)*r*.045),e.rotate((d?.17:-.17)+Math.sin(s*.27)*.07),e.transform(1,-.08,-.16+Math.cos(s*.32)*.035,1,0,0);let i=r,l=r*1.1,u=r*.2,g=r*.045;e.fillStyle=I(e,-i/2,-l/2,i/2,l/2,[[0,"rgba(205,255,255,.55)"],[.45,"rgba(102,172,213,.08)"],[1,"rgba(171,142,255,.48)"]]),e.beginPath(),e.roundRect(-i/2+g,-l/2+g,i,l,u),e.fill(),e.strokeStyle="rgba(183,229,253,.5)",e.lineWidth=1,e.stroke(),e.save(),e.beginPath(),e.roundRect(-i/2,-l/2,i,l,u),e.clip(),e.globalAlpha=d?.35:.8,e.drawImage(a,Math.max(0,t-r*.58),Math.max(0,c-r*.64),Math.min(r,a.width-t+r*.58),Math.min(r*1.1,a.height-c+r*.64),-i/2,-l/2,i,l),e.globalAlpha=1,e.fillStyle=I(e,-i/2,-l/2,i/2,l/2,[[0,"rgba(224,251,255,.28)"],[.36,"rgba(152,216,244,.03)"],[.62,"rgba(152,216,244,.06)"],[1,"rgba(142,128,232,.25)"]]),e.fillRect(-i/2,-l/2,i,l);let h=Math.sin(s*.45)*i*.9;if(e.fillStyle=I(e,h-i*.25,0,h+i*.25,0,[[0,"transparent"],[.5,"rgba(235,255,255,.19)"],[1,"transparent"]]),e.transform(1,0,-.35,1,0,0),e.fillRect(-i,-l,i*2,l*2),e.restore(),e.strokeStyle=I(e,-i/2,-l/2,i/2,l/2,[[0,"rgba(236,255,255,.95)"],[.25,"rgba(198,255,255,.48)"],[.55,"rgba(139,179,228,.12)"],[1,"rgba(218,187,255,.7)"]]),e.lineWidth=Math.max(1,r*.009),e.beginPath(),e.roundRect(-i/2,-l/2,i,l,u),e.stroke(),e.strokeStyle="rgba(228,255,255,.12)",e.lineWidth=r*.018,e.beginPath(),e.roundRect(-i/2+4,-l/2+4,i-8,l-8,Math.max(2,u-4)),e.stroke(),!d){H(e,0,0,r*.49,"160,248,246",n?.4:.26),e.strokeStyle=n?"rgba(211,255,255,.57)":"rgba(57,136,157,.5)",e.lineWidth=Math.max(.6,r*.004),e.beginPath(),e.ellipse(0,0,r*.29,r*.13,-.5+s*.08,0,ee),e.stroke(),e.fillStyle=n?"#c8fff4":"#367f96",e.shadowColor="#b4fff0",e.shadowBlur=r*.15,e.beginPath();for(let b=0;b<8;b++){let M=b*Math.PI/4-Math.PI/2+Math.sin(s*.3)*.15,x=r*(b%2?.044:.19),y=Math.cos(M)*x,m=Math.sin(M)*x;b?e.lineTo(y,m):e.moveTo(y,m)}e.closePath(),e.fill()}e.restore()}function ce(e,a,t,c,r,s){e.save();let n=s?16:42;for(let d=0;d<n;d++){let i=(d*.6180339+c*.006*(d%3+1))%1*a,l=d*.38211%.61*t+Math.sin(c*.6+d)*t*.025,u=.15+(Math.sin(c*1.1+d*1.7)+1)*.2;e.fillStyle=r?q("183,248,255",u):q("72,117,158",u*.6),e.beginPath(),e.arc(i,l,(d%4===0?1.5:.7)*(s?.7:1),0,ee),e.fill()}e.restore()}function de(e,a,t,c,r,s,n,d){if(d){e.save(),e.beginPath(),e.rect(0,r,t,c-r),e.clip();for(let i=r;i<c;i+=2){let l=(i-r)/(c-r),u=r-(i-r)*1.15;if(u<0)continue;let g=(Math.sin(l*52-s*1.9)+Math.sin(l*93+s*1.3)*.45)*(1+l*8);e.globalAlpha=(n?.88:.83)*(1-l*.48),e.drawImage(a,0,Math.max(0,u-2),t,2,g-16,i,t+32,2.5)}e.globalAlpha=1,e.fillStyle=I(e,0,r,0,c,[[0,"transparent"],[1,n?"rgba(4,15,31,.28)":"rgba(205,218,239,.17)"]]),e.fillRect(0,r,t,c-r);for(let i=0;i<16;i++){let l=((i/16+s*.012)%1)**2,u=r+l*(c-r),g=t*(.5+Math.sin(i*2.4+s*.18)*.43),h=t*(.015+l*.09);e.strokeStyle=q(n?"132,234,242":"255,255,255",(1-l)*.11),e.lineWidth=.7,e.beginPath(),e.ellipse(g,u,h,1+l*2,0,.08,Math.PI-.08),e.stroke()}e.restore()}}function ge(e,a,{compact:t=!1,onFrame:c}={}){let r=e.getContext("2d",{alpha:!1});if(!r)return()=>{};let s=document.createElement("canvas"),n=document.createElement("canvas"),d=s.getContext("2d",{alpha:!1}),i=n.getContext("2d",{alpha:!1});if(!d||!i)return()=>{};let l=matchMedia("(prefers-reduced-motion: reduce)"),u=matchMedia("(forced-colors: active)"),g=1,h=1,b=0,M=0,x=7,y=!1,m={x:0,y:0},L={x:0,y:0},S=!0,v=()=>a.getSnapshot().motion&&!l.matches,E=()=>{le(d,g,h,x,!0,t,m),i.drawImage(s,0,0);let k=t?g*.35:Math.min(g*.18,h*.28),F=g*(t?.53:.84)+m.x*10,X=h*(t?.34:.35)+m.y*7;z(i,s,F+k*.25,X-k*.05,k*.88,x+1.5,!0,!0),z(i,s,F-k*.07,X,k,x,!0),ce(i,g,h,x,!0,t),r.drawImage(n,0,0),de(r,n,g,h,h*(t?.62:.57),x,!0,a.getSnapshot().reflection),e.dataset.motion=v()?"running":"still",e.dataset.reflection=String(a.getSnapshot().reflection),c?.(e),S=!1},P=T=>{if(b=0,y||document.hidden||u.matches)return;let k=M?Math.min(100,T-M):34;if(k<1e3/(t?24:30)&&!S){b=requestAnimationFrame(P);return}M=T,v()&&(x+=k/1e3,m.x+=(L.x-m.x)*.07,m.y+=(L.y-m.y)*.07),E(),v()&&(b=requestAnimationFrame(P))},o=()=>{S=!0,M=0,!b&&!y&&!document.hidden&&(b=requestAnimationFrame(P))},f=()=>{let T=e.getBoundingClientRect(),k=Math.min(devicePixelRatio||1,t?1.5:1,1440/Math.max(1,T.width));if(g=Math.max(1,Math.round(T.width*k)),h=Math.max(1,Math.round(T.height*k)),!(e.width===g&&e.height===h)){for(let F of[e,s,n])F.width=g,F.height=h;!document.hidden&&!u.matches&&E(),o()}},p=()=>{b&&cancelAnimationFrame(b),b=0,document.hidden||o()},w=T=>{v()&&(L={x:Z(T.clientX/innerWidth*2-1,-1,1),y:Z(T.clientY/innerHeight*2-1,-1,1)})},A=new ResizeObserver(f);A.observe(e);let C=new MutationObserver(o);C.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]});let $=a.subscribe(o);l.addEventListener("change",o),u.addEventListener("change",o),document.addEventListener("visibilitychange",p),window.addEventListener("scroll",o,{capture:!0,passive:!0}),t||window.addEventListener("pointermove",w,{passive:!0}),f();let R=()=>{y=!0,b&&cancelAnimationFrame(b),A.disconnect(),C.disconnect(),$(),l.removeEventListener("change",o),u.removeEventListener("change",o),document.removeEventListener("visibilitychange",p),window.removeEventListener("scroll",o,!0),t||window.removeEventListener("pointermove",w),s.width=s.height=n.width=n.height=1};return R.invalidate=o,R}function te(e,a){let t=document.documentElement,c,r,s,n,d=0,i=!1,l=new Map,u=()=>{for(let[y,m]of l)m.remove(),y.classList.remove("lg-refracted"),y.style.removeProperty("--ll-lg-pointer-x"),y.style.removeProperty("--ll-lg-pointer-y");l.clear()},g=()=>{let y=!1;for(let[m,L]of l)m.isConnected||(L.remove(),m.classList.remove("lg-refracted"),l.delete(m));for(let m of document.querySelectorAll(".card, .glass-regular")){if(l.has(m)||m.parentElement?.closest(".card, .glass-regular, .bg-popup")||m.closest("[role=dialog]"))continue;if(l.size>=24)break;let L=document.createElement("canvas");L.className="lg-optics",L.setAttribute("aria-hidden","true"),m.classList.add("lg-refracted"),m.prepend(L),l.set(m,L),y=!0}y&&s?.invalidate?.(),n?.refresh()},h=y=>{let m=y.width/Math.max(1,y.clientWidth);for(let[L,S]of l){let v=L.getBoundingClientRect();if(!L.isConnected||v.bottom<0||v.top>innerHeight||v.width<10||v.height<10)continue;let E=Math.round(v.width),P=Math.round(v.height),o=Math.min(10,P/5);(S.width!==E||S.height!==P)&&(S.width=E,S.height=P);let f=S.getContext("2d");if(!f)continue;f.clearRect(0,0,E,P),f.globalAlpha=a.getSnapshot().opaque?.04:.42;let p=(w,A,C,$,R,T,k,F)=>f.drawImage(y,w*m,A*m,C*m,$*m,R,T,k,F);p(v.left,v.top+o*.55,E,o*.45,0,0,E,o),p(v.left,v.bottom-o,E,o*.45,0,P-o,E,o),p(v.left+o*.55,v.top+o,o*.45,P-o*2,0,o,o,P-o*2),p(v.right-o,v.top+o,o*.45,P-o*2,E-o,o,o,P-o*2)}},b=()=>{if(d=0,i)return;let y=t.dataset.llbotTheme===e?document.querySelector("[data-theme-background]"):null;y!==c?(s?.(),s=void 0,n?.dispose(),n=void 0,r?.remove(),r=void 0,u(),c=y,c&&(n=Q(a),r=document.createElement("canvas"),r.className="lg-wallpaper",r.setAttribute("aria-hidden","true"),r.dataset.liuguangScene="wallpaper",c.append(r),g(),s=ge(r,a,{onFrame:h}))):c&&g()},M=()=>{!d&&!i&&(d=requestAnimationFrame(b))},x=new MutationObserver(M);return x.observe(t,{attributes:!0,attributeFilter:["data-llbot-theme"],childList:!0,subtree:!0}),M(),()=>{i=!0,x.disconnect(),d&&cancelAnimationFrame(d),s?.(),n?.dispose(),r?.remove(),u()}}var me=[{key:"motion",title:"\u6781\u5149\u6D41\u52A8",copy:"\u5149\u5E26\u3001\u60AC\u6D6E\u73BB\u7483\u4E0E\u5FAE\u7C92\u6301\u7EED\u6D41\u52A8\uFF0C\u9F20\u6807\u5E26\u6765\u8F7B\u5FAE\u89C6\u5DEE\u3002"},{key:"tilt",title:"\u60AC\u505C\u503E\u659C",copy:"\u5361\u7247\u548C\u6309\u94AE\u968F\u9F20\u6807\u65B9\u5411\u503E\u659C\uFF0C\u79BB\u5F00\u540E\u5E73\u6ED1\u56DE\u6B63\u3002"},{key:"reflection",title:"\u6C34\u9762\u5012\u5F71",copy:"\u573A\u666F\u6620\u5165\u6C34\u4E2D\uFF0C\u5361\u7247\u4E0B\u65B9\u7684\u7559\u767D\u663E\u793A\u5185\u5BB9\u955C\u50CF\u3002"},{key:"opaque",title:"\u964D\u4F4E\u900F\u660E\u5EA6",copy:"\u8BA9\u5361\u7247\u66F4\u6E05\u6670\uFF0C\u9002\u5408\u957F\u65F6\u95F4\u9605\u8BFB\u3002"}];function he(e){if(!e.theme?.register||!e.style)throw new Error("\u7409\u5149\u4E3B\u9898\u9700\u8981\u652F\u6301\u4E3B\u9898\u63D2\u4EF6\u7684\u65B0\u7248 LuckyLillia WebUI");let a;try{a=window.localStorage}catch{}let t=V(a,window),c=()=>{},r=()=>{},s=()=>{};try{let u=function(){let h=ue(),b=pe(t.subscribe,t.getSnapshot,t.getSnapshot);return h.active!==n?null:O("div",{className:"lg-inline"},me.map(M=>O("div",{className:"lg-option",key:M.key},O("div",null,O("p",{className:"lg-option-title"},M.title),O("p",{className:"lg-option-copy"},M.copy)),O("button",{type:"button",role:"switch","aria-label":M.title,"aria-checked":b[M.key],className:"lg-switch",onClick:()=>t.set({[M.key]:!b[M.key]})}))),O("button",{type:"button",className:"lg-reset",onClick:()=>t.reset()},"\u6062\u590D\u7409\u5149\u5916\u89C2\u9ED8\u8BA4\u503C"))},n=`${e.plugin.name}|${W}`,d=e.theme.register(D(e.plugin.name,G));r=te(n,t);let i=e.style("controls",_,{scope:"plugin",when:"loaded"}),l=e.style("preferences",Y(n,t.getSnapshot()));c=t.subscribe(()=>{let h=l;l=e.style("preferences",Y(n,t.getSnapshot())),h()}),e.slot("settings.appearance",{id:"liuguang",label:"\u7409\u5149\u5916\u89C2",component:u,order:100});let g=()=>{window.location.hash.slice(1).split("?")[0]===`${e.plugin.name}:appearance`&&window.location.replace("#webui")};return window.addEventListener("hashchange",g),s=()=>window.removeEventListener("hashchange",g),g(),()=>{s(),r(),c(),t.dispose(),l(),i(),d()}}catch(n){throw s(),r(),c(),t.dispose(),n}}export{he as default};
|
package/lib/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luckylillia-dev/plugin-theme-liuguang",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "琉光:流动极光、轻透玻璃与水面倒影的 WebUI 主题",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./package.json": "./package.json"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"lib",
|
|
13
|
+
"assets",
|
|
14
|
+
"GUIDE.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "LuckyLilliaDev",
|
|
19
|
+
"url": "https://github.com/LuckyLilliaDev"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/LuckyLilliaDev/lucky-lillia-plugin-theme-liuguang.git"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22.15"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"luckylillia-plugin",
|
|
35
|
+
"theme",
|
|
36
|
+
"liuguang",
|
|
37
|
+
"glass",
|
|
38
|
+
"webui"
|
|
39
|
+
],
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@luckylillia-dev/plugin-sdk": "^1.0.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@luckylillia-dev/plugin-sdk": "npm:@luckylillia/plugin-sdk@^1.0.1",
|
|
45
|
+
"esbuild": "~0.28.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "node scripts/build.mjs",
|
|
49
|
+
"test": "node --test",
|
|
50
|
+
"prepack": "npm test && npm run build"
|
|
51
|
+
},
|
|
52
|
+
"llbot": {
|
|
53
|
+
"title": "琉光主题",
|
|
54
|
+
"description": "流动极光、折射玻璃、鼠标悬停倾斜、水面与卡片倒影。亮暗模式统一使用深色外观。",
|
|
55
|
+
"category": "theme",
|
|
56
|
+
"icon": "assets/icon.svg",
|
|
57
|
+
"details": "GUIDE.md",
|
|
58
|
+
"screenshots": [
|
|
59
|
+
{
|
|
60
|
+
"src": "assets/preview-dark.png",
|
|
61
|
+
"caption": "暗色:流动光带、折射玻璃与水面倒影"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"src": "assets/preview-light.png",
|
|
65
|
+
"caption": "页面设置:主题选择与四个外观开关集中在同一处"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"webui": "./lib/client/index.js",
|
|
69
|
+
"service": {
|
|
70
|
+
"required": [],
|
|
71
|
+
"implements": []
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/README.md
DELETED