agy-git-graph 1.2.0 → 1.2.2
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/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-git-graph",
|
|
3
3
|
"displayName": "Git Graph (提交图)",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"description": "在 Antigravity 左侧导航栏挂载一键快捷按钮,点击保留当前会话并弹出/收起右侧 Git 面板:查看工作区更改、提交代码、按分支筛选并浏览多分支可视化提交图与单次提交 Diff。",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "s17765152890-gif",
|
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
|
|
5
|
-
const INJECT_VERSION = '1.2.
|
|
5
|
+
const INJECT_VERSION = '1.2.2';
|
|
6
6
|
const SIDECAR_ID = 'agy-git-graph/git_graph';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -79,9 +79,17 @@ export function buildSidebarInjectionScript({ sidecarId = SIDECAR_ID } = {}) {
|
|
|
79
79
|
const isOfficialSidePanelOpen = () =>
|
|
80
80
|
document.querySelector('[data-testid="toggle-aux-sidebar"]')?.getAttribute('aria-expanded') === 'true';
|
|
81
81
|
|
|
82
|
-
const isGitGraphVisible = () =>
|
|
83
|
-
isOfficialSidePanelOpen()
|
|
84
|
-
document.
|
|
82
|
+
const isGitGraphVisible = () => {
|
|
83
|
+
if (!isOfficialSidePanelOpen()) return false;
|
|
84
|
+
const slots = document.querySelectorAll(
|
|
85
|
+
\`[data-testid="sidecar-iframe-slot"][data-sidecar-id="\${SIDECAR_ID}"][data-visible="true"]\`
|
|
86
|
+
);
|
|
87
|
+
for (const slot of slots) {
|
|
88
|
+
const rect = slot.getBoundingClientRect();
|
|
89
|
+
if (rect.width > 0 && rect.height > 0) return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
85
93
|
|
|
86
94
|
const updateButtonState = () => {
|
|
87
95
|
const btn = document.querySelector(\`[\${BTN_ATTR}="sidebar-btn"]\`);
|
|
@@ -89,11 +97,11 @@ export function buildSidebarInjectionScript({ sidecarId = SIDECAR_ID } = {}) {
|
|
|
89
97
|
const active = isGitGraphVisible();
|
|
90
98
|
btn.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
91
99
|
if (active) {
|
|
92
|
-
btn.classList.add('bg-
|
|
93
|
-
btn.classList.remove('bg-transparent', 'text-secondary-foreground');
|
|
100
|
+
btn.classList.add('bg-background', 'text-foreground');
|
|
101
|
+
btn.classList.remove('bg-transparent', 'text-secondary-foreground', 'hover:bg-sidebar-muted');
|
|
94
102
|
} else {
|
|
95
|
-
btn.classList.remove('bg-
|
|
96
|
-
btn.classList.add('bg-transparent', 'text-secondary-foreground');
|
|
103
|
+
btn.classList.remove('bg-background', 'text-foreground');
|
|
104
|
+
btn.classList.add('bg-transparent', 'text-secondary-foreground', 'hover:bg-sidebar-muted');
|
|
97
105
|
}
|
|
98
106
|
};
|
|
99
107
|
|
|
@@ -204,7 +212,7 @@ export function buildSidebarInjectionScript({ sidecarId = SIDECAR_ID } = {}) {
|
|
|
204
212
|
childList: true,
|
|
205
213
|
subtree: true,
|
|
206
214
|
attributes: true,
|
|
207
|
-
attributeFilter: ['aria-expanded', 'data-visible'],
|
|
215
|
+
attributeFilter: ['aria-expanded', 'data-visible', 'style'],
|
|
208
216
|
});
|
|
209
217
|
mountSidebarButton();
|
|
210
218
|
|