dsh-any-background 0.1.9 → 0.2.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 CHANGED
@@ -4,10 +4,18 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
8
7
  let react = require("react");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
10
9
  let react_dom = require("react-dom");
10
+ //#region src/client/runtime.ts
11
+ function resolveStore() {
12
+ try {
13
+ return require("@deepseek-ai/dsh-client-store");
14
+ } catch {}
15
+ return require("@deepseek-ai/dsh-client-runtime/client");
16
+ }
17
+ const defineStore = resolveStore().defineStore;
18
+ //#endregion
11
19
  //#region src/client/i18n.ts
12
20
  const NS = "settings.anyBg";
13
21
  const zh = {
@@ -32,6 +40,7 @@ window.__ModuleLoader__.load({
32
40
  uiOpacityBg: "主背景",
33
41
  uiOpacitySide: "侧边栏",
34
42
  uiOpacityCard: "对话框中选项面板",
43
+ uiOpacityInput: "输入框与控件",
35
44
  uiSop: "设置界面透明度",
36
45
  uiChatRegion: "对话文本框",
37
46
  uiTrajectory: "轨迹页",
@@ -129,6 +138,7 @@ window.__ModuleLoader__.load({
129
138
  uiOpacityBg: "Main background",
130
139
  uiOpacitySide: "Sidebar",
131
140
  uiOpacityCard: "Cards & panels",
141
+ uiOpacityInput: "Input & controls",
132
142
  uiSop: "Settings interface opacity",
133
143
  uiChatRegion: "Conversation text frame",
134
144
  uiTrajectory: "Trajectory view",
@@ -211,7 +221,8 @@ window.__ModuleLoader__.load({
211
221
  opacities: {
212
222
  bg: .85,
213
223
  sidebar: .93,
214
- card: 1
224
+ card: 1,
225
+ input: 1
215
226
  },
216
227
  blurs: {
217
228
  bg: 0,
@@ -219,7 +230,8 @@ window.__ModuleLoader__.load({
219
230
  card: 0,
220
231
  settings: 0,
221
232
  chat: 0,
222
- trajectory: 0
233
+ trajectory: 0,
234
+ input: 0
223
235
  },
224
236
  settingsOpacity: 1,
225
237
  wallpaperOpacity: 1,
@@ -259,6 +271,8 @@ window.__ModuleLoader__.load({
259
271
  let wpVideoUrl = null;
260
272
  /** Captured video frame standing in for previews/color extraction (still-image APIs). */
261
273
  let wpVideoSnapshot = null;
274
+ /** Local blob URL backing an in-session video; revoked when replaced or cleared. */
275
+ let wpVideoObjectUrl = null;
262
276
  function setWpImageUrl(url) {
263
277
  wpImageUrl = url;
264
278
  }
@@ -272,13 +286,25 @@ window.__ModuleLoader__.load({
272
286
  wpVideoSnapshot = null;
273
287
  } else {
274
288
  videoRev++;
275
- wpVideoUrl = `${url}${url.includes("?") ? "&" : "?"}r=${videoRev}`;
289
+ wpVideoUrl = url.startsWith("blob:") ? url : `${url}${url.includes("?") ? "&" : "?"}r=${videoRev}`;
290
+ }
291
+ if (wpVideoObjectUrl !== null && wpVideoObjectUrl !== url) {
292
+ URL.revokeObjectURL(wpVideoObjectUrl);
293
+ wpVideoObjectUrl = null;
276
294
  }
295
+ if (url !== null && url.startsWith("blob:")) wpVideoObjectUrl = url;
277
296
  cfg.videoMime = url ? mime : null;
278
297
  }
279
298
  function setWpVideoSnapshot(url) {
280
299
  wpVideoSnapshot = url;
281
300
  }
301
+ /** Release the in-session video object URL (plugin teardown). */
302
+ function disposeVideoObjectUrl() {
303
+ if (wpVideoObjectUrl !== null) {
304
+ URL.revokeObjectURL(wpVideoObjectUrl);
305
+ wpVideoObjectUrl = null;
306
+ }
307
+ }
282
308
  function setBgState(s) {
283
309
  cfg.bgState = s;
284
310
  }
@@ -326,7 +352,8 @@ window.__ModuleLoader__.load({
326
352
  for (const k of [
327
353
  "bg",
328
354
  "sidebar",
329
- "card"
355
+ "card",
356
+ "input"
330
357
  ]) out[k] = clamp01(o[k], DEFAULT_CONFIG.opacities[k]);
331
358
  return out;
332
359
  }
@@ -339,7 +366,8 @@ window.__ModuleLoader__.load({
339
366
  "card",
340
367
  "settings",
341
368
  "chat",
342
- "trajectory"
369
+ "trajectory",
370
+ "input"
343
371
  ]) {
344
372
  const v = b[k];
345
373
  out[k] = typeof v === "number" ? Math.min(60, Math.max(0, v)) : DEFAULT_CONFIG.blurs[k];
@@ -390,7 +418,8 @@ window.__ModuleLoader__.load({
390
418
  "card",
391
419
  "settings",
392
420
  "chat",
393
- "trajectory"
421
+ "trajectory",
422
+ "input"
394
423
  ]) blurs[k] = num(bl[k], DEFAULT_CONFIG.blurs[k]);
395
424
  const bgType = [
396
425
  "video",
@@ -412,7 +441,8 @@ window.__ModuleLoader__.load({
412
441
  opacities: {
413
442
  bg: num(ops.bg, legacy ?? DEFAULT_CONFIG.opacities.bg),
414
443
  sidebar: num(ops.sidebar, legacy !== null ? Math.min(1, legacy + .08) : DEFAULT_CONFIG.opacities.sidebar),
415
- card: num(ops.card, DEFAULT_CONFIG.opacities.card)
444
+ card: num(ops.card, DEFAULT_CONFIG.opacities.card),
445
+ input: num(ops.input, DEFAULT_CONFIG.opacities.input)
416
446
  },
417
447
  blurs,
418
448
  settingsOpacity: num(c.settingsOpacity, DEFAULT_CONFIG.settingsOpacity),
@@ -588,30 +618,76 @@ window.__ModuleLoader__.load({
588
618
  "--dsw-alias-bg-layer-2": hsl(h(0), s(0), l(.07)),
589
619
  "--dsw-alias-bg-layer-3": hsl(h(0), s(-.05), l(.12)),
590
620
  "--dsw-alias-bg-overlay": hsl(h(0), s(-.05), l(.12)),
621
+ "--dsw-alias-bg-module-platform": hsl(h(0), s(0), l(.05)),
622
+ "--dsw-alias-bg-multi-select": hsl(h(0), s(0), l(.1)),
623
+ "--dsw-alias-bg-skeleton": "rgba(255,255,255,0.08)",
591
624
  "--dsw-alias-border-l1": rgba(h(0), s(-.1), l(.18), .12),
592
625
  "--dsw-alias-border-l2": rgba(h(0), s(-.1), l(.22), .22),
626
+ "--dsw-alias-border-l3": "rgba(255,255,255,0.16)",
627
+ "--dsw-alias-border-l4": "rgba(255,255,255,0.2)",
628
+ "--dsw-alias-border-inverted": "rgba(255,255,255,0.06)",
593
629
  "--dsw-alias-label-primary": hsl(0, 0, 1),
594
- "--dsw-alias-label-secondary": hsl(0, 0, 1),
595
- "--dsw-alias-label-tertiary": hsl(0, 0, 1),
596
- "--dsw-alias-label-caption": hsl(0, 0, 1),
597
- "--dsw-alias-label-dimmed": hsl(0, 0, 1),
598
- "--dsw-alias-label-quaternary": hsl(0, 0, 1),
630
+ "--dsw-alias-label-secondary": "rgba(255,255,255,0.85)",
631
+ "--dsw-alias-label-tertiary": "rgba(255,255,255,0.7)",
632
+ "--dsw-alias-label-caption": "rgba(255,255,255,0.5)",
633
+ "--dsw-alias-label-dimmed": "rgba(255,255,255,0.35)",
634
+ "--dsw-alias-label-quaternary": "rgba(255,255,255,0.25)",
635
+ "--dsw-alias-label-primary-dimmed": "rgba(255,255,255,0.92)",
636
+ "--dsw-alias-label-primary-foreground": hsl(0, 0, 1),
637
+ "--dsw-alias-label-primary-inverted": hsl(h(0), s(.08), Math.min(l(.06), .16)),
638
+ "--dsw-alias-label-primary-bluish": hsl(0, 0, 1),
599
639
  "--dsw-alias-brand-primary": hsl(h(0), s(.1), Math.max(l(.2), .5)),
600
640
  "--dsw-alias-brand-text": l(.2) > .6 ? "#000" : "#fff",
641
+ "--dsw-alias-button-primary-fill": hsl(h(0), s(.1), Math.max(l(.2), .5)),
601
642
  "--dsw-alias-button-primary-hover": hsl(h(0), s(.1), Math.max(l(.28), .58)),
602
643
  "--dsw-alias-button-primary-dimmed": hsl(h(0), s(0), l(.07)),
603
644
  "--dsw-alias-button-elevated-fill": hsl(h(0), s(0), l(.04)),
645
+ "--dsw-alias-button-floating-fill": hsl(h(0), s(0), l(.02)),
646
+ "--dsw-alias-button-floating-hover": hsl(h(0), s(0), l(.1)),
647
+ "--dsw-alias-button-tool-bar-fill": "rgba(255,255,255,0.08)",
648
+ "--dsw-alias-button-tool-bar-hover": "rgba(255,255,255,0.12)",
649
+ "--dsw-alias-button-ghost-active-fill": hsl(h(0), s(0), l(.06)),
650
+ "--dsw-alias-button-ghost-active-border": "rgba(255,255,255,0.16)",
651
+ "--dsw-alias-button-ghost-active-hover": hsl(h(0), s(0), l(.09)),
652
+ "--dsw-alias-button-info-fill": "#679efe",
653
+ "--dsw-alias-button-info-hover": "#4176e6",
654
+ "--dsw-alias-button-contrast-fill": hsl(0, 0, 1),
604
655
  "--dsw-alias-interactive-bg-hover": rgba(h(0), s(0), Math.max(l(.15), .4), .12),
656
+ "--dsw-alias-interactive-bg-hover-solid": rgba(h(0), s(0), Math.max(l(.15), .4), .16),
657
+ "--dsw-alias-interactive-bg-hover-accent": "rgba(255,255,255,0.24)",
658
+ "--dsw-alias-interactive-bg-hover-danger": "rgba(242,90,90,0.15)",
605
659
  "--dsw-alias-interactive-bg-active": rgba(h(0), s(0), Math.max(l(.15), .4), .2),
606
660
  "--dsw-alias-markdown-code-block": hsl(h(0), s(0), l(-.06)),
661
+ "--dsw-alias-markdown-code-block-banner": hsl(h(0), s(0), l(-.02)),
607
662
  "--dsw-alias-markdown-inline-code": hsl(h(0), s(0), l(.04)),
663
+ "--dsw-alias-markdown-placeholder": hsl(h(0), s(0), l(-.02)),
664
+ "--dsw-alias-markdown-tag": hsl(h(0), s(0), l(.05)),
665
+ "--dsw-alias-markdown-citation": hsl(h(0), s(0), l(.06)),
666
+ "--dsw-alias-markdown-code-segment-selected": hsl(h(0), s(0), l(.05)),
667
+ "--dsw-alias-markdown-code-segment-unselected": hsl(h(0), s(0), l(-.05)),
608
668
  "--dsw-alias-state-error-primary": "#ff5c72",
669
+ "--dsw-alias-state-error-secondary": "#ff8aa0",
609
670
  "--dsw-alias-state-success-primary": "#3ddc84",
671
+ "--dsw-alias-state-success-secondary": "#69eea4",
672
+ "--dsw-alias-state-success-tertiary": "hsl(152,70%,62%)",
610
673
  "--dsw-alias-state-warn-primary": "#ffb347",
674
+ "--dsw-alias-state-warn-secondary": "#ffc980",
675
+ "--dsw-alias-state-warn-tertiary": "#dd8629",
676
+ "--dsw-alias-state-warn-label": "#dd8629",
677
+ "--dsw-alias-state-business-primary": "#679efe",
678
+ "--dsw-alias-state-business-tertiary": "#6f7fa8",
611
679
  "--dsw-specific-sidebar-fill": hsl(h(0), s(0), l(-.06)),
612
680
  "--dsw-specific-sidebar-nav-item-active": hsl(h(0), s(0), l(.04)),
613
681
  "--dsw-specific-sidebar-nav-item-hover": hsl(h(0), s(0), l(0)),
614
682
  "--dsw-specific-input-major": hsl(h(0), s(0), l(.02)),
683
+ "--dsw-specific-menu": hsl(h(0), s(0), l(.08)),
684
+ "--dsw-specific-bubble": hsl(h(0), s(0), l(.03)),
685
+ "--dsw-specific-bubble-highlight": hsl(h(0), s(0), l(.08)),
686
+ "--dsw-specific-selector": hsl(h(0), s(0), l(.05)),
687
+ "--dsw-specific-login-input": hsl(h(0), s(0), l(.03)),
688
+ "--dsw-specific-tip": hsl(h(0), s(0), l(.05)),
689
+ "--dsw-alias-toast-bg": hsl(h(0), s(0), l(.08)),
690
+ "--dsw-alias-tooltip-bg": hsl(h(0), s(0), l(.08)),
615
691
  "--dsw-alias-scrollbar-bg-l1": hsl(h(0), s(-.05), l(.12)),
616
692
  "--dsw-alias-scrollbar-bg-l2": hsl(h(0), s(-.05), l(.16)),
617
693
  "--dsw-alias-scrollbar-hover-l1": hsl(h(0), s(-.05), l(.22)),
@@ -629,16 +705,17 @@ window.__ModuleLoader__.load({
629
705
  "--dsw-alias-border-l1": rgba(h(0), s(-.15), l(-.35), .18),
630
706
  "--dsw-alias-border-l2": rgba(h(0), s(-.15), l(-.35), .3),
631
707
  "--dsw-alias-label-primary": hsl(0, 0, 0),
632
- "--dsw-alias-label-secondary": hsl(0, 0, 0),
633
- "--dsw-alias-label-tertiary": hsl(0, 0, 0),
634
- "--dsw-alias-label-caption": hsl(0, 0, 0),
635
- "--dsw-alias-label-dimmed": hsl(0, 0, 0),
636
- "--dsw-alias-label-quaternary": hsl(0, 0, 0),
708
+ "--dsw-alias-label-secondary": "rgba(0,0,0,0.85)",
709
+ "--dsw-alias-label-tertiary": "rgba(0,0,0,0.7)",
710
+ "--dsw-alias-label-caption": "rgba(0,0,0,0.5)",
711
+ "--dsw-alias-label-dimmed": "rgba(0,0,0,0.35)",
712
+ "--dsw-alias-label-quaternary": "rgba(0,0,0,0.25)",
637
713
  "--dsw-alias-brand-primary": hsl(h(0), s(.05), Math.min(l(-.18), .45)),
638
714
  "--dsw-alias-brand-text": "#fff",
639
715
  "--dsw-alias-button-primary-hover": hsl(h(0), s(.05), Math.min(l(-.12), .5)),
640
716
  "--dsw-alias-button-primary-dimmed": hsl(h(0), s(-.1), l(-.03)),
641
717
  "--dsw-alias-button-elevated-fill": hsl(h(0), s(-.1), l(.1)),
718
+ "--dsw-alias-button-floating-hover": hsl(h(0), s(-.1), l(.16)),
642
719
  "--dsw-alias-interactive-bg-hover": rgba(h(0), s(0), l(-.3), .08),
643
720
  "--dsw-alias-interactive-bg-active": rgba(h(0), s(0), l(-.3), .14),
644
721
  "--dsw-alias-markdown-code-block": hsl(h(0), s(-.1), l(-.03)),
@@ -647,6 +724,7 @@ window.__ModuleLoader__.load({
647
724
  "--dsw-specific-sidebar-nav-item-active": hsl(h(0), s(-.08), l(.05)),
648
725
  "--dsw-specific-sidebar-nav-item-hover": hsl(h(0), s(-.12), l(0)),
649
726
  "--dsw-specific-input-major": hsl(h(0), s(-.12), l(.1)),
727
+ "--dsw-specific-menu": hsl(h(0), s(-.12), l(.15)),
650
728
  "--dsw-alias-scrollbar-bg-l1": hsl(h(0), s(-.1), l(-.08)),
651
729
  "--dsw-alias-scrollbar-bg-l2": hsl(h(0), s(-.08), l(-.12)),
652
730
  "--dsw-alias-scrollbar-hover-l1": hsl(h(0), s(-.08), l(-.16)),
@@ -1463,16 +1541,63 @@ window.__ModuleLoader__.load({
1463
1541
  for (const name of appliedTokenNames) document.body.style.removeProperty(name);
1464
1542
  appliedTokenNames = [];
1465
1543
  }
1466
- /** Label tokens flipped by the generated-background brightness verdict. */
1544
+ /** Label tokens flipped by the generated-background brightness verdict. The
1545
+ * faint tiers (caption/dimmed) are deliberately NOT flipped: they back
1546
+ * placeholder/hint text, which must stay visibly weaker than real input even
1547
+ * when the wallpaper brightness flips the main label direction. */
1467
1548
  const LABEL_TOKENS = [
1468
1549
  "--dsw-alias-label-primary",
1469
1550
  "--dsw-alias-label-secondary",
1470
- "--dsw-alias-label-tertiary",
1471
- "--dsw-alias-label-caption",
1472
- "--dsw-alias-label-dimmed",
1473
- "--dsw-alias-label-quaternary"
1551
+ "--dsw-alias-label-tertiary"
1474
1552
  ];
1553
+ const OPACITY_TOKEN_GROUPS = [
1554
+ {
1555
+ part: "bg",
1556
+ names: ["--dsw-alias-bg-base"]
1557
+ },
1558
+ {
1559
+ part: "sidebar",
1560
+ names: ["--dsw-specific-sidebar-fill"]
1561
+ },
1562
+ {
1563
+ part: "card",
1564
+ names: [
1565
+ "--dsw-alias-bg-layer-1",
1566
+ "--dsw-alias-bg-layer-2",
1567
+ "--dsw-alias-bg-layer-3",
1568
+ "--dsw-specific-menu"
1569
+ ]
1570
+ },
1571
+ {
1572
+ part: "input",
1573
+ names: ["--dsw-specific-input-major"]
1574
+ }
1575
+ ];
1576
+ const OPACITY_VARS = {
1577
+ "--dsw-alias-bg-base": "--dsh-any-op-bg",
1578
+ "--dsw-specific-sidebar-fill": "--dsh-any-op-sidebar",
1579
+ "--dsw-alias-bg-layer-1": "--dsh-any-op-card-1",
1580
+ "--dsw-alias-bg-layer-2": "--dsh-any-op-card-2",
1581
+ "--dsw-alias-bg-layer-3": "--dsh-any-op-card-3",
1582
+ "--dsw-specific-input-major": "--dsh-any-op-input",
1583
+ "--dsw-specific-menu": "--dsh-any-op-menu"
1584
+ };
1585
+ let baseTokenKey = "";
1586
+ let pendingOps = null;
1587
+ let tokensRaf = null;
1475
1588
  function applyCustomTokens(ops) {
1589
+ pendingOps = ops;
1590
+ if (tokensRaf !== null) return;
1591
+ tokensRaf = requestAnimationFrame(() => {
1592
+ tokensRaf = null;
1593
+ if (pendingOps === null) return;
1594
+ const o = pendingOps;
1595
+ pendingOps = null;
1596
+ applyCustomTokensNow(o);
1597
+ });
1598
+ }
1599
+ let lastBgKey = "";
1600
+ function applyCustomTokensNow(ops) {
1476
1601
  const [h, s, l] = rColor();
1477
1602
  let { tokens } = genTokens(h, s, l);
1478
1603
  try {
@@ -1482,24 +1607,37 @@ window.__ModuleLoader__.load({
1482
1607
  const font = dark ? "#fff" : "#000";
1483
1608
  for (const name of LABEL_TOKENS) tokens[name] = font;
1484
1609
  }
1485
- if (dark ?? l < .55) document.body.setAttribute("data-ds-dark-theme", "dsh-any-background");
1486
- else document.body.removeAttribute("data-ds-dark-theme");
1487
- const decls = [];
1488
- for (const [name, value] of Object.entries(tokens)) {
1489
- let v = value;
1490
- if (name === "--dsw-alias-bg-base") v = toRgba(value, ops.bg);
1491
- else if (name === "--dsw-specific-sidebar-fill") v = toRgba(value, ops.sidebar);
1492
- else if (name === "--dsw-alias-bg-layer-1" || name === "--dsw-alias-bg-layer-2" || name === "--dsw-alias-bg-layer-3") v = toRgba(value, ops.card);
1493
- decls.push(`${name}:${v}!important`);
1610
+ const forceDark = dark ?? l < .55;
1611
+ if (`${h}|${s}|${l}|${dark}` !== baseTokenKey) {
1612
+ baseTokenKey = `${h}|${s}|${l}|${dark}`;
1613
+ if (forceDark) document.body.setAttribute("data-ds-dark-theme", "dsh-any-background");
1614
+ else document.body.removeAttribute("data-ds-dark-theme");
1615
+ const decls = [`color-scheme:${forceDark ? "dark" : "light"}`];
1616
+ for (const [name, value] of Object.entries(tokens)) {
1617
+ const opVar = OPACITY_VARS[name];
1618
+ decls.push(`${name}:${opVar !== void 0 ? `var(${opVar})` : value}!important`);
1619
+ }
1620
+ ensureTokenStyle().textContent = `body{${decls.join(";")}}`;
1621
+ for (const name of appliedTokenNames) document.body.style.removeProperty(name);
1622
+ appliedTokenNames = Object.keys(tokens);
1623
+ }
1624
+ const root = document.documentElement;
1625
+ for (const g of OPACITY_TOKEN_GROUPS) for (const name of g.names) root.style.setProperty(OPACITY_VARS[name], toRgba(tokens[name] ?? "#000", ops[g.part]));
1626
+ root.style.setProperty("--dsh-any-op-menu-cordis", toRgba(tokens["--dsw-specific-menu"] ?? "#000", ops.input));
1627
+ const bgKey = `${baseTokenKey}|${ops.bg}`;
1628
+ if (bgKey !== lastBgKey) {
1629
+ lastBgKey = bgKey;
1630
+ applyPartOpacities(ops);
1494
1631
  }
1495
- ensureTokenStyle().textContent = `body{${decls.join(";")}}`;
1496
- for (const name of appliedTokenNames) document.body.style.removeProperty(name);
1497
- appliedTokenNames = Object.keys(tokens);
1498
- applyPartOpacities(ops);
1499
1632
  } catch {}
1500
1633
  }
1501
1634
  const SETTINGS_PANEL_SEL = "[role=\"dialog\"][aria-modal=\"true\"][aria-labelledby]";
1502
1635
  const SETTINGS_STYLE_RULE = `${SETTINGS_PANEL_SEL}{background:var(--dsh-any-bg-settings-surface,var(--dsw-alias-bg-layer-2));backdrop-filter:var(--dsh-any-blur-settings,none);--dsw-alias-bg-layer-1:var(--dsh-any-bg-settings-layer-1);--dsw-alias-bg-layer-2:var(--dsh-any-bg-settings-layer-2);--dsw-alias-bg-layer-3:var(--dsh-any-bg-settings-layer-3)}${SETTINGS_PANEL_SEL} .dab-card{backdrop-filter:var(--dsh-any-blur-card-panels,none);-webkit-backdrop-filter:var(--dsh-any-blur-card-panels,none)}`;
1636
+ const INPUT_BLUR_RULE = "[data-composer-card],[data-cordis-panel]{-webkit-backdrop-filter:var(--dsh-any-input-blur,none);backdrop-filter:var(--dsh-any-input-blur,none)}[data-cordis-panel]{--dsw-specific-menu:var(--dsh-any-op-menu-cordis)!important}";
1637
+ function applyInputBlur(px) {
1638
+ if (px > 0) document.documentElement.style.setProperty("--dsh-any-input-blur", `blur(${px}px)`);
1639
+ else document.documentElement.style.removeProperty("--dsh-any-input-blur");
1640
+ }
1503
1641
  function applySettingsOverrides(op) {
1504
1642
  const [h, s, l] = rColor();
1505
1643
  const tokens = genTokens(h, s, l).tokens;
@@ -1688,6 +1826,7 @@ window.__ModuleLoader__.load({
1688
1826
  setBlur(detailsEl, blurs.bg);
1689
1827
  applyCardPanelsBlur(blurs.card);
1690
1828
  applySettingsBlur(blurs.settings);
1829
+ applyInputBlur(blurs.input);
1691
1830
  applyViewCards();
1692
1831
  }
1693
1832
  /** Live per-part blur update during slider drag (no full re-apply). */
@@ -1700,6 +1839,10 @@ window.__ModuleLoader__.load({
1700
1839
  applyCardPanelsBlur(v);
1701
1840
  return;
1702
1841
  }
1842
+ if (part === "input") {
1843
+ applyInputBlur(v);
1844
+ return;
1845
+ }
1703
1846
  if (part === "chat" || part === "trajectory") {
1704
1847
  applyViewCards();
1705
1848
  return;
@@ -1889,6 +2032,42 @@ window.__ModuleLoader__.load({
1889
2032
  partsObserver?.disconnect();
1890
2033
  partsObserver = null;
1891
2034
  }
2035
+ let themeObserver = null;
2036
+ let themeRaf = 0;
2037
+ function reassertScheme() {
2038
+ const [, , l] = rColor();
2039
+ if (rBgDark() ?? l < .55) document.body.setAttribute("data-ds-dark-theme", "dsh-any-background");
2040
+ else document.body.removeAttribute("data-ds-dark-theme");
2041
+ applyCustomTokens(rOps());
2042
+ }
2043
+ /** Re-assert the plugin's forced scheme whenever the host strips it, so a
2044
+ * refresh / cold-load / set-change never flashes a light frame. Returns a
2045
+ * disposer for teardown. */
2046
+ function watchThemeResets() {
2047
+ if (themeObserver !== null || typeof MutationObserver === "undefined") return () => void 0;
2048
+ themeObserver = new MutationObserver(() => {
2049
+ if (document.body.getAttribute("data-ds-dark-theme") === "dsh-any-background") return;
2050
+ if (!(rHasColor() || rBgDark() !== null)) return;
2051
+ if (themeRaf !== 0) return;
2052
+ themeRaf = requestAnimationFrame(() => {
2053
+ themeRaf = 0;
2054
+ if (document.body.getAttribute("data-ds-dark-theme") === "dsh-any-background") return;
2055
+ reassertScheme();
2056
+ });
2057
+ });
2058
+ themeObserver.observe(document.body, {
2059
+ attributes: true,
2060
+ attributeFilter: ["data-ds-dark-theme"]
2061
+ });
2062
+ themeObserver.observe(document.documentElement, {
2063
+ attributes: true,
2064
+ attributeFilter: ["data-ds-dark-theme"]
2065
+ });
2066
+ return () => {
2067
+ themeObserver?.disconnect();
2068
+ themeObserver = null;
2069
+ };
2070
+ }
1892
2071
  function ensureWpContainer() {
1893
2072
  if (!wpEl || !document.body.contains(wpEl)) {
1894
2073
  wpEl = document.createElement("div");
@@ -1923,6 +2102,78 @@ window.__ModuleLoader__.load({
1923
2102
  img.onerror = () => cb(0, 0);
1924
2103
  img.src = url;
1925
2104
  }
2105
+ const DRAG_MAX_SIDE = 720;
2106
+ let lowResUrl = null;
2107
+ let lowResFor = "";
2108
+ let dragLow = false;
2109
+ function captureLowRes(url, cb) {
2110
+ if (lowResFor === url) {
2111
+ cb(lowResUrl);
2112
+ return;
2113
+ }
2114
+ const img = new Image();
2115
+ img.onload = () => {
2116
+ const k = Math.min(1, DRAG_MAX_SIDE / Math.max(img.naturalWidth, img.naturalHeight));
2117
+ if (k >= 1) {
2118
+ lowResFor = url;
2119
+ lowResUrl = null;
2120
+ cb(null);
2121
+ return;
2122
+ }
2123
+ const c = document.createElement("canvas");
2124
+ c.width = Math.max(1, Math.round(img.naturalWidth * k));
2125
+ c.height = Math.max(1, Math.round(img.naturalHeight * k));
2126
+ const g = c.getContext("2d");
2127
+ if (!g) {
2128
+ lowResFor = url;
2129
+ lowResUrl = null;
2130
+ cb(null);
2131
+ return;
2132
+ }
2133
+ g.drawImage(img, 0, 0, c.width, c.height);
2134
+ const low = c.toDataURL("image/jpeg", .85);
2135
+ lowResFor = url;
2136
+ lowResUrl = low;
2137
+ cb(low);
2138
+ };
2139
+ img.onerror = () => cb(null);
2140
+ img.src = url;
2141
+ }
2142
+ function setDragLow(on) {
2143
+ if (cfg.backgroundType !== "image" || on === dragLow || !wpEl) return;
2144
+ const full = rWpImage();
2145
+ if (!full) return;
2146
+ if (on) {
2147
+ dragLow = true;
2148
+ captureLowRes(full, (low) => {
2149
+ if (!dragLow || !wpEl || low === null) return;
2150
+ if (wpEl.style.backgroundImage !== `url("${low}")`) wpEl.style.backgroundImage = `url("${low}")`;
2151
+ });
2152
+ } else {
2153
+ dragLow = false;
2154
+ if (wpEl.style.backgroundImage !== `url("${full}")`) wpEl.style.backgroundImage = `url("${full}")`;
2155
+ }
2156
+ }
2157
+ /** While any range slider in the app is being dragged, run the wallpaper at
2158
+ * reduced resolution; restore on release. Returns a disposer for teardown. */
2159
+ function watchWallpaperDragQuality() {
2160
+ const isRange = (t) => t instanceof HTMLInputElement && t.type === "range";
2161
+ const down = (e) => {
2162
+ if (isRange(e.target)) setDragLow(true);
2163
+ };
2164
+ const up = () => {
2165
+ if (dragLow) setDragLow(false);
2166
+ };
2167
+ window.addEventListener("pointerdown", down, true);
2168
+ window.addEventListener("pointerup", up, true);
2169
+ window.addEventListener("pointercancel", up, true);
2170
+ return () => {
2171
+ window.removeEventListener("pointerdown", down, true);
2172
+ window.removeEventListener("pointerup", up, true);
2173
+ window.removeEventListener("pointercancel", up, true);
2174
+ if (dragLow) setDragLow(false);
2175
+ };
2176
+ }
1926
2177
  function applyImageWp(url) {
1927
2178
  clearDynamicBg();
1928
2179
  clearVideoEl();
@@ -1967,6 +2218,7 @@ window.__ModuleLoader__.load({
1967
2218
  }
1968
2219
  });
1969
2220
  }
2221
+ captureLowRes(url, () => void 0);
1970
2222
  applyWpEffects();
1971
2223
  }
1972
2224
  /** Video wallpaper: a muted looping <video> inside the wallpaper layer.
@@ -1982,11 +2234,12 @@ window.__ModuleLoader__.load({
1982
2234
  videoEl.loop = true;
1983
2235
  videoEl.autoplay = true;
1984
2236
  videoEl.playsInline = true;
2237
+ videoEl.preload = "auto";
1985
2238
  videoEl.setAttribute("playsinline", "");
1986
2239
  videoEl.style.cssText = "position:absolute;inset:0;width:100%;height:100%;object-position:center;";
2240
+ wpEl.appendChild(videoEl);
1987
2241
  videoEl.setAttribute("src", url);
1988
2242
  videoEl.play().catch(() => void 0);
1989
- wpEl.appendChild(videoEl);
1990
2243
  } else if (videoEl.getAttribute("src") !== url) {
1991
2244
  videoEl.setAttribute("src", url);
1992
2245
  videoEl.play().catch(() => void 0);
@@ -2047,6 +2300,7 @@ window.__ModuleLoader__.load({
2047
2300
  function teardownWp() {
2048
2301
  clearDynamicBg();
2049
2302
  clearVideoEl();
2303
+ disposeVideoObjectUrl();
2050
2304
  setBgDark(null);
2051
2305
  wpEl?.remove();
2052
2306
  wpEl = null;
@@ -2054,6 +2308,8 @@ window.__ModuleLoader__.load({
2054
2308
  tokenStyleEl?.remove();
2055
2309
  tokenStyleEl = null;
2056
2310
  removeViewCards();
2311
+ document.body.removeAttribute("data-ds-dark-theme");
2312
+ document.body.style.removeProperty("color-scheme");
2057
2313
  document.documentElement.style.removeProperty("--dsh-any-bg-settings-surface");
2058
2314
  document.documentElement.style.removeProperty("--dsh-any-bg-settings-layer-1");
2059
2315
  document.documentElement.style.removeProperty("--dsh-any-bg-settings-layer-2");
@@ -2064,6 +2320,15 @@ window.__ModuleLoader__.load({
2064
2320
  document.documentElement.style.removeProperty("--dsh-any-bg-settings-card-surface");
2065
2321
  document.documentElement.style.removeProperty("--dsh-any-blur-settings");
2066
2322
  document.documentElement.style.removeProperty("--dsh-any-blur-card-panels");
2323
+ document.documentElement.style.removeProperty("--dsh-any-input-blur");
2324
+ for (const v of Object.values(OPACITY_VARS)) document.documentElement.style.removeProperty(v);
2325
+ baseTokenKey = "";
2326
+ lastBgKey = "";
2327
+ if (tokensRaf !== null) {
2328
+ cancelAnimationFrame(tokensRaf);
2329
+ tokensRaf = null;
2330
+ }
2331
+ pendingOps = null;
2067
2332
  setBlur(frameEl, 0);
2068
2333
  setBlur(sidebarEl, 0);
2069
2334
  setBlur(centerEl, 0);
@@ -2589,6 +2854,17 @@ window.__ModuleLoader__.load({
2589
2854
  r: "2.1"
2590
2855
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 1.7v1.8M8 12.5v1.8M1.7 8h1.8M12.5 8h1.8M3.6 3.6l1.3 1.3M11.1 11.1l1.3 1.3M12.4 3.6l-1.3 1.3M4.9 11.1l-1.3 1.3" })]
2591
2856
  });
2857
+ const InputIcon = ({ size, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Glyph, {
2858
+ size,
2859
+ className,
2860
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
2861
+ x: "2.2",
2862
+ y: "4",
2863
+ width: "11.6",
2864
+ height: "8",
2865
+ rx: "2"
2866
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 6.6v2M7 8h2" })]
2867
+ });
2592
2868
  //#endregion
2593
2869
  //#region src/client/components/ErrorBoundary.tsx
2594
2870
  /**
@@ -3482,6 +3758,11 @@ window.__ModuleLoader__.load({
3482
3758
  labelKey: "uiOpacityCard",
3483
3759
  Icon: ChatIcon
3484
3760
  },
3761
+ {
3762
+ opKey: "input",
3763
+ labelKey: "uiOpacityInput",
3764
+ Icon: InputIcon
3765
+ },
3485
3766
  {
3486
3767
  isSettings: true,
3487
3768
  labelKey: "uiSop",
@@ -4556,16 +4837,18 @@ window.__ModuleLoader__.load({
4556
4837
  }, "dsh-any-background: skin dispose");
4557
4838
  const styleEl = document.createElement("style");
4558
4839
  styleEl.dataset.plugin = "dsh-any-background";
4559
- styleEl.textContent = `body[data-ds-dark-theme="dsh-any-background"]::before{content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(255,255,255,0.03) 0%,transparent 60%)}${SETTINGS_STYLE_RULE}${TRAJECTORY_STYLE_RULE}`;
4840
+ styleEl.textContent = `body[data-ds-dark-theme="dsh-any-background"]::before{content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(255,255,255,0.03) 0%,transparent 60%)}${SETTINGS_STYLE_RULE}${TRAJECTORY_STYLE_RULE}${INPUT_BLUR_RULE}[data-composer-card] textarea::placeholder,[data-composer-card] input::placeholder,[data-composer-card] [contenteditable]::placeholder,[data-cordis-panel] input::placeholder,[data-cordis-panel] textarea::placeholder,.dab-input::placeholder,.dab-input textarea::placeholder,.dab-input input::placeholder{color:var(--dsh-any-placeholder,var(--dsw-alias-label-caption,#8a8f98))!important;font-style:italic;opacity:.85}`;
4560
4841
  document.head.appendChild(styleEl);
4561
4842
  ctx.effect(() => () => {
4562
4843
  styleEl?.parentNode?.removeChild(styleEl);
4563
4844
  }, "dsh-any-background: gradient");
4845
+ const disposeDragQuality = watchWallpaperDragQuality();
4846
+ ctx.effect(() => () => disposeDragQuality(), "dsh-any-background: drag quality");
4564
4847
  let rev = 0;
4565
4848
  let colorRev = 0;
4566
4849
  let bgRev = 0;
4567
4850
  const colorTimerRef = { current: null };
4568
- const store = (0, _deepseek_ai_dsh_client_runtime_client.defineStore)({
4851
+ const store = defineStore({
4569
4852
  init: () => ({
4570
4853
  url: null,
4571
4854
  rev: -1,
@@ -4675,6 +4958,25 @@ window.__ModuleLoader__.load({
4675
4958
  const sectionInject = (actions) => {
4676
4959
  bound = actions;
4677
4960
  syncBg();
4961
+ const playVideoFromBlob = (blob, mime) => {
4962
+ const localUrl = URL.createObjectURL(blob);
4963
+ cfg.backgroundType = "video";
4964
+ setWpUrl(null);
4965
+ cfg.videoBgState = { ...DEFAULT_CONFIG.bgState };
4966
+ setWpVideoUrl(localUrl, mime ?? blob.type ?? "video/mp4");
4967
+ applyWp();
4968
+ syncBg();
4969
+ const applied = rWpVideo();
4970
+ captureVideoSnapshot(localUrl).then((snap) => {
4971
+ if (rWpVideo() !== applied) return;
4972
+ setWpVideoSnapshot(snap);
4973
+ applyThemeColor();
4974
+ syncBg();
4975
+ });
4976
+ uploadVideo(blob, mime ?? blob.type ?? "video/mp4").then((ok) => {
4977
+ if (ok) persistConfig();
4978
+ });
4979
+ };
4678
4980
  const [wh, ws, wl] = rColor();
4679
4981
  const [dh, ds, dv] = hslToHsv(wh, ws, wl);
4680
4982
  return {
@@ -4729,15 +5031,15 @@ window.__ModuleLoader__.load({
4729
5031
  saveConfig();
4730
5032
  return;
4731
5033
  }
4732
- let ok;
4733
- if (typeof u === "string") ok = await persistVideo(u);
4734
- else ok = await uploadVideo(u, mime ?? u.type ?? "video/mp4");
4735
- const live = ok ? VIDEO_SERVE_URL : typeof u === "string" ? u : null;
4736
- if (live === null) return;
5034
+ if (typeof u !== "string") {
5035
+ playVideoFromBlob(u, mime);
5036
+ return;
5037
+ }
5038
+ const live = await persistVideo(u) ? VIDEO_SERVE_URL : u;
4737
5039
  cfg.backgroundType = "video";
4738
5040
  setWpUrl(null);
4739
5041
  cfg.videoBgState = { ...DEFAULT_CONFIG.bgState };
4740
- setWpVideoUrl(live, mime ?? (typeof u === "string" ? null : u.type) ?? null);
5042
+ setWpVideoUrl(live, mime ?? null);
4741
5043
  applyWp();
4742
5044
  saveConfig();
4743
5045
  syncBg();
@@ -4854,24 +5156,25 @@ window.__ModuleLoader__.load({
4854
5156
  if (cfg.backgroundType === "video") {
4855
5157
  const video = typeof d.video === "string" && /^data:video\//.test(d.video) ? d.video : null;
4856
5158
  if (video !== null) {
4857
- let ok = false;
5159
+ let blob = null;
4858
5160
  try {
4859
- const blob = await fetch(video).then((r) => r.blob());
4860
- ok = await uploadVideo(blob, cfg.videoMime ?? blob.type ?? "video/mp4");
5161
+ blob = await fetch(video).then((r) => r.blob());
4861
5162
  } catch {
4862
- ok = false;
5163
+ blob = null;
5164
+ }
5165
+ if (blob !== null) playVideoFromBlob(blob, cfg.videoMime);
5166
+ else {
5167
+ const live = await persistVideo(video) ? VIDEO_SERVE_URL : video;
5168
+ setWpVideoUrl(live, cfg.videoMime);
5169
+ applyWp();
5170
+ const applied = rWpVideo();
5171
+ captureVideoSnapshot(live).then((snap) => {
5172
+ if (rWpVideo() !== applied) return;
5173
+ setWpVideoSnapshot(snap);
5174
+ applyThemeColor();
5175
+ syncBg();
5176
+ });
4863
5177
  }
4864
- if (!ok) ok = await persistVideo(video);
4865
- const live = ok ? VIDEO_SERVE_URL : video;
4866
- setWpVideoUrl(live, cfg.videoMime);
4867
- applyWp();
4868
- const applied = rWpVideo();
4869
- captureVideoSnapshot(live).then((snap) => {
4870
- if (rWpVideo() !== applied) return;
4871
- setWpVideoSnapshot(snap);
4872
- applyThemeColor();
4873
- syncBg();
4874
- });
4875
5178
  } else {
4876
5179
  setWpVideoUrl(null, null);
4877
5180
  persistVideo(null);
@@ -4999,6 +5302,10 @@ window.__ModuleLoader__.load({
4999
5302
  ctx.effect(() => () => {
5000
5303
  window.clearInterval(watchdogId);
5001
5304
  }, "dsh-any-background: theme watchdog");
5305
+ const disposeThemeResets = watchThemeResets();
5306
+ ctx.effect(() => () => {
5307
+ disposeThemeResets();
5308
+ }, "dsh-any-background: theme resets watch");
5002
5309
  const onPageHide = () => flushSave();
5003
5310
  window.addEventListener("pagehide", onPageHide);
5004
5311
  ctx.effect(() => () => window.removeEventListener("pagehide", onPageHide), "dsh-any-background: pagehide flush");