safari-mcp 2.10.6 → 2.10.8
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/mcp-helpers.js +12 -0
- package/package.json +1 -1
- package/safari.js +10 -3
package/mcp-helpers.js
CHANGED
|
@@ -166,6 +166,18 @@ if (window.__mcpVersion !== 6) {
|
|
|
166
166
|
}
|
|
167
167
|
} catch (e) {}
|
|
168
168
|
target.dispatchEvent(new MouseEvent('click', { ...s, buttons: 0 }));
|
|
169
|
+
// Vue v-model / Lit @change / framework-agnostic toggle sync — for checkbox/radio,
|
|
170
|
+
// Vue 3 listens for `change` via v-model; some Vue components subscribe to `input` instead.
|
|
171
|
+
// Native target.click() fires both, but in production-stripped Vue apps (no fiber/proxy
|
|
172
|
+
// visible), the reactivity sometimes misses the events when fired in the same microtask
|
|
173
|
+
// as a synthetic click. Belt-and-suspenders: re-dispatch input+change with composed:true
|
|
174
|
+
// and reset React's _valueTracker so subsequent submits see the new value.
|
|
175
|
+
if (target.tagName === 'INPUT' && (target.type === 'checkbox' || target.type === 'radio')) {
|
|
176
|
+
try { if (target._valueTracker && typeof target._valueTracker.setValue === 'function') target._valueTracker.setValue(''); } catch (_e) {}
|
|
177
|
+
var toggleOpts = { bubbles: true, cancelable: true, composed: true };
|
|
178
|
+
target.dispatchEvent(new Event('input', toggleOpts));
|
|
179
|
+
target.dispatchEvent(new Event('change', toggleOpts));
|
|
180
|
+
}
|
|
169
181
|
if (href && href !== beforeUrl) {
|
|
170
182
|
location.href = href;
|
|
171
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "safari-mcp",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.8",
|
|
4
4
|
"mcpName": "io.github.achiya-automation/safari-mcp",
|
|
5
5
|
"description": "Safari browser automation for AI agents — native macOS, zero Chrome overhead. 80 tools via AppleScript + JavaScript.",
|
|
6
6
|
"type": "module",
|
package/safari.js
CHANGED
|
@@ -727,14 +727,21 @@ async function _getSafariWindowGeometry() {
|
|
|
727
727
|
if (parts.length !== 5 || parts.some(isNaN)) {
|
|
728
728
|
throw new Error("Failed to parse Safari window geometry: " + boundsResult);
|
|
729
729
|
}
|
|
730
|
+
// Dynamic toolbar height: outerHeight - innerHeight gives total chrome above content
|
|
731
|
+
// (title bar + URL bar + tab strip + optional bookmarks bar). Hardcoded 74 was wrong
|
|
732
|
+
// for modern Safari (Sequoia+) where chrome is ~90px. Fall back to 74 if JS unreachable.
|
|
733
|
+
let toolbarHeight = 74;
|
|
734
|
+
try {
|
|
735
|
+
const chromeStr = await runJS(`(window.outerHeight - window.innerHeight) + ''`);
|
|
736
|
+
const chrome = Number(chromeStr);
|
|
737
|
+
if (Number.isFinite(chrome) && chrome >= 50 && chrome <= 200) toolbarHeight = chrome;
|
|
738
|
+
} catch (_e) { /* keep fallback */ }
|
|
730
739
|
return {
|
|
731
740
|
windowX: parts[0],
|
|
732
741
|
windowY: parts[1],
|
|
733
742
|
windowRight: parts[2],
|
|
734
743
|
windowBottom: parts[3],
|
|
735
|
-
|
|
736
|
-
// This is approximate — varies with compact tabs, bookmarks bar, etc.
|
|
737
|
-
toolbarHeight: 74,
|
|
744
|
+
toolbarHeight,
|
|
738
745
|
// CGWindow ID for background click targeting (no mouse move, no focus steal)
|
|
739
746
|
windowId: parts[4]
|
|
740
747
|
};
|