social-agent-cli 2.1.0 → 2.1.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/core/page-watcher.ts +24 -11
- package/package.json +1 -1
package/core/page-watcher.ts
CHANGED
|
@@ -44,28 +44,41 @@ export async function injectWatcher(page: Page): Promise<void> {
|
|
|
44
44
|
const ariaModal = node.getAttribute('aria-modal');
|
|
45
45
|
const tag = node.tagName.toLowerCase();
|
|
46
46
|
|
|
47
|
-
// Dialog/Modal algılama
|
|
48
|
-
|
|
47
|
+
// Dialog/Modal algılama - standart + heuristik
|
|
48
|
+
const isDialog = role === 'dialog' || role === 'alertdialog' || ariaModal === 'true' || tag === 'dialog';
|
|
49
|
+
const style = window.getComputedStyle(node);
|
|
50
|
+
const isFloating = (style.position === 'fixed' || style.position === 'absolute') && style.zIndex && parseInt(style.zIndex) > 50;
|
|
51
|
+
const cls = (node.className?.toString?.() || '').toLowerCase();
|
|
52
|
+
const looksLikeModal = cls.match(/modal|dialog|popup|overlay|drawer|sheet|toast|snackbar|dropdown|popover/);
|
|
53
|
+
|
|
54
|
+
if (isDialog || (isFloating && looksLikeModal)) {
|
|
49
55
|
watcher.newDialogs.push({
|
|
50
56
|
role: role || tag,
|
|
51
57
|
ariaLabel: node.getAttribute('aria-label') || '',
|
|
52
58
|
text: node.textContent?.substring(0, 200) || '',
|
|
59
|
+
className: cls.substring(0, 100),
|
|
53
60
|
time: Date.now()
|
|
54
61
|
});
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
// Overlay/backdrop algılama
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
if (isFloating && !isDialog && !looksLikeModal) {
|
|
66
|
+
const area = node.offsetWidth * node.offsetHeight;
|
|
67
|
+
const screenArea = window.innerWidth * window.innerHeight;
|
|
68
|
+
// Ekranın %30'undan büyük fixed element = muhtemelen overlay
|
|
69
|
+
if (area > screenArea * 0.3) {
|
|
70
|
+
watcher.newOverlays.push({
|
|
71
|
+
tag: tag,
|
|
72
|
+
class: cls.substring(0, 100),
|
|
73
|
+
time: Date.now()
|
|
74
|
+
});
|
|
75
|
+
}
|
|
65
76
|
}
|
|
66
77
|
|
|
67
|
-
// Error mesajı algılama
|
|
68
|
-
|
|
78
|
+
// Error mesajı algılama - standart + heuristik
|
|
79
|
+
const isError = role === 'alert' || node.getAttribute('aria-live') === 'assertive';
|
|
80
|
+
const looksLikeError = cls.match(/error|warning|alert|danger|notification|banner/);
|
|
81
|
+
if (isError || looksLikeError) {
|
|
69
82
|
watcher.errors.push({
|
|
70
83
|
text: node.textContent?.substring(0, 300) || '',
|
|
71
84
|
time: Date.now()
|