dsh-folia 4.26.0-pre.30 → 4.26.0-pre.31

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/boot/index.js CHANGED
@@ -53,6 +53,17 @@ export function readBoot() {
53
53
  items,
54
54
  // 素材池取片方式:first=固定第一条;random=随机;rotate=按启动次数轮换
55
55
  poolMode: ['first', 'random', 'rotate'].includes(String(raw.poolMode)) ? String(raw.poolMode) : 'first',
56
+ // 退场转场:fade(默认,只透明度)/ scale(轻微放大)/ slide(上滑)
57
+ transition: ['fade', 'scale', 'slide'].includes(String(raw.transition)) ? String(raw.transition) : 'fade',
58
+ // 两幕冷启动:第一幕是纯色 + 一行字(固定标识),第二幕才是素材
59
+ act1: (() => {
60
+ const a = raw.act1 && typeof raw.act1 === 'object' ? raw.act1 : {};
61
+ return {
62
+ enabled: a.enabled === true,
63
+ text: typeof a.text === 'string' ? a.text.slice(0, 60) : '',
64
+ durationMs: Number.isFinite(Number(a.durationMs)) ? Math.min(5000, Math.max(300, Number(a.durationMs))) : 1200,
65
+ };
66
+ })(),
56
67
  // 进入方式:tail = 播完再进(默认);ready = 应用就绪就进;click = 点一下才进。
57
68
  // 之前没有这个字段,一律「就绪即进」,于是 8~15 秒的片子 1.2 秒就被掐掉。
58
69
  enterMode: ['tail', 'ready', 'click'].includes(String(raw.enterMode)) ? String(raw.enterMode) : 'tail',
@@ -207,7 +218,14 @@ export const BOOT_SCREEN_SOURCE = String.raw`
207
218
  function teardown() {
208
219
  if (done) return;
209
220
  done = true;
210
- try { if (root) root.style.opacity = "0"; } catch (e) {}
221
+ // 退场转场:CSS transition 已在 root 上声明;这里只改目标样式
222
+ try {
223
+ if (root) {
224
+ root.style.opacity = "0";
225
+ if (cfg.transition === "scale") root.style.transform = "scale(1.06)";
226
+ else if (cfg.transition === "slide") root.style.transform = "translateY(-8%)";
227
+ }
228
+ } catch (e) {}
211
229
  setTimeout(function () {
212
230
  try { if (video) { video.pause(); video.removeAttribute("src"); video.load && video.load(); } } catch (e) {}
213
231
  try { if (root && root.parentNode) root.parentNode.removeChild(root); } catch (e) {}
@@ -220,7 +238,7 @@ export const BOOT_SCREEN_SOURCE = String.raw`
220
238
  root.setAttribute("style",
221
239
  "position:fixed;inset:0;z-index:2147483647;background:#000;" +
222
240
  "display:flex;align-items:center;justify-content:center;" +
223
- "transition:opacity " + (cfg.fadeMs || 900) + "ms ease;opacity:1;");
241
+ "transition:opacity " + (cfg.fadeMs || 900) + "ms ease,transform " + (cfg.fadeMs || 900) + "ms ease;opacity:1;transform:none;");
224
242
  video = doc.createElement("video");
225
243
  video.setAttribute("muted", "");
226
244
  video.muted = true;
@@ -232,6 +250,21 @@ export const BOOT_SCREEN_SOURCE = String.raw`
232
250
  video.addEventListener("error", teardown, { once: true });
233
251
  root.appendChild(video);
234
252
  (doc.body || doc.documentElement).appendChild(root);
253
+ // 两幕冷启动:第一幕是纯色 + 一行字,盖在素材上;到时淡出露出第二幕
254
+ try {
255
+ if (cfg.act1 && cfg.act1.enabled) {
256
+ var act1 = doc.createElement("div");
257
+ act1.setAttribute("style",
258
+ "position:absolute;inset:0;background:#000;display:flex;align-items:center;justify-content:center;" +
259
+ "color:#fff;font-size:28px;letter-spacing:2px;transition:opacity 500ms ease;opacity:1;");
260
+ act1.textContent = cfg.act1.text || "";
261
+ root.appendChild(act1);
262
+ setTimeout(function () {
263
+ try { act1.style.opacity = "0"; } catch (e) {}
264
+ setTimeout(function () { try { if (act1.parentNode) act1.parentNode.removeChild(act1); } catch (e) {} }, 520);
265
+ }, Math.max(300, (cfg.act1.durationMs || 1200)));
266
+ }
267
+ } catch (e) {}
235
268
  // 声音:只有用户显式开启才带声;否则静音(否则 Chromium 直接拒绝自动播放)。
236
269
  try {
237
270
  if (cfg.sound) { video.muted = false; video.volume = (typeof cfg.volume === "number" ? cfg.volume : 1); }
@@ -372,6 +405,8 @@ export function installBootInjection(ctx, note) {
372
405
  maxHoldMs: boot.maxHoldMs,
373
406
  enterMode: boot.enterMode,
374
407
  sound: boot.sound,
408
+ transition: boot.transition,
409
+ act1: boot.act1,
375
410
  volume: boot.volume,
376
411
  };
377
412
  table.push({ kind: 'script', placement: 'head', text: 'globalThis.__FOLIA_BOOT__=' + JSON.stringify(cfg) });
package/lib/client.js CHANGED
@@ -764,6 +764,12 @@ window.__ModuleLoader__.load({
764
764
  "对话": "Chat",
765
765
  "可选工作能力(已安装才可用)": "Optional work capabilities (installed only)",
766
766
  "能力": "Capabilities",
767
+ "退场": "Exit",
768
+ "淡出": "Fade",
769
+ "放大淡出": "Scale + fade",
770
+ "上滑淡出": "Slide up + fade",
771
+ "两幕(先显示一行字)": "Two acts (text first)",
772
+ "第一幕显示的文字(如店名/品牌)": "Text shown in act 1 (brand/title)",
767
773
  "导入本地动画": "Import local clip",
768
774
  "支持 mp4 / webm,≤64MB;导入后只在本地,不上传站点": "mp4 / webm, up to 64MB; kept locally, never uploaded",
769
775
  "文件太大(上限 64MB)": "File too large (64MB max)",
@@ -18176,6 +18182,39 @@ window.__ModuleLoader__.load({
18176
18182
  React.createElement("option", { value: "rotate" }, weT("轮换")),
18177
18183
  ),
18178
18184
  ),
18185
+ // 退场转场:默认淡出;放大/上滑让"片尾进界面"更有收束感
18186
+ React.createElement("label", { style: { display: "flex", gap: "4px", alignItems: "center", fontSize: "12px" } },
18187
+ weT("退场"),
18188
+ React.createElement("select", {
18189
+ className: "we-picker__playlist-select",
18190
+ value: String(state.transition || "fade"),
18191
+ disabled: Boolean(busy),
18192
+ onChange: (e) => act("settings", { transition: e.target.value }, ""),
18193
+ },
18194
+ React.createElement("option", { value: "fade" }, weT("淡出")),
18195
+ React.createElement("option", { value: "scale" }, weT("放大淡出")),
18196
+ React.createElement("option", { value: "slide" }, weT("上滑淡出")),
18197
+ ),
18198
+ ),
18199
+ // 两幕冷启动:第一幕纯色 + 一行字
18200
+ React.createElement("label", { style: { display: "flex", gap: "6px", alignItems: "center", fontSize: "12px" } },
18201
+ React.createElement("input", {
18202
+ type: "checkbox",
18203
+ checked: Boolean(state.act1 && state.act1.enabled),
18204
+ disabled: Boolean(busy),
18205
+ onChange: (e) => act("settings", { act1: { enabled: e.target.checked, text: (state.act1 && state.act1.text) || "", durationMs: (state.act1 && state.act1.durationMs) || 1200 } }, ""),
18206
+ }),
18207
+ weT("两幕(先显示一行字)"),
18208
+ ),
18209
+ (state.act1 && state.act1.enabled) ? React.createElement("input", {
18210
+ type: "text",
18211
+ className: "we-picker__input",
18212
+ placeholder: weT("第一幕显示的文字(如店名/品牌)"),
18213
+ defaultValue: (state.act1 && state.act1.text) || "",
18214
+ disabled: Boolean(busy),
18215
+ onBlur: (e) => act("settings", { act1: { enabled: true, text: e.target.value, durationMs: (state.act1 && state.act1.durationMs) || 1200 } }, ""),
18216
+ style: { width: "220px", fontSize: "12px" },
18217
+ }) : null,
18179
18218
  opt(weT("最短显示"), "minShowMs", [[0, weT("不限制")], [600, weT("0.6 秒")], [1200, weT("1.2 秒")], [2000, weT("2 秒")]]),
18180
18219
  opt(weT("最长停留"), "maxHoldMs", [[10000, weT("10 秒")], [20000, weT("20 秒(默认)")], [30000, weT("30 秒")], [60000, weT("60 秒")]]),
18181
18220
  ));
@@ -465,6 +465,8 @@ disposers.push(webServer.register({
465
465
  ...(patch.fadeMs !== undefined ? { fadeMs: Number(patch.fadeMs) } : {}),
466
466
  ...(patch.minShowMs !== undefined ? { minShowMs: Number(patch.minShowMs) } : {}),
467
467
  ...(patch.maxHoldMs !== undefined ? { maxHoldMs: Number(patch.maxHoldMs) } : {}),
468
+ ...(patch.transition !== undefined ? { transition: String(patch.transition) } : {}),
469
+ ...(patch.act1 !== undefined && patch.act1 && typeof patch.act1 === 'object' ? { act1: patch.act1 } : {}),
468
470
  ...(patch.poolMode !== undefined ? { poolMode: String(patch.poolMode) } : {}),
469
471
  });
470
472
  sendJson(res, 200, { ok: true, ...boot });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-folia",
3
- "version": "4.26.0-pre.30",
3
+ "version": "4.26.0-pre.31",
4
4
  "description": "DSH 壁纸引擎:本机 WE 壁纸实时渲染,视频/网页/开机动画/桌宠皮肤,一键拉取在线素材。",
5
5
  "type": "module",
6
6
  "engines": {