@materialwebunofficial/antigravity-themes 0.0.0-stage → 1.0.0
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/LICENSE +201 -0
- package/NOTICE +30 -0
- package/README.md +261 -2
- package/bin/cli.mjs +252 -0
- package/lib/autostart.mjs +70 -0
- package/lib/bundle.mjs +73 -0
- package/lib/injector.mjs +176 -0
- package/lib/paths.mjs +28 -0
- package/package.json +40 -4
- package/src/code-tools.js +131 -0
- package/src/context-card.js +536 -0
- package/src/loading-indicator.js +74 -0
- package/src/progress-indicators.js +98 -0
- package/src/theme-host.js +709 -0
- package/src/turn-tokens.js +115 -0
- package/themes/index.json +21 -0
- package/themes/matte.css +390 -0
- package/themes/md3e-icons.css +244 -0
- package/themes/md3e-tokens.css +834 -0
- package/themes/md3e.css +1206 -0
- package/vendor/md3e/LICENSE +176 -0
- package/vendor/md3e/NOTICE +686 -0
- package/vendor/md3e/Roboto-OFL.txt +93 -0
- package/vendor/md3e/SOURCE.txt +10 -0
- package/vendor/md3e/components.js +4682 -0
- package/vendor/md3e/roboto-variable.woff2 +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Loading indicator: in MD3E, the agent's "Working" / "Compacting" row
|
|
2
|
+
// gets the package's own <md-loading-indicator> in front of its text: the
|
|
3
|
+
// Compose LoadingIndicator port in vendor/md3e/components.js (seven matched cubic morphs,
|
|
4
|
+
// spring 0.6 / 200, a new shape every 650ms with a quarter turn, one full
|
|
5
|
+
// turn every 4666ms), drawn in primary. md3e.css stills the row's shimmer
|
|
6
|
+
// text, so the indicator is the one thing moving.
|
|
7
|
+
//
|
|
8
|
+
// Other themes keep the app's row as it is: this module's own rule hides the
|
|
9
|
+
// element unless the page is MD3E (theme CSS comes and goes with the theme,
|
|
10
|
+
// and the element's :host display would beat a UA [hidden]).
|
|
11
|
+
// The element lives in the row React renders; when the run ends the row
|
|
12
|
+
// unmounts and the component stops its own animation frame loop.
|
|
13
|
+
function agyLoadingIndicator() {
|
|
14
|
+
const ROW = '[data-testid="agent-loading"]';
|
|
15
|
+
if (!customElements.get('md-loading-indicator')) return null; // vendor script missing
|
|
16
|
+
|
|
17
|
+
const style = document.createElement('style');
|
|
18
|
+
style.id = 'agy-loader-css';
|
|
19
|
+
style.textContent = `
|
|
20
|
+
.agy-loader { display: none; }
|
|
21
|
+
:root[data-agy-theme="md3e"] .agy-loader { display: flex; }`; /* flex: no line box around the 24px canvas */
|
|
22
|
+
(document.head || document.documentElement).appendChild(style);
|
|
23
|
+
|
|
24
|
+
function decorate(row) {
|
|
25
|
+
if (row.querySelector(':scope > .agy-loader')) return;
|
|
26
|
+
const el = document.createElement('md-loading-indicator');
|
|
27
|
+
el.className = 'agy-loader';
|
|
28
|
+
el.setAttribute('size', '24');
|
|
29
|
+
el.setAttribute('aria-hidden', 'true'); // the row's text already says it
|
|
30
|
+
row.prepend(el);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// The row mounts about a second into a run: look inside what the
|
|
34
|
+
// transcript adds, and rescan every 2s for a replaced viewport
|
|
35
|
+
let viewport = null, observer = null;
|
|
36
|
+
function onMutations(records) {
|
|
37
|
+
try {
|
|
38
|
+
for (const r of records) {
|
|
39
|
+
for (const n of r.addedNodes) {
|
|
40
|
+
if (n.nodeType !== 1 || n.classList.contains('agy-loader')) continue;
|
|
41
|
+
if (n.matches(ROW)) decorate(n);
|
|
42
|
+
else n.querySelectorAll(ROW).forEach(decorate);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
// app internals changed: leave the row as it is
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function scan() {
|
|
50
|
+
if (document.hidden) return;
|
|
51
|
+
const vp = document.querySelector('[data-testid="autoscroll-viewport"]');
|
|
52
|
+
if (vp !== viewport) {
|
|
53
|
+
observer?.disconnect();
|
|
54
|
+
viewport = vp;
|
|
55
|
+
if (vp) {
|
|
56
|
+
observer = new MutationObserver(onMutations);
|
|
57
|
+
observer.observe(vp, { childList: true, subtree: true });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
viewport?.querySelectorAll(ROW).forEach(decorate);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const timer = setInterval(scan, 2000);
|
|
64
|
+
scan();
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
dispose() {
|
|
68
|
+
clearInterval(timer);
|
|
69
|
+
observer?.disconnect();
|
|
70
|
+
document.querySelectorAll('.agy-loader').forEach((el) => el.remove());
|
|
71
|
+
style.remove();
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Progress indicators: in MD3E, running work gets the package's own
|
|
2
|
+
// <md-progress-indicator variant="wavy" indeterminate> (vendor/md3e/
|
|
3
|
+
// components.js, its Compose LinearWavyProgressIndicator port: two segments
|
|
4
|
+
// travelling along a 20px wave over a secondary-container track, in primary):
|
|
5
|
+
// - a running Background Commands row in the Overview panel: a bar along
|
|
6
|
+
// the row's bottom edge, under the label
|
|
7
|
+
// - the "N tasks running" status under the latest turn: a short bar in
|
|
8
|
+
// front of the text
|
|
9
|
+
// md3e.css sizes them and stills what they replace (the terminal glyph's
|
|
10
|
+
// blinking caret, the status text's shimmer). The app's own 12-16px spinners
|
|
11
|
+
// stay: the package's circular indicator is a fixed 40/48px.
|
|
12
|
+
//
|
|
13
|
+
// A bar follows its host: added while the host shows the app's running mark,
|
|
14
|
+
// removed when it goes. Other themes keep the app's markup; this module's own
|
|
15
|
+
// rule hides the bars unless the page is MD3E.
|
|
16
|
+
function agyProgressIndicators() {
|
|
17
|
+
if (!customElements.get('md-progress-indicator')) return null; // vendor script missing
|
|
18
|
+
const TARGETS = [
|
|
19
|
+
{ host: '[data-testid="background-task-row"]', running: '[data-testid="status-task-running"]', place: 'append', cls: 'agy-progress' },
|
|
20
|
+
{ host: '[data-testid="idle-status-text"]', running: '.animate-shimmer-text', place: 'prepend', cls: 'agy-progress' },
|
|
21
|
+
];
|
|
22
|
+
const HOSTS = TARGETS.map((t) => t.host).join(', ');
|
|
23
|
+
|
|
24
|
+
const style = document.createElement('style');
|
|
25
|
+
style.id = 'agy-progress-css';
|
|
26
|
+
style.textContent = `
|
|
27
|
+
.agy-progress { display: none; }
|
|
28
|
+
:root[data-agy-theme="md3e"] .agy-progress { display: block; }`;
|
|
29
|
+
(document.head || document.documentElement).appendChild(style);
|
|
30
|
+
|
|
31
|
+
function sync(host) {
|
|
32
|
+
const target = TARGETS.find((t) => host.matches(t.host));
|
|
33
|
+
if (!target) return;
|
|
34
|
+
const bar = host.querySelector(':scope > .agy-progress');
|
|
35
|
+
const running = !!host.querySelector(target.running);
|
|
36
|
+
if (running && !bar) {
|
|
37
|
+
const el = document.createElement('md-progress-indicator');
|
|
38
|
+
el.className = target.cls;
|
|
39
|
+
el.setAttribute('variant', 'wavy');
|
|
40
|
+
el.setAttribute('indeterminate', '');
|
|
41
|
+
el.setAttribute('aria-hidden', 'true'); // the host's own mark and text already say it
|
|
42
|
+
if (target.place === 'append') host.append(el);
|
|
43
|
+
else host.prepend(el);
|
|
44
|
+
} else if (!running && bar) {
|
|
45
|
+
bar.remove();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Hosts mount, and switch their running mark, inside the transcript and the
|
|
50
|
+
// Overview panel: look only at the hosts a change touches, and rescan the
|
|
51
|
+
// page every 2s for the rest (replaced roots, missed changes)
|
|
52
|
+
function onMutations(records) {
|
|
53
|
+
try {
|
|
54
|
+
const hosts = new Set();
|
|
55
|
+
for (const r of records) {
|
|
56
|
+
const el = r.target.nodeType === 1 ? r.target : r.target.parentElement;
|
|
57
|
+
const host = el?.closest(HOSTS);
|
|
58
|
+
if (host) hosts.add(host);
|
|
59
|
+
for (const n of r.addedNodes) {
|
|
60
|
+
if (n.nodeType !== 1 || n.classList.contains('agy-progress')) continue;
|
|
61
|
+
if (n.matches(HOSTS)) hosts.add(n);
|
|
62
|
+
else n.querySelectorAll(HOSTS).forEach((h) => hosts.add(h));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
hosts.forEach(sync);
|
|
66
|
+
} catch {
|
|
67
|
+
// app internals changed: leave the hosts as they are
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const observer = new MutationObserver(onMutations);
|
|
71
|
+
let roots = [];
|
|
72
|
+
function scan() {
|
|
73
|
+
if (document.hidden) return;
|
|
74
|
+
const next = [document.querySelector('[data-testid="autoscroll-viewport"]'), document.querySelector('[data-testid="overview-panel"]')].filter(Boolean);
|
|
75
|
+
if (next.length !== roots.length || next.some((r, i) => r !== roots[i])) {
|
|
76
|
+
observer.disconnect();
|
|
77
|
+
roots = next;
|
|
78
|
+
for (const r of roots) observer.observe(r, { childList: true, subtree: true });
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
document.querySelectorAll(HOSTS).forEach(sync);
|
|
82
|
+
} catch {
|
|
83
|
+
// as above
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const timer = setInterval(scan, 2000);
|
|
88
|
+
scan();
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
dispose() {
|
|
92
|
+
clearInterval(timer);
|
|
93
|
+
observer.disconnect();
|
|
94
|
+
document.querySelectorAll('.agy-progress').forEach((el) => el.remove());
|
|
95
|
+
style.remove();
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|