dsh-desktop-enhance 0.6.8 → 0.6.9
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 +95 -7
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -9,6 +9,7 @@ window.__ModuleLoader__.load({
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/client/mobile/strings.ts
|
|
11
11
|
const mobileZh = {
|
|
12
|
+
"mobile.settings.back": "‹ 设置",
|
|
12
13
|
"mobile.connection.connecting": "正在重连",
|
|
13
14
|
"mobile.connection.disconnected": "连接已断开",
|
|
14
15
|
"mobile.connection.connected": "已连接",
|
|
@@ -17,6 +18,7 @@ window.__ModuleLoader__.load({
|
|
|
17
18
|
"mobile.writeFailed": "无法保存鲸鱼位置,请检查浏览器存储权限后重试。"
|
|
18
19
|
};
|
|
19
20
|
const mobileEn = {
|
|
21
|
+
"mobile.settings.back": "‹ Settings",
|
|
20
22
|
"mobile.connection.connecting": "Reconnecting",
|
|
21
23
|
"mobile.connection.disconnected": "Disconnected",
|
|
22
24
|
"mobile.connection.connected": "Connected",
|
|
@@ -6945,6 +6947,90 @@ window.__ModuleLoader__.load({
|
|
|
6945
6947
|
}, t("remote.revoke"))))), status.devices.length === 0 ? h("p", { className: "de-remote-empty" }, t("remote.noDevices")) : null))) : null));
|
|
6946
6948
|
}
|
|
6947
6949
|
//#endregion
|
|
6950
|
+
//#region src/client/mobile/settings.ts
|
|
6951
|
+
const root = "[data-shortcut-modal=\"settings\"][role=\"dialog\"]";
|
|
6952
|
+
const panel = `body.dsh-remote-portrait ${root}`;
|
|
6953
|
+
const MOBILE_SETTINGS_CSS = [
|
|
6954
|
+
`${panel}{width:100%;max-width:100%;height:var(--desktop-enhance-viewport-height,100dvh);max-height:var(--desktop-enhance-viewport-height,100dvh);border-radius:0;box-shadow:none}`,
|
|
6955
|
+
`body.dsh-remote-portrait [role="presentation"]:has(> ${root}){top:var(--desktop-enhance-viewport-top,0px);bottom:auto;height:var(--desktop-enhance-viewport-height,100dvh)}`,
|
|
6956
|
+
`${panel}[data-desktop-enhance-settings-view]{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);box-sizing:border-box}`,
|
|
6957
|
+
`${panel}[data-desktop-enhance-settings-view] > nav,${panel}[data-desktop-enhance-settings-view] > [class$="_content"]{display:contents}`,
|
|
6958
|
+
`${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navTitle"]{display:flex;align-items:center;grid-area:1/1;padding:0 16px;pointer-events:none;font-size:17px;font-weight:600;max-width:40%;min-width:0}`,
|
|
6959
|
+
`${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"]{grid-area:2/1;display:flex;flex-direction:column;gap:4px;min-height:0;padding:12px 16px;overflow:auto;overscroll-behavior:contain}`,
|
|
6960
|
+
`${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button{height:auto;min-height:52px;width:100%;flex:none;padding:12px 14px;gap:12px;border-radius:10px;font-size:15px}`,
|
|
6961
|
+
`${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button > span{font-size:15px;white-space:normal;overflow-wrap:anywhere}`,
|
|
6962
|
+
`${panel}[data-desktop-enhance-settings-view] > nav > [class$="_navList"] > button::after{content:'›';margin-left:auto;font-size:22px;color:var(--dsw-alias-label-secondary)}`,
|
|
6963
|
+
`${panel}[data-desktop-enhance-settings-view] > [class$="_content"] > [class$="_header"]{grid-area:1/1;display:flex;justify-content:flex-end;align-items:center;gap:8px;min-height:56px;padding:6px 12px;box-sizing:border-box;border-bottom:1px solid var(--dsw-alias-border-l2)}`,
|
|
6964
|
+
`${panel}[data-desktop-enhance-settings-view] > [class$="_content"] > [class$="_options"]{grid-area:2/1;min-width:0;min-height:0;padding:16px;overflow:auto;overscroll-behavior:contain}`,
|
|
6965
|
+
`${panel}[data-desktop-enhance-settings-view="list"] > [class$="_content"] > [class$="_options"],${panel}[data-desktop-enhance-settings-view="list"] [data-desktop-enhance-settings-back]{display:none}`,
|
|
6966
|
+
`${panel}[data-desktop-enhance-settings-view="detail"] > nav > :is([class$="_navList"],[class$="_navTitle"]){display:none}`,
|
|
6967
|
+
`${panel} [data-desktop-enhance-settings-back]{border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;min-height:44px;padding:0 12px;margin-right:auto;cursor:pointer;white-space:nowrap}`,
|
|
6968
|
+
`${panel} > [class$="_content"] > [class$="_header"] button{min-height:44px;min-width:44px;flex-shrink:0;white-space:nowrap}`,
|
|
6969
|
+
`${panel} [class$="_rowHead"]{flex-wrap:wrap;gap:10px}`,
|
|
6970
|
+
`${panel} [class$="_rowHead"] > [class$="_rowIdentity"]{flex:1 1 100%;min-width:0;overflow-wrap:anywhere}`,
|
|
6971
|
+
`${panel} [class$="_rowActions"]{flex-wrap:wrap;gap:8px;min-width:0}`,
|
|
6972
|
+
`${panel} [class$="_rowActions"] button{min-height:44px;min-width:44px;padding:8px 12px;flex-shrink:0;white-space:nowrap}`,
|
|
6973
|
+
`${panel} :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),select){box-sizing:border-box;min-width:0;max-width:100%;min-height:44px;font-size:16px}`,
|
|
6974
|
+
`${panel} textarea{box-sizing:border-box;max-width:100%;min-height:88px;font-size:16px}`,
|
|
6975
|
+
`${panel} button:is([class$="_primaryButton"],[class$="_secondaryButton"],[class$="_dangerButton"]){min-height:44px;min-width:44px;flex-shrink:0;white-space:nowrap}`,
|
|
6976
|
+
`${panel} [class*="_field_"]{min-width:0}`,
|
|
6977
|
+
`${panel} [class*="_field_"] > [class*="_head_"],${panel} [class*="_form_"] > [class*="_footer_"]{flex-wrap:wrap;gap:8px}`,
|
|
6978
|
+
`${panel} [class*="_field_"] > input{box-sizing:border-box;width:100%;min-width:0;min-height:44px;font-size:16px}`,
|
|
6979
|
+
`${panel} [class*="_field_"] button,${panel} [class*="_form_"] > [class*="_footer_"] button{min-height:44px;min-width:44px;white-space:nowrap}`,
|
|
6980
|
+
`${panel} [data-slot="settings.general.item"] > *{flex-wrap:wrap;gap:12px;min-width:0}`,
|
|
6981
|
+
`${panel} [data-slot="settings.general.item"] > * > :first-child:not(button){min-width:0}`,
|
|
6982
|
+
`${panel} [data-slot="settings.general.item"] > * > button:not([role="switch"]){min-height:44px;max-width:100%;white-space:nowrap}`
|
|
6983
|
+
];
|
|
6984
|
+
function mountMobileSettings(backLabel) {
|
|
6985
|
+
const mounted = new Map();
|
|
6986
|
+
function sync() {
|
|
6987
|
+
for (const [element, dispose] of mounted) if (!element.isConnected) {
|
|
6988
|
+
dispose();
|
|
6989
|
+
mounted.delete(element);
|
|
6990
|
+
}
|
|
6991
|
+
for (const element of globalThis.document.querySelectorAll(root)) {
|
|
6992
|
+
if (mounted.has(element)) continue;
|
|
6993
|
+
const nav = element.querySelector(":scope > nav > [class$=\"_navList\"]");
|
|
6994
|
+
const header = element.querySelector(":scope > [class$=\"_content\"] > [class$=\"_header\"]");
|
|
6995
|
+
if (!nav || !header) continue;
|
|
6996
|
+
const back = globalThis.document.createElement("button");
|
|
6997
|
+
back.type = "button";
|
|
6998
|
+
back.setAttribute("data-desktop-enhance-settings-back", "");
|
|
6999
|
+
back.textContent = backLabel();
|
|
7000
|
+
const showList = () => {
|
|
7001
|
+
element.setAttribute("data-desktop-enhance-settings-view", "list");
|
|
7002
|
+
nav.querySelector("[aria-current=\"true\"]")?.focus();
|
|
7003
|
+
};
|
|
7004
|
+
const select = (event) => {
|
|
7005
|
+
const target = event.target;
|
|
7006
|
+
if (!(target instanceof globalThis.Element)) return;
|
|
7007
|
+
const button = target.closest("button");
|
|
7008
|
+
if (!button || button.parentElement !== nav || button.disabled) return;
|
|
7009
|
+
element.setAttribute("data-desktop-enhance-settings-view", "detail");
|
|
7010
|
+
back.focus();
|
|
7011
|
+
};
|
|
7012
|
+
back.addEventListener("click", showList);
|
|
7013
|
+
nav.addEventListener("click", select);
|
|
7014
|
+
header.prepend(back);
|
|
7015
|
+
element.setAttribute("data-desktop-enhance-settings-view", "list");
|
|
7016
|
+
mounted.set(element, () => {
|
|
7017
|
+
back.removeEventListener("click", showList);
|
|
7018
|
+
nav.removeEventListener("click", select);
|
|
7019
|
+
back.remove();
|
|
7020
|
+
element.removeAttribute("data-desktop-enhance-settings-view");
|
|
7021
|
+
});
|
|
7022
|
+
}
|
|
7023
|
+
}
|
|
7024
|
+
const observer = new globalThis.MutationObserver(sync);
|
|
7025
|
+
observer.observe(globalThis.document.body, { childList: true });
|
|
7026
|
+
sync();
|
|
7027
|
+
return () => {
|
|
7028
|
+
observer.disconnect();
|
|
7029
|
+
for (const dispose of mounted.values()) dispose();
|
|
7030
|
+
mounted.clear();
|
|
7031
|
+
};
|
|
7032
|
+
}
|
|
7033
|
+
//#endregion
|
|
6948
7034
|
//#region src/client/mobile/styles.ts
|
|
6949
7035
|
const ADAPT_CSS = [
|
|
6950
7036
|
"html:has(body.dsh-remote-portrait){overflow:hidden;overscroll-behavior:none}",
|
|
@@ -6989,6 +7075,10 @@ window.__ModuleLoader__.load({
|
|
|
6989
7075
|
`body.dsh-remote-portrait [class$="_crumb"]{max-width:none;padding:2px 4px;font-size:13.5px}`,
|
|
6990
7076
|
`body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"]{margin-left:auto;gap:4px}`,
|
|
6991
7077
|
`body.dsh-remote-portrait header[class*="_header"] [class$="_headerActions"] button{height:24px;min-height:24px;font-size:11px;padding:0 6px}`,
|
|
7078
|
+
`body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleCluster"]{flex-wrap:wrap;row-gap:4px;align-items:flex-start}`,
|
|
7079
|
+
`body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_crumbs"]{flex:1 1 140px;min-width:min(140px,100%);max-width:100%}`,
|
|
7080
|
+
`body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_headerActions"]{margin-left:0;max-width:100%;flex-wrap:wrap;row-gap:4px}`,
|
|
7081
|
+
`body.dsh-remote-portrait header:has([data-slot="conversation.session.header"]) [class$="_titleRow"]{align-items:flex-start}`,
|
|
6992
7082
|
`#dshRemoteWhale{position:fixed;top:calc(4px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));z-index:2147482999;width:34px;height:34px;min-width:34px;padding:0;border-radius:10px;background:var(--dsw-alias-bg-module-platform);border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 1px 6px rgba(0,0,0,.25);touch-action:none}`,
|
|
6993
7083
|
`#dshRemoteWhale{translate:0 var(--desktop-enhance-viewport-top,0px)}`,
|
|
6994
7084
|
`#dshRemoteWhale svg{width:20px;height:15px;display:block}`,
|
|
@@ -7047,13 +7137,7 @@ window.__ModuleLoader__.load({
|
|
|
7047
7137
|
`body.dsh-remote-portrait [data-dsh-plugin="pet"],`,
|
|
7048
7138
|
`body.dsh-remote-portrait [data-dsh-plugin="usage"]{display:none !important}`,
|
|
7049
7139
|
`body.dsh-remote-portrait [class$="_overlayLayer"] [class$="_workbench"]{display:none !important}`,
|
|
7050
|
-
|
|
7051
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_nav"]{flex-direction:row;gap:4px;width:100%;padding:12px 12px 0;overflow-x:auto;overflow-y:hidden}`,
|
|
7052
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navTitle"]{display:none}`,
|
|
7053
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navList"]{flex-direction:row;gap:4px}`,
|
|
7054
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navCell"]{height:34px;padding:0 12px;gap:6px;flex:none;border-radius:10px}`,
|
|
7055
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_navLabel"]{font-size:13px}`,
|
|
7056
|
-
`body.dsh-remote-portrait [class$="_overlay"] [class$="_panel"] [class$="_content"]{flex:1;min-height:0}`
|
|
7140
|
+
...MOBILE_SETTINGS_CSS
|
|
7057
7141
|
];
|
|
7058
7142
|
//#endregion
|
|
7059
7143
|
//#region src/client/mobile/index.ts
|
|
@@ -7115,6 +7199,7 @@ window.__ModuleLoader__.load({
|
|
|
7115
7199
|
const FISH_PATH = "M22.9168 1.43018C22.6713 1.31018 22.5658 1.53918 22.4223 1.65519C22.3733 1.69269 22.3318 1.74169 22.2903 1.78669C21.9317 2.1697 21.5127 2.42121 20.9657 2.39121C20.1657 2.34621 19.4827 2.59771 18.8787 3.20973C18.7502 2.45521 18.3236 2.0047 17.6746 1.71569C17.3351 1.56568 16.9916 1.41518 16.7536 1.08867C16.5876 0.856163 16.5421 0.597155 16.4591 0.341647C16.4061 0.187643 16.3536 0.0301382 16.1761 0.00363739C15.9836 -0.0263635 15.9081 0.135141 15.8326 0.270145C15.5306 0.822162 15.4136 1.43018 15.4251 2.0462C15.4516 3.43174 16.0366 4.53527 17.1991 5.3203C17.3311 5.4103 17.3651 5.5003 17.3236 5.63181C17.2441 5.90231 17.1501 6.16482 17.0671 6.43533C17.0141 6.60784 16.9351 6.64584 16.7501 6.57033C16.1121 6.30383 15.5611 5.90931 15.074 5.4328C14.2475 4.63328 13.5 3.75075 12.568 3.05973C12.349 2.89822 12.13 2.74822 11.9034 2.60522C10.9524 1.68169 12.028 0.923165 12.277 0.833162C12.5375 0.739159 12.3675 0.41615 11.5259 0.42015C10.6844 0.42365 9.91439 0.705658 8.93286 1.08117C8.78935 1.13767 8.63835 1.17867 8.48384 1.21267C7.59332 1.04367 6.66829 1.00617 5.70226 1.11517C3.88321 1.31768 2.43016 2.1777 1.36213 3.64575C0.0790928 5.4103 -0.222916 7.41536 0.146595 9.50642C0.535106 11.7105 1.66014 13.535 3.38869 14.9616C5.18125 16.4406 7.24581 17.1657 9.60138 17.0266C11.0319 16.9441 12.6245 16.7526 14.421 15.2321C14.874 15.4576 15.3496 15.5476 16.1381 15.6151C16.7456 15.6716 17.3306 15.5851 17.7836 15.4911C18.4931 15.3411 18.4441 14.6841 18.1876 14.5636C16.1081 13.595 16.5646 13.9891 16.1496 13.67C17.2061 12.42 18.8202 10.1979 19.3182 7.17235C19.3672 6.83834 19.4297 6.36783 19.4222 6.09732C19.4182 5.93231 19.4562 5.86831 19.6447 5.84931C20.1657 5.78931 20.6712 5.64681 21.1357 5.3913C22.4833 4.65528 23.0268 3.44624 23.1548 1.9972C23.1738 1.77569 23.1508 1.54668 22.9168 1.43018Z";
|
|
7116
7200
|
const surfaceText = (key, fallback) => actions.t(key) || fallback;
|
|
7117
7201
|
let active = false;
|
|
7202
|
+
let disposeSettings = null;
|
|
7118
7203
|
let savedViewportContent = null;
|
|
7119
7204
|
let whaleEl = null;
|
|
7120
7205
|
let connectionStatus = "unknown";
|
|
@@ -7186,6 +7271,7 @@ window.__ModuleLoader__.load({
|
|
|
7186
7271
|
forgetAbsentSelectors();
|
|
7187
7272
|
globalThis.document.body.classList.add(ACTIVE_CLASS);
|
|
7188
7273
|
ensureAdaptStyle();
|
|
7274
|
+
disposeSettings = mountMobileSettings(() => actions.t("mobile.settings.back"));
|
|
7189
7275
|
const meta = globalThis.document.querySelector("meta[name=viewport]");
|
|
7190
7276
|
if (meta instanceof globalThis.HTMLMetaElement && meta.getAttribute("content") !== null && !(meta.getAttribute("content") ?? "").includes("viewport-fit")) {
|
|
7191
7277
|
savedViewportContent = meta.getAttribute("content");
|
|
@@ -7199,6 +7285,8 @@ window.__ModuleLoader__.load({
|
|
|
7199
7285
|
function revert() {
|
|
7200
7286
|
if (!active) return;
|
|
7201
7287
|
active = false;
|
|
7288
|
+
disposeSettings?.();
|
|
7289
|
+
disposeSettings = null;
|
|
7202
7290
|
clearLongPress();
|
|
7203
7291
|
cancelTimeouts();
|
|
7204
7292
|
restoreActionStyles();
|
package/package.json
CHANGED