@linxin666/dsh-remote-web-ui 0.3.9 → 0.3.10

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
@@ -3560,6 +3560,9 @@ window.__ModuleLoader__.load({
3560
3560
  /** Simplified Chinese dictionary (the key-set source of truth). */
3561
3561
  const zh = {
3562
3562
  "entry.label": "远程访问",
3563
+ "mobile.whale.open": "打开侧边栏",
3564
+ "mobile.composer.pickModel": "选择模型",
3565
+ "mobile.composer.pickEffort": "选择推理等级",
3563
3566
  "title": "远程访问",
3564
3567
  "subtitle": "通过手机或另一台电脑配对,远程使用同一份 Web 界面(官方界面 + 移动端适配)",
3565
3568
  "card.title": "设备配对",
@@ -3711,6 +3714,9 @@ window.__ModuleLoader__.load({
3711
3714
  /** English dictionary, checked complete against the zh key set. */
3712
3715
  const en = {
3713
3716
  "entry.label": "Remote access",
3717
+ "mobile.whale.open": "Open sidebar",
3718
+ "mobile.composer.pickModel": "Pick model",
3719
+ "mobile.composer.pickEffort": "Pick reasoning effort",
3714
3720
  "title": "Remote access",
3715
3721
  "subtitle": "Pair a phone or another computer to share the same Web GUI (official UI + mobile adaptation)",
3716
3722
  "card.title": "Pair a device",
@@ -4333,7 +4339,7 @@ window.__ModuleLoader__.load({
4333
4339
  /** The building package's version, when the bundle carries it. */
4334
4340
  function bakedVersion() {
4335
4341
  try {
4336
- return "0.3.9";
4342
+ return "0.3.10";
4337
4343
  } catch {
4338
4344
  return;
4339
4345
  }
@@ -4518,6 +4524,19 @@ window.__ModuleLoader__.load({
4518
4524
  if (window.__dshRemoteAdaptInstalled === true) return;
4519
4525
  window.__dshRemoteAdaptInstalled = true;
4520
4526
  const w = window;
4527
+ /**
4528
+ * Label lookup for the injected surfaces: the `remote` namespace seat wired
4529
+ * by the plugin apply, else the English fallback (the SDK's universal
4530
+ * fallback; the sync tick re-renders the labels once the seat is live).
4531
+ */
4532
+ const surfaceText = (key, fallback) => {
4533
+ try {
4534
+ const out = w.__dshRemoteAdapt?.translate?.(key);
4535
+ return typeof out === "string" && out.length > 0 ? out : fallback;
4536
+ } catch {
4537
+ return fallback;
4538
+ }
4539
+ };
4521
4540
  let active = false;
4522
4541
  let savedViewportContent = null;
4523
4542
  let whaleEl = null;
@@ -4637,9 +4656,23 @@ window.__ModuleLoader__.load({
4637
4656
  removeCompactPicker();
4638
4657
  return;
4639
4658
  }
4640
- const zh = (navigator.language ?? "").toLowerCase().startsWith("zh");
4641
- if (document.getElementById(MODEL_BTN_ID) === null) tools.appendChild(makeCompactButton(MODEL_BTN_ID, zh ? "选择模型" : "Pick model", CUBE_ICON, /模型|Model/));
4642
- if (document.getElementById(EFFORT_BTN_ID) === null) tools.appendChild(makeCompactButton(EFFORT_BTN_ID, zh ? "选择推理等级" : "Pick reasoning effort", LEVELS_ICON, /推理等级|Reasoning|Effort/i));
4659
+ if (document.getElementById(MODEL_BTN_ID) === null) tools.appendChild(makeCompactButton(MODEL_BTN_ID, surfaceText("mobile.composer.pickModel", "Pick model"), CUBE_ICON, /模型|Model/));
4660
+ if (document.getElementById(EFFORT_BTN_ID) === null) tools.appendChild(makeCompactButton(EFFORT_BTN_ID, surfaceText("mobile.composer.pickEffort", "Pick reasoning effort"), LEVELS_ICON, /推理等级|Reasoning|Effort/i));
4661
+ for (const [id, key, fallback] of [[
4662
+ MODEL_BTN_ID,
4663
+ "mobile.composer.pickModel",
4664
+ "Pick model"
4665
+ ], [
4666
+ EFFORT_BTN_ID,
4667
+ "mobile.composer.pickEffort",
4668
+ "Pick reasoning effort"
4669
+ ]]) {
4670
+ const btn = document.getElementById(id);
4671
+ if (btn === null) continue;
4672
+ const label = surfaceText(key, fallback);
4673
+ btn.title = label;
4674
+ btn.setAttribute("aria-label", label);
4675
+ }
4643
4676
  document.body.classList.add(COMPACT_CLASS);
4644
4677
  }
4645
4678
  /**
@@ -4670,7 +4703,7 @@ window.__ModuleLoader__.load({
4670
4703
  whale.id = WHALE_ID;
4671
4704
  whale.type = "button";
4672
4705
  whale.dataset.dshPlugin = "remote-web-ui";
4673
- const whaleLabel = (navigator.language ?? "").toLowerCase().startsWith("zh") ? "打开侧边栏" : "Open sidebar";
4706
+ const whaleLabel = surfaceText("mobile.whale.open", "Open sidebar");
4674
4707
  whale.title = whaleLabel;
4675
4708
  whale.setAttribute("aria-label", whaleLabel);
4676
4709
  whale.innerHTML = `<svg viewBox="0 0 23.16 17.04" fill="none" aria-hidden="true"><path d="${FISH_PATH}" fill="currentColor"/></svg>`;
@@ -4763,6 +4796,9 @@ window.__ModuleLoader__.load({
4763
4796
  if (show && !whaleShown) applyWhalePos();
4764
4797
  whaleEl.style.display = show ? "" : "none";
4765
4798
  whaleShown = show;
4799
+ const whaleLabel = surfaceText("mobile.whale.open", "Open sidebar");
4800
+ if (whaleEl.title !== whaleLabel) whaleEl.title = whaleLabel;
4801
+ if (whaleEl.getAttribute("aria-label") !== whaleLabel) whaleEl.setAttribute("aria-label", whaleLabel);
4766
4802
  document.body.classList.toggle(RAIL_HIDDEN_CLASS, collapsed);
4767
4803
  disableRowDrag();
4768
4804
  seatHeaderActions();
@@ -5066,6 +5102,7 @@ window.__ModuleLoader__.load({
5066
5102
  evaluate,
5067
5103
  toggleSidebar: null,
5068
5104
  closeDetails: null,
5105
+ translate: null,
5069
5106
  setEnabled(on) {
5070
5107
  adaptEnabled = on;
5071
5108
  if (on) evaluate();
@@ -5137,6 +5174,7 @@ window.__ModuleLoader__.load({
5137
5174
  document.querySelector("[class$=\"_railFish\"] button, [class$=\"_logoRow\"] [class*=\"_iconButton\"]")?.click();
5138
5175
  };
5139
5176
  const t = ctx.locale.bind(NS);
5177
+ if (adapt !== void 0) adapt.translate = t;
5140
5178
  const settingsScope = (ctx.get("webUiSettings") ?? ctx.settingsScope).bind({ namespace: REMOTE_WEB_UI_NS });
5141
5179
  const enabled = () => {
5142
5180
  const snapshot = settingsScope.getSnapshot();