@materialwebunofficial/antigravity-themes 0.0.0-stage → 1.0.4
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 +294 -2
- package/bin/cli.mjs +324 -0
- package/lib/autostart.mjs +90 -0
- package/lib/bundle.mjs +73 -0
- package/lib/injector.mjs +176 -0
- package/lib/paths.mjs +35 -0
- package/package.json +40 -4
- package/src/code-tools.js +137 -0
- package/src/context-card.js +542 -0
- package/src/loading-indicator.js +74 -0
- package/src/progress-indicators.js +98 -0
- package/src/theme-host.js +904 -0
- package/src/turn-tokens.js +115 -0
- package/themes/index.json +27 -0
- package/themes/matte.css +588 -0
- package/themes/md3e-icons.css +244 -0
- package/themes/md3e-tokens.css +834 -0
- package/themes/md3e.css +1400 -0
- package/themes/nordic.css +370 -0
- package/themes/paper.css +414 -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,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
|
+
}
|