@lls-a1/dsh-balance-float 1.1.44 → 1.1.46
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/README.md +1 -1
- package/client.js +37 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Host 半边自己维护本地用量账本(按轮记账 + 余额轮询),浏
|
|
|
11
11
|
@lls-a1/dsh-balance-float
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
在 DSH
|
|
14
|
+
在 DSH 的插件管理里**只输入包名**即可安装和更新(安装源可选国内镜像)。注意两点:① 本机 Host 进程的 `GIT_CONFIG_*` 环境变量已损坏,`github:` 形式的安装会失败,请用上面的 npm 包名;② 由 `pluginManager` 管理的 profile 里若存在其它 `link:` 依赖,安装前请先完成 pnpm 解析,否则 `npm install` 会因 `link:` 协议报 EUNSUPPORTEDPROTOCOL。GitHub 仓库仅作为源码地址:https://github.com/ming-a1/dsh-balance-float
|
|
15
15
|
本地开发可以用 `link:/path/to/balance-float`,改完刷新页面即可生效。
|
|
16
16
|
|
|
17
17
|
启用后 profile 里会多出一行 `id: balance-float`,可在 `config` 里覆盖账本路径、轮询间隔和 `apiKeyRef`(默认 `DEEPSEEK_API_KEY`,取不到时余额相关数字保持不动,不会归零)。
|
package/client.js
CHANGED
|
@@ -30,6 +30,9 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
const ROUTE = '/balance-float/snapshot';
|
|
31
31
|
const ROUTE_UPDATE = '/balance-float/update';
|
|
32
32
|
const NPM_SPEC = '@lls-a1/dsh-balance-float';
|
|
33
|
+
// Native modal support decides whether the mask lives in the top layer.
|
|
34
|
+
const DIALOG_OK =
|
|
35
|
+
typeof document !== 'undefined' && typeof document.createElement('dialog').showModal === 'function';
|
|
33
36
|
const REPO_URL = 'https://github.com/ming-a1/dsh-balance-float';
|
|
34
37
|
const POS_KEY = 'dsh.balance-float.position';
|
|
35
38
|
// Official top-up page; the balance endpoint has no recharge API, so the
|
|
@@ -308,6 +311,11 @@ window.__ModuleLoader__.load({
|
|
|
308
311
|
'.dbf-version.has-update{color:var(--dsw-alias-state-error-primary)}',
|
|
309
312
|
'.dbf-version.has-update .dbf-version-glyph{opacity:1}',
|
|
310
313
|
'.dbf-modal{position:fixed;top:0;right:0;bottom:0;left:0;height:100dvh;z-index:10;display:flex;align-items:center;justify-content:center;padding:calc(12px + env(safe-area-inset-top,0px)) 12px calc(12px + env(safe-area-inset-bottom,0px));background:rgba(0,0,0,.45);overscroll-behavior:contain;touch-action:none}',
|
|
314
|
+
'.dbf-dialog{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:calc(12px + env(safe-area-inset-top,0px)) 12px calc(12px + env(safe-area-inset-bottom,0px));border:0;box-sizing:border-box;background:transparent;color:inherit;display:flex;align-items:center;justify-content:center;overflow:hidden;overscroll-behavior:contain;outline:none}',
|
|
315
|
+
'.dbf-dialog:focus,.dbf-dialog:focus-visible{outline:none}',
|
|
316
|
+
'.dbf-modal-open{scrollbar-width:none}',
|
|
317
|
+
'.dbf-modal-open ::-webkit-scrollbar{width:0;height:0;display:none}',
|
|
318
|
+
'.dbf-dialog::backdrop{background:rgba(0,0,0,.45)}',
|
|
311
319
|
'.dbf-modal-card{width:min(308px,100%);max-height:100%;overflow:auto;touch-action:auto;overscroll-behavior:contain;padding:16px;border-radius:14px;box-shadow:0 18px 48px rgba(0,0,0,calc(.34 * var(--dbf-shadow,1)));background:var(--dsw-alias-bg-layer-1,Canvas);color:var(--dsw-alias-label-primary,CanvasText)}',
|
|
312
320
|
'.dbf-modal-head{display:flex;align-items:center;gap:8px;margin-bottom:10px}',
|
|
313
321
|
'.dbf-modal-icon{width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-overlay));color:var(--dsw-alias-brand-primary,#4d6bfe);font-size:12px;line-height:1}',
|
|
@@ -598,6 +606,28 @@ window.__ModuleLoader__.load({
|
|
|
598
606
|
const [updateOpen, setUpdateOpen] = useState(shared.updateOpen);
|
|
599
607
|
const updateCheckedAt = useRef(0);
|
|
600
608
|
const [copied, setCopied] = useState(false);
|
|
609
|
+
const modalRef = useRef(null);
|
|
610
|
+
|
|
611
|
+
// A plain fixed <div> stays inside the shell's stacking context, so the
|
|
612
|
+
// page header kept painting above the mask. showModal() moves the element
|
|
613
|
+
// into the browser top layer, where the ::backdrop always covers the
|
|
614
|
+
// whole viewport — no z-index can beat it.
|
|
615
|
+
useEffect(() => {
|
|
616
|
+
if (update === null || !updateOpen) return undefined;
|
|
617
|
+
const root = document.documentElement;
|
|
618
|
+
root.classList.add('dbf-modal-open');
|
|
619
|
+
return () => root.classList.remove('dbf-modal-open');
|
|
620
|
+
}, [update, updateOpen]);
|
|
621
|
+
|
|
622
|
+
useEffect(() => {
|
|
623
|
+
const element = modalRef.current;
|
|
624
|
+
if (element === null || typeof element.showModal !== 'function' || element.open) return;
|
|
625
|
+
try {
|
|
626
|
+
element.showModal();
|
|
627
|
+
} catch {
|
|
628
|
+
// already open or detached — nothing to do
|
|
629
|
+
}
|
|
630
|
+
});
|
|
601
631
|
|
|
602
632
|
/** Copy the install spec so the user can update from the plugin manager. */
|
|
603
633
|
const copyInstallSpec = useCallback(async () => {
|
|
@@ -1635,12 +1665,17 @@ window.__ModuleLoader__.load({
|
|
|
1635
1665
|
update === null || !updateOpen
|
|
1636
1666
|
? null
|
|
1637
1667
|
: h(
|
|
1638
|
-
'div',
|
|
1668
|
+
DIALOG_OK ? 'dialog' : 'div',
|
|
1639
1669
|
{
|
|
1640
|
-
|
|
1670
|
+
ref: DIALOG_OK ? modalRef : undefined,
|
|
1671
|
+
className: DIALOG_OK ? 'dbf-dialog' : 'dbf-modal',
|
|
1641
1672
|
role: 'dialog',
|
|
1642
1673
|
'aria-modal': 'true',
|
|
1643
1674
|
'aria-label': t('update.title'),
|
|
1675
|
+
onCancel: (event) => {
|
|
1676
|
+
event.preventDefault();
|
|
1677
|
+
setUpdateOpen(false);
|
|
1678
|
+
},
|
|
1644
1679
|
onClick: (event) => {
|
|
1645
1680
|
if (event.target === event.currentTarget) setUpdateOpen(false);
|
|
1646
1681
|
},
|