dsh-ambient-gallery 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +71 -2
- package/assets/icon-180.png +0 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +33 -0
- package/lib/client.js +1370 -0
- package/lib/index.js +537 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +91 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 liutianqi
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ambient Gallery · 氛围图墙
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
主面板背后的一层会呼吸的图片墙。每个窗口最多 **20 张图**轮播;默认是**程序生成的简易图**(不依赖任何素材),点一下即可换成**你自己的本地图片**;其中一个窗口可以**隐蔽地播放本地视频**。
|
|
4
|
+
|
|
5
|
+
所有图片与视频都只存在本机,不上传、不联网。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 它做了什么
|
|
10
|
+
|
|
11
|
+
- **阵列排布**:默认 4×3 = 12 个窗口,行列数、间距、圆角、模糊都可调。
|
|
12
|
+
- **每格动态轮播**:一个窗口里可以放最多 20 张图,按设定间隔交叉淡入(1.6s 过渡)。每个窗口的首帧延迟带确定性相位偏移,所以整面墙是「涟漪式」亮起,而不是整齐地闪。
|
|
13
|
+
- **满 20 张之后**:再选图不会失败 —— 新图进、最旧的自动轮换出去(滚动窗口语义,两端都按 `/\.slice(-20)/` 执行)。
|
|
14
|
+
- **默认就有内容**:没有放图时,每个窗口用 canvas 现场生成 3 张不同母题(光池/条纹/弧线)的渐变图,同一格每次刷新都一致(种子来自窗口编号)。
|
|
15
|
+
- **点选本地图片**:进入「布置」模式后,点击任一窗口即可多选本地图片,或直接把文件拖进窗口。
|
|
16
|
+
- **隐蔽视频窗**:其中一个窗口可以是视频(默认第 12 个窗口,可改位置或关闭)。它常态下与其他窗口一样低浓度、静音循环;只有在布置模式下才会显示出播放控件。
|
|
17
|
+
- **底层、不挡操作**:整面墙挂在 `shell.overlay` 上,根节点 `pointer-events:none`,每格低透明度 + `mix-blend-mode`,文字从上面流过依然清晰;它从不拦截点击、滚动或键盘输入。
|
|
18
|
+
|
|
19
|
+
## 装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
dsh plugin --profile web add dsh-ambient-gallery
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
或从源码目录安装:设置 → 插件 → 安装本地包,指向本目录。
|
|
26
|
+
|
|
27
|
+
## 用
|
|
28
|
+
|
|
29
|
+
1. 右下角有一个很淡的圆钮(悬停才明显),点它进入**布置模式**。
|
|
30
|
+
2. 布置模式下:点任意窗口选图(可多选)、拖文件进窗口、调列数/行数/浓度/间隔/模糊。
|
|
31
|
+
3. 点「完成」退出布置模式,图墙回到背景里。
|
|
32
|
+
|
|
33
|
+
设置 → **氛围图墙** 里有同一组控件(还带说明),可以整体隐藏图墙、恢复默认、清空全部。
|
|
34
|
+
|
|
35
|
+
## 存储与接口
|
|
36
|
+
|
|
37
|
+
- 状态:`~/.dsh/ambient-gallery/state.json`(config + 每格的帧列表)
|
|
38
|
+
- 媒体:`~/.dsh/ambient-gallery/media/`(导入时重命名为随机 id,客户端文件名只作为展示信息保留)
|
|
39
|
+
- 路由(Host 半,仅本机 loopback 可访问):
|
|
40
|
+
- `GET/POST /plugins/dsh-ambient-gallery/state`
|
|
41
|
+
- `POST /plugins/dsh-ambient-gallery/import`(原始文件体 + `X-File-Name`)
|
|
42
|
+
- `GET/HEAD /plugins/dsh-ambient-gallery/media/<id>.<ext>`(支持 `Range`,视频可流式 seek)
|
|
43
|
+
- `POST /plugins/dsh-ambient-gallery/remove?id=<id>`
|
|
44
|
+
|
|
45
|
+
图片走 HTTP 而不是 `localStorage`/data URL,是因为手机照片几张就会撞到 5MB 配额,而视频 base64 进内存既慢又会重复持有。
|
|
46
|
+
|
|
47
|
+
## 兼容性
|
|
48
|
+
|
|
49
|
+
`engines.dsh: ">=0.2.0-rc.2 <0.3.0-0"`,`engines.node: ">=18"`。四个 peer 依赖全部 optional。
|
|
50
|
+
|
|
51
|
+
## 已知取舍
|
|
52
|
+
|
|
53
|
+
- 图墙在 `shell.overlay` 里,而宿主的 overlay 层(`z-index:20`)恒在各列之上、且中心列自带不透明底色 —— 所以「画在内容下面」在实现上做不到,只能用**低浓度 + 混合模式**做出视觉底纹的效果,同时保证永不拦截事件。这是刻意选择,不是遗漏。
|
|
54
|
+
- 布置模式期间图墙会临时接管鼠标(否则无法点击选图),退出后立刻恢复穿透。
|
|
55
|
+
- `prefers-reduced-motion: reduce` 时图墙自动隐藏轮播与整面墙。
|
|
56
|
+
|
|
57
|
+
## 开发
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
node --check lib/index.js
|
|
61
|
+
node --check lib/client.js
|
|
62
|
+
node tools/gallery-smoke.mjs lib/client.js # 离线:加载器 / 槽位注册 / 渲染
|
|
63
|
+
node tools/gallery-probe.mjs # 端到端:20 张上限、合并、Range、视频
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`tools/make-icon.py` 用 Pillow 从 `icon.svg` 的几何重绘 `assets/icon-180.png`(同一套五窗格与播放三角),所以图标是「一份设计,两种格式」,不会各自漂移。
|
|
67
|
+
|
|
68
|
+
装入 profile 后,Host 改动需要 `plugin_manager set_plugin enabled=false → true` 重载。
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
|
Binary file
|
package/cordis.patch.yml
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none" role="img" aria-label="Ambient Gallery">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="aggBg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#2B3A67"/>
|
|
5
|
+
<stop offset="0.55" stop-color="#3E5C8A"/>
|
|
6
|
+
<stop offset="1" stop-color="#6C4E86"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
<linearGradient id="aggCellA" x1="0" y1="0" x2="0" y2="1">
|
|
9
|
+
<stop offset="0" stop-color="#8FB8E8"/>
|
|
10
|
+
<stop offset="1" stop-color="#5A7FC0"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<linearGradient id="aggCellB" x1="0" y1="0" x2="1" y2="1">
|
|
13
|
+
<stop offset="0" stop-color="#E7B6A0"/>
|
|
14
|
+
<stop offset="1" stop-color="#B77C9E"/>
|
|
15
|
+
</linearGradient>
|
|
16
|
+
<linearGradient id="aggCellC" x1="0" y1="1" x2="1" y2="0">
|
|
17
|
+
<stop offset="0" stop-color="#7FD4C1"/>
|
|
18
|
+
<stop offset="1" stop-color="#4F9FB4"/>
|
|
19
|
+
</linearGradient>
|
|
20
|
+
</defs>
|
|
21
|
+
<rect x="2" y="2" width="60" height="60" rx="15" fill="url(#aggBg)"/>
|
|
22
|
+
<g opacity="0.95">
|
|
23
|
+
<rect x="11" y="12" width="18" height="14" rx="3.4" fill="url(#aggCellA)"/>
|
|
24
|
+
<rect x="32" y="12" width="21" height="14" rx="3.4" fill="url(#aggCellB)" opacity="0.92"/>
|
|
25
|
+
<rect x="11" y="29.5" width="12" height="11" rx="3" fill="url(#aggCellC)" opacity="0.9"/>
|
|
26
|
+
<rect x="26" y="29.5" width="27" height="11" rx="3" fill="url(#aggCellA)" opacity="0.62"/>
|
|
27
|
+
<rect x="11" y="43.5" width="42" height="9.5" rx="3" fill="url(#aggCellB)" opacity="0.5"/>
|
|
28
|
+
</g>
|
|
29
|
+
<g stroke="#FFFFFF" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.92">
|
|
30
|
+
<path d="M47.5 32.8l5.4-3.1v9.6l-5.4-3.1z"/>
|
|
31
|
+
<rect x="38.4" y="29.7" width="9.1" height="9.8" rx="2.2"/>
|
|
32
|
+
</g>
|
|
33
|
+
</svg>
|