papersearch 0.4.9 → 0.4.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/README.en.md +50 -63
- package/README.md +50 -63
- package/assets/overview.en.png +0 -0
- package/assets/overview.png +0 -0
- package/assets/progress-capsule.en.png +0 -0
- package/assets/progress-capsule.png +0 -0
- package/carsi/README.md +5 -6
- package/carsi/paper_search_carsi/adapters/elsevier/__init__.py +1 -1
- package/carsi/paper_search_carsi/adapters/ieee/__init__.py +1 -1
- package/carsi/paper_search_carsi/adapters/jama/__init__.py +3 -1
- package/carsi/paper_search_carsi/adapters/karger/__init__.py +2 -1
- package/carsi/paper_search_carsi/adapters/lww/ovid.py +2 -2
- package/carsi/paper_search_carsi/adapters/oup/__init__.py +3 -4
- package/carsi/paper_search_carsi/adapters/world_scientific/__init__.py +5 -4
- package/carsi/paper_search_carsi/assets/capsule.html +114 -15
- package/carsi/paper_search_carsi/browser/backend.py +269 -233
- package/carsi/paper_search_carsi/browser/batch_session.py +42 -0
- package/carsi/paper_search_carsi/browser/challenge_interaction.py +28 -9
- package/carsi/paper_search_carsi/browser/cookies.py +8 -8
- package/carsi/paper_search_carsi/browser/driver.py +29 -0
- package/carsi/paper_search_carsi/browser/engine.py +17 -23
- package/carsi/paper_search_carsi/browser/foreground.py +21 -15
- package/carsi/paper_search_carsi/browser/login.py +12 -18
- package/carsi/paper_search_carsi/browser/preview.py +31 -12
- package/carsi/paper_search_carsi/browser/profiles.py +16 -23
- package/carsi/paper_search_carsi/browser/watchdog.py +61 -55
- package/carsi/paper_search_carsi/cli.py +22 -7
- package/carsi/paper_search_carsi/cold_start.py +65 -51
- package/carsi/paper_search_carsi/config.py +6 -4
- package/carsi/paper_search_carsi/engine/batch.py +9 -5
- package/carsi/paper_search_carsi/engine/batch_capture.py +56 -20
- package/carsi/paper_search_carsi/engine/batch_common.py +56 -16
- package/carsi/paper_search_carsi/engine/batch_institution.py +122 -13
- package/carsi/paper_search_carsi/engine/batch_login.py +30 -2
- package/carsi/paper_search_carsi/engine/batch_user.py +1 -1
- package/carsi/paper_search_carsi/engine/batch_waits.py +21 -7
- package/carsi/paper_search_carsi/engine/bridge.py +23 -13
- package/carsi/paper_search_carsi/engine/login_wait.py +1 -1
- package/carsi/paper_search_carsi/mcp_progress.py +13 -5
- package/carsi/paper_search_carsi/network.py +1 -1
- package/carsi/paper_search_carsi/progress_reporter.py +88 -7
- package/carsi/paper_search_carsi/progress_view.py +61 -0
- package/carsi/paper_search_carsi/server.py +47 -10
- package/carsi/paper_search_carsi/session_broker.py +1 -1
- package/carsi/pyproject.toml +7 -7
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js +6 -0
- package/dist/capabilities/pdf-discovery/OpenAccessFallbackService.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/batch.js +15 -5
- package/dist/capabilities/pdf-discovery/batch.js.map +1 -1
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts +22 -0
- package/dist/capabilities/pdf-discovery/batchSummary.d.ts.map +1 -0
- package/dist/capabilities/pdf-discovery/batchSummary.js +131 -0
- package/dist/capabilities/pdf-discovery/batchSummary.js.map +1 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.d.ts +1 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js +52 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiAttempt.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts +8 -4
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js +89 -30
- package/dist/capabilities/pdf-discovery/carsi/CarsiMcpClient.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts +4 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js +10 -0
- package/dist/capabilities/pdf-discovery/carsi/CarsiReadiness.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts +2 -2
- package/dist/capabilities/pdf-discovery/carsi/index.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.js +1 -1
- package/dist/capabilities/pdf-discovery/carsi/index.js.map +1 -1
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts +36 -0
- package/dist/capabilities/pdf-discovery/carsi/types.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.d.ts.map +1 -1
- package/dist/capabilities/pdf-discovery/handler.js +11 -6
- package/dist/capabilities/pdf-discovery/handler.js.map +1 -1
- package/dist/capabilities/pdf-discovery/types.d.ts +3 -0
- package/dist/capabilities/pdf-discovery/types.d.ts.map +1 -1
- package/dist/cli.js +13 -9
- package/dist/cli.js.map +1 -1
- package/dist/management/carsi/installer.d.ts +26 -14
- package/dist/management/carsi/installer.d.ts.map +1 -1
- package/dist/management/carsi/installer.js +113 -69
- package/dist/management/carsi/installer.js.map +1 -1
- package/dist/management/carsi/runtime.d.ts +12 -1
- package/dist/management/carsi/runtime.d.ts.map +1 -1
- package/dist/management/carsi/runtime.js +30 -1
- package/dist/management/carsi/runtime.js.map +1 -1
- package/package.json +1 -1
- package/skills/paper-search/SKILL.md +4 -4
- package/skills/paper-search/references/browser-download.md +3 -3
- package/skills/paper-search/references/carsi-setup.md +7 -6
- package/skills/paper-search/references/cli-contract.md +4 -4
- package/skills/paper-search/references/management-layer.md +2 -2
- package/carsi/paper_search_carsi/assets/quiet-browser/api.js +0 -142
- package/carsi/paper_search_carsi/assets/quiet-browser/manifest.json +0 -24
- package/carsi/paper_search_carsi/assets/quiet-browser/schema.json +0 -1
- package/carsi/paper_search_carsi/browser/background.py +0 -68
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
(``platforms/atypon``): its pages carry Literatum's markers and cookies
|
|
3
3
|
(2026-11-03; no public announcement found).
|
|
4
4
|
|
|
5
|
-
Its
|
|
6
|
-
|
|
7
|
-
address without it is a redirect that stalled.
|
|
5
|
+
Its chooser at ``/action/ssostart`` shows either the institution search or
|
|
6
|
+
lists for the federation and the institution.
|
|
8
7
|
"""
|
|
9
8
|
from __future__ import annotations
|
|
10
9
|
|
|
@@ -22,6 +21,8 @@ class WorldScientificAdapter(AtyponAdapter):
|
|
|
22
21
|
def chooser_block_reason(self, page: Any, url: str, text: str) -> str | None:
|
|
23
22
|
if "worldscientific.com/action/ssostart" not in url:
|
|
24
23
|
return None
|
|
25
|
-
if "find your institution"
|
|
24
|
+
if any(label in text for label in ("find your institution", "type the name of your institution",
|
|
25
|
+
"select your federation", "select your institution",
|
|
26
|
+
"china cernet federation (carsi)")):
|
|
26
27
|
return ""
|
|
27
28
|
return "sso_redirect_stalled"
|
|
@@ -60,6 +60,8 @@ body.grow-up #root.animating > .surface { top: auto; bottom: 0; }
|
|
|
60
60
|
|
|
61
61
|
.attention-target { appearance: none; box-sizing: content-box; padding: 0; border: none; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
|
|
62
62
|
.pill-prompt { display: inline-flex; align-items: center; gap: 8px; }
|
|
63
|
+
.attention-countdown { font-variant-numeric: tabular-nums; }
|
|
64
|
+
.attention-countdown:empty { display: none; }
|
|
63
65
|
.attention-target:focus-visible { outline: 2px solid var(--warn-dot); outline-offset: -2px; border-radius: 8px; }
|
|
64
66
|
.pillrow { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; white-space: nowrap; height: 28px; }
|
|
65
67
|
.pillrow.icon-first { padding-left: 12px; }
|
|
@@ -136,6 +138,32 @@ svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-widt
|
|
|
136
138
|
.attention-head { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--fg); }
|
|
137
139
|
.attention-head b { flex: 1; font-size: 12px; }
|
|
138
140
|
#root.card.warn { background: var(--bg); }
|
|
141
|
+
|
|
142
|
+
/* The finished card: totals, failures by reason, what was saved. No text wraps. */
|
|
143
|
+
.done-stats { margin-top: 12px; }
|
|
144
|
+
.sec { margin-top: 14px; }
|
|
145
|
+
.sec-h { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--dim); margin-bottom: 4px; }
|
|
146
|
+
.sec-h b { color: var(--fg); font-weight: 600; font-size: 13px; }
|
|
147
|
+
.saved-line { font-size: 12px; color: var(--dim); line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
148
|
+
.grp { border-top: 0.5px solid var(--line); padding: 8px 0; }
|
|
149
|
+
.grp:last-child { border-bottom: 0.5px solid var(--line); }
|
|
150
|
+
.grp .row { display: flex; align-items: center; gap: 6px; width: 100%; padding: 0; border: none; background: none;
|
|
151
|
+
font: inherit; color: inherit; text-align: left; white-space: nowrap; cursor: pointer; }
|
|
152
|
+
.grp .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
|
153
|
+
.grp .row .reason { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
|
154
|
+
.grp .row .n { font-weight: 600; }
|
|
155
|
+
.grp .row svg.i { width: 14px; height: 14px; color: var(--faint); }
|
|
156
|
+
.grp .m { font-size: 12px; color: var(--faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
157
|
+
.paper-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: 196px; overflow-y: auto; }
|
|
158
|
+
.paper-list.scroll { -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
|
|
159
|
+
.paper-list li { font-size: 12px; padding: 3px 0; }
|
|
160
|
+
.paper-list .t, .paper-list .w { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
161
|
+
.paper-list .w, .paper-list .more { color: var(--faint); }
|
|
162
|
+
.tag { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 5px; flex: none; }
|
|
163
|
+
.tag.no_access, .tag.other { background: var(--hover); color: var(--fg); }
|
|
164
|
+
.tag.user_or_external { background: var(--warn-bg); color: var(--warn); }
|
|
165
|
+
.tag.unsupported { background: rgba(37, 99, 235, 0.12); color: var(--accent); }
|
|
166
|
+
.tag.unexplained { background: rgba(220, 38, 38, 0.12); color: var(--bad); }
|
|
139
167
|
</style>
|
|
140
168
|
</head>
|
|
141
169
|
<body>
|
|
@@ -155,6 +183,7 @@ const ICONS = {
|
|
|
155
183
|
dots: '<circle cx="6" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18" cy="12" r="1"/>',
|
|
156
184
|
left: '<path d="M15 6l-6 6 6 6"/>',
|
|
157
185
|
right: '<path d="M9 6l6 6-6 6"/>',
|
|
186
|
+
down: '<path d="M6 9l6 6 6-6"/>',
|
|
158
187
|
gear: gearPath(),
|
|
159
188
|
};
|
|
160
189
|
function gearPath() {
|
|
@@ -193,7 +222,7 @@ function pill() {
|
|
|
193
222
|
const a = v.attention;
|
|
194
223
|
return '<div class="pillrow icon-first capsule-drag-region">' + icon(a.login ? "lock" : "shield")
|
|
195
224
|
+ '<button type="button" class="pill-prompt attention-target" data-act="show_browser" title="点击切到下载浏览器" aria-label="打开下载浏览器">'
|
|
196
|
-
+
|
|
225
|
+
+ '<b>' + esc(a.short) + '</b><span class="attention-countdown"></span></button></div>';
|
|
197
226
|
}
|
|
198
227
|
if (v.mode === "done") {
|
|
199
228
|
// "完成 38/40 2 篇失败": papers saved out of all; a check unless nothing was saved.
|
|
@@ -275,12 +304,10 @@ function runningCard() {
|
|
|
275
304
|
function attentionCard() {
|
|
276
305
|
const a = V.attention;
|
|
277
306
|
const title = a.short;
|
|
278
|
-
const detail = [a.message, a.remaining ? "剩 " + a.remaining : "",
|
|
279
|
-
a.more ? "另有 " + a.more + " 项" : ""].filter(Boolean).join(" · ");
|
|
280
307
|
let html = '<div class="card-body"><div class="attention-head capsule-drag-region"><b>PaperSearch</b>'
|
|
281
308
|
+ '<button class="iconbtn" data-act="minimize" aria-label="最小化">' + icon("minimize") + '</button>'
|
|
282
309
|
+ '<button class="iconbtn" data-act="close" aria-label="关闭">' + icon("close") + '</button></div>'
|
|
283
|
-
+ '<button type="button" class="prompt attention-target" data-act="show_browser"
|
|
310
|
+
+ '<button type="button" class="prompt attention-target" data-act="show_browser" aria-label="打开下载浏览器">' + icon(a.login ? "lock" : "alert")
|
|
284
311
|
+ '<div class="attention-copy"><div class="t">' + esc(title) + '</div><div class="s">点击打开浏览器,查看并继续</div></div><span class="attention-arrow" aria-hidden="true">›</span></button>';
|
|
285
312
|
if (panel === "confirm") return html + actionsBlock() + "</div>";
|
|
286
313
|
html += '<div class="actions"><button class="iconbtn" data-act="settings" aria-label="设置">' + icon("gear")
|
|
@@ -292,12 +319,45 @@ function attentionCard() {
|
|
|
292
319
|
return html + "</div></div>";
|
|
293
320
|
}
|
|
294
321
|
|
|
322
|
+
const CLASS_TAGS = { no_access: "没权限", user_or_external: "外部原因", unsupported: "暂不支持", unexplained: "原因不明", other: "其他" };
|
|
323
|
+
let openGroups = null, groupsRun = ""; // null: each reason row as the view opens it
|
|
324
|
+
function groupOpen(i) {
|
|
325
|
+
if (groupsRun !== V.run_id) { openGroups = null; groupsRun = V.run_id; }
|
|
326
|
+
return openGroups ? openGroups.has(i) : !!V.summary.groups[i].open;
|
|
327
|
+
}
|
|
328
|
+
function toggleGroup(i) {
|
|
329
|
+
const opened = !groupOpen(i);
|
|
330
|
+
openGroups = new Set(opened ? [i] : []); // one reason open at a time
|
|
331
|
+
render(true);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function reasonRow(g, i) {
|
|
335
|
+
const opened = groupOpen(i);
|
|
336
|
+
let html = '<div class="grp"><button type="button" class="row" data-act="group" data-group="' + i + '" aria-expanded="' + opened + '">'
|
|
337
|
+
+ '<span class="tag ' + esc(g.cls) + '">' + esc(CLASS_TAGS[g.cls] || "") + '</span><span class="reason">' + esc(g.reason) + "</span>"
|
|
338
|
+
+ '<span class="n">' + g.count + " 篇</span>" + icon(opened ? "down" : "right") + "</button>";
|
|
339
|
+
if (!opened) return html + (g.where ? '<div class="m">' + esc(g.where) + "</div>" : "") + "</div>";
|
|
340
|
+
return html + '<ul class="paper-list' + (g.papers.length > 5 ? " scroll" : "") + '">'
|
|
341
|
+
+ g.papers.map((p) => '<li><div class="t">' + esc(p.title) + "</div>" + (p.where ? '<div class="w">' + esc(p.where) + "</div>" : "") + "</li>").join("")
|
|
342
|
+
+ (g.more ? '<li class="more">另有 ' + g.more + " 篇未列出</li>" : "") + "</ul></div>";
|
|
343
|
+
}
|
|
344
|
+
|
|
295
345
|
function doneCard() {
|
|
296
|
-
const v = V;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
+ (v.
|
|
300
|
-
+
|
|
346
|
+
const v = V, s = v.summary;
|
|
347
|
+
let html = '<div class="card-body">' + header(v.headline, v.total ? "共 " + v.total + " 篇" : "", true)
|
|
348
|
+
+ '<div class="stats done-stats"><div><b style="color:var(--ok)">' + v.ok + "</b><span>成功</span></div>"
|
|
349
|
+
+ '<div><b' + (v.bad ? ' style="color:var(--bad)"' : "") + ">" + v.bad + "</b><span>失败</span></div>"
|
|
350
|
+
+ "<div><b>" + esc(v.elapsed || "—") + "</b><span>用时</span></div></div>";
|
|
351
|
+
if (s && s.groups.length) {
|
|
352
|
+
html += '<div class="sec"><div class="sec-h"><b>未完成 ' + v.bad + " 篇</b><span>按原因</span></div>"
|
|
353
|
+
+ s.groups.map(reasonRow).join("") + "</div>";
|
|
354
|
+
}
|
|
355
|
+
if (s && v.ok) {
|
|
356
|
+
html += '<div class="sec"><div class="sec-h"><b>已完成 ' + v.ok + " 篇</b></div>"
|
|
357
|
+
+ s.saved.map((line) => '<div class="saved-line">' + esc(line) + "</div>").join("") + "</div>";
|
|
358
|
+
}
|
|
359
|
+
if (v.completion_detail) html += '<div class="line">' + esc(v.completion_detail) + "</div>";
|
|
360
|
+
return html + (v.folder ? '<div class="actions"><button class="btn link" data-act="folder">' + icon("folder") + "打开文件夹</button></div>" : "")
|
|
301
361
|
+ "</div>";
|
|
302
362
|
}
|
|
303
363
|
|
|
@@ -329,6 +389,19 @@ function settingsCard() {
|
|
|
329
389
|
|
|
330
390
|
let lastCls = "", hovering = false, closing = false, dragging = false, endingDrag = false;
|
|
331
391
|
let dragReady = Promise.resolve();
|
|
392
|
+
let attentionPointer = null;
|
|
393
|
+
let renderedAttention = null;
|
|
394
|
+
|
|
395
|
+
function updateAttentionCountdown() {
|
|
396
|
+
const a = V.attention;
|
|
397
|
+
const card = root.querySelector(".prompt.attention-target");
|
|
398
|
+
if (card) card.title = [a.message, a.remaining ? "剩 " + a.remaining : "",
|
|
399
|
+
a.more ? "另有 " + a.more + " 项" : ""].filter(Boolean).join(" · ");
|
|
400
|
+
const countdown = root.querySelector(".attention-countdown");
|
|
401
|
+
if (!countdown || countdown.textContent === (a.remaining || "")) return false;
|
|
402
|
+
countdown.textContent = a.remaining || "";
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
332
405
|
|
|
333
406
|
function render(force) {
|
|
334
407
|
if (closing || dragging) return;
|
|
@@ -341,12 +414,21 @@ function render(force) {
|
|
|
341
414
|
else if (V.mode === "done") html = doneCard();
|
|
342
415
|
else html = idleCard();
|
|
343
416
|
const cls = shape + (V.mode === "attention" && panel !== "settings" ? " warn" : "");
|
|
344
|
-
|
|
417
|
+
const attention = V.mode === "attention" && panel !== "settings";
|
|
418
|
+
const sameTask = !attention || (renderedAttention?.current === V.current
|
|
419
|
+
&& renderedAttention?.run_id === V.run_id);
|
|
420
|
+
const unchanged = !force && sameTask && html === lastHtml && cls === lastCls;
|
|
421
|
+
// Keep the real button (and its pointer/focus target) through countdown ticks.
|
|
422
|
+
if (unchanged && (!attention || !updateAttentionCountdown())) return;
|
|
345
423
|
const previous = root.getBoundingClientRect();
|
|
346
424
|
root.style.width = ""; root.style.height = "";
|
|
347
425
|
root.style.removeProperty("--content-max-height");
|
|
348
|
-
|
|
349
|
-
|
|
426
|
+
if (!unchanged) {
|
|
427
|
+
root.className = cls + " capsule-drag-region" + (cls !== lastCls ? " fade" : "");
|
|
428
|
+
root.innerHTML = '<div class="surface">' + html + "</div>";
|
|
429
|
+
if (attention) updateAttentionCountdown();
|
|
430
|
+
renderedAttention = attention ? V : null;
|
|
431
|
+
}
|
|
350
432
|
lastHtml = html;
|
|
351
433
|
lastCls = cls;
|
|
352
434
|
fit(previous);
|
|
@@ -437,6 +519,7 @@ async function act(action, target) {
|
|
|
437
519
|
case "minimize": open = false; panel = ""; render(true); return api().minimize(); // back as a capsule when restored
|
|
438
520
|
case "close": closing = true; ++fitGeneration; clearInterval(pollTimer); clearTimeout(hoverTimer); clearTimeout(leaveTimer); return api().request_close(); // no call left waiting on a closed page
|
|
439
521
|
case "folder": return api().open_folder();
|
|
522
|
+
case "group": return toggleGroup(Number(target.dataset.group));
|
|
440
523
|
case "show_browser": {
|
|
441
524
|
try { await inputActivation; }
|
|
442
525
|
catch (error) { return say("未能激活进度窗口,请重试"); }
|
|
@@ -491,9 +574,14 @@ async function act(action, target) {
|
|
|
491
574
|
}
|
|
492
575
|
}
|
|
493
576
|
|
|
494
|
-
|
|
577
|
+
// A paper list scrolls; pressing in it must not drag the window.
|
|
578
|
+
const interactive = (target) => target.closest('button, input, select, textarea, a, [contenteditable="true"], [role="button"], .paper-list');
|
|
495
579
|
root.addEventListener("pointerdown", (event) => {
|
|
496
580
|
if (event.button === 0 && api().activate_on_input) inputActivation = api().activate_on_input();
|
|
581
|
+
if (event.button === 0 && event.target.closest(".attention-target")) {
|
|
582
|
+
attentionPointer = event.pointerId;
|
|
583
|
+
clearTimeout(hoverTimer); clearTimeout(leaveTimer);
|
|
584
|
+
}
|
|
497
585
|
if (event.button !== 0 || interactive(event.target)) return;
|
|
498
586
|
dragging = true;
|
|
499
587
|
++hoverRequest;
|
|
@@ -555,7 +643,7 @@ function setHover(inside, force = false) {
|
|
|
555
643
|
if (!force && hovering === inside && (!inside || open)) return;
|
|
556
644
|
hovering = inside;
|
|
557
645
|
clearTimeout(hoverTimer); clearTimeout(leaveTimer);
|
|
558
|
-
if (dragging) return;
|
|
646
|
+
if (dragging || attentionPointer !== null) return;
|
|
559
647
|
if (inside) {
|
|
560
648
|
hoverTimer = setTimeout(() => { if (!open) { open = true; render(true); } }, 100);
|
|
561
649
|
} else {
|
|
@@ -586,7 +674,18 @@ async function observeHover(inside, force = false) {
|
|
|
586
674
|
setHover(pointer.inside, force);
|
|
587
675
|
}
|
|
588
676
|
root.addEventListener("mouseenter", () => observeHover(true));
|
|
589
|
-
root.addEventListener("mouseleave", () =>
|
|
677
|
+
root.addEventListener("mouseleave", () => {
|
|
678
|
+
attentionPointer = null;
|
|
679
|
+
observeHover(false);
|
|
680
|
+
});
|
|
681
|
+
function endAttentionPress(event) {
|
|
682
|
+
if (attentionPointer === null || (event.pointerId !== undefined && attentionPointer !== event.pointerId)) return;
|
|
683
|
+
attentionPointer = null;
|
|
684
|
+
observeHover(root.matches(":hover"), true);
|
|
685
|
+
}
|
|
686
|
+
window.addEventListener("pointerup", endAttentionPress);
|
|
687
|
+
window.addEventListener("pointercancel", endAttentionPress);
|
|
688
|
+
window.addEventListener("blur", endAttentionPress);
|
|
590
689
|
document.addEventListener("keydown", (event) => {
|
|
591
690
|
if (event.key === "Escape" && panel) { panel = ""; render(true); }
|
|
592
691
|
if (event.key === "Enter" && panel === "settings") act("save");
|