dsh-focus-overlay 0.7.0 → 0.7.1
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 +14 -4
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -477,6 +477,7 @@ window.__ModuleLoader__.load({
|
|
|
477
477
|
const [activeKey, setActiveKey] = (0, react.useState)(navKeys.length ? navKeys[navKeys.length - 1] : null);
|
|
478
478
|
const [atBottom, setAtBottom] = (0, react.useState)(true);
|
|
479
479
|
const rafId = (0, react.useRef)(null);
|
|
480
|
+
const overlayRef = (0, react.useRef)(null);
|
|
480
481
|
const computeActive = () => {
|
|
481
482
|
if (!bodyEl) return null;
|
|
482
483
|
let cur = null;
|
|
@@ -545,6 +546,18 @@ window.__ModuleLoader__.load({
|
|
|
545
546
|
setActiveKey(navKeys.length ? navKeys[navKeys.length - 1] : null);
|
|
546
547
|
}
|
|
547
548
|
}, []);
|
|
549
|
+
(0, react.useEffect)(() => {
|
|
550
|
+
overlayRef.current?.focus();
|
|
551
|
+
const onKey = (e) => {
|
|
552
|
+
if (e.key === "Escape") {
|
|
553
|
+
e.preventDefault();
|
|
554
|
+
e.stopPropagation();
|
|
555
|
+
focusStore.set(false);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
window.addEventListener("keydown", onKey, true);
|
|
559
|
+
return () => window.removeEventListener("keydown", onKey, true);
|
|
560
|
+
}, []);
|
|
548
561
|
const loadImage = (0, react.useCallback)((attachment) => {
|
|
549
562
|
if (!conversation || !currentId) return Promise.reject(/* @__PURE__ */ new Error("dsh-focus-overlay: conversation service unavailable"));
|
|
550
563
|
return conversation.resolveImage(currentId, attachment);
|
|
@@ -725,11 +738,8 @@ window.__ModuleLoader__.load({
|
|
|
725
738
|
}) : null;
|
|
726
739
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
727
740
|
className: "fm-overlay",
|
|
741
|
+
ref: overlayRef,
|
|
728
742
|
tabIndex: -1,
|
|
729
|
-
autoFocus: true,
|
|
730
|
-
onKeyDown: (e) => {
|
|
731
|
-
if (e && e.key === "Escape") focusStore.set(false);
|
|
732
|
-
},
|
|
733
743
|
children: [
|
|
734
744
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
735
745
|
className: "fm-topbar",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-focus-overlay",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Focus Mode for the dsh web GUI: a full-screen reading overlay that hides chrome and folds the AI tool-call flow into summaries, reusing the official Markdown / image primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|