@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,115 @@
|
|
|
1
|
+
// Turn tokens: under every finished agent turn, beside the turn's time in
|
|
2
|
+
// its toolbar, one plain line of what the turn's model calls used:
|
|
3
|
+
// "2.5k in · 358 out · 142k cache"
|
|
4
|
+
// Each model call stores its usage on the step it produced
|
|
5
|
+
// (CortexStepMetadata.modelUsage); the line sums them over the turn, the same
|
|
6
|
+
// totals the app's own flag-gated cost summary lists as Input, Cache, Output.
|
|
7
|
+
// in input + cache-write tokens (prompt the provider had to process)
|
|
8
|
+
// out output tokens (thinking included)
|
|
9
|
+
// cache cache-read tokens (left out when 0)
|
|
10
|
+
// Read-only: the turn's steps come from the toolbar's React props. The span
|
|
11
|
+
// carries the time label's own classes, so each theme styles it as the time.
|
|
12
|
+
function agyTurnTokens() {
|
|
13
|
+
const TOOLBAR = '[data-testid="cascade-system-message-toolbar"]';
|
|
14
|
+
const CLASSES = 'agy-turn-tokens text-xs text-muted-foreground px-1 whitespace-nowrap tabular-nums';
|
|
15
|
+
|
|
16
|
+
const num = (v) => Number(v ?? 0) || 0;
|
|
17
|
+
const fmt = (n) => (n >= 999500 ? `${+(n / 1e6).toFixed(1)}M`
|
|
18
|
+
: n >= 9950 ? `${Math.round(n / 1e3)}k`
|
|
19
|
+
: n >= 1000 ? `${+(n / 1e3).toFixed(1)}k`
|
|
20
|
+
: String(n));
|
|
21
|
+
const fiberOf = (el) => el && el[Object.keys(el).find((k) => k.startsWith('__reactFiber$'))];
|
|
22
|
+
|
|
23
|
+
// The toolbar's component gets the turn's steps (and showThumbsUpDown)
|
|
24
|
+
function stepsOf(toolbar) {
|
|
25
|
+
let f = fiberOf(toolbar);
|
|
26
|
+
for (let i = 0; f && i < 8; i++, f = f.return) {
|
|
27
|
+
const p = f.memoizedProps;
|
|
28
|
+
if (Array.isArray(p?.steps) && 'showThumbsUpDown' in p) return p.steps;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function lineFor(steps) {
|
|
33
|
+
let input = 0, output = 0, cache = 0;
|
|
34
|
+
for (const s of steps) {
|
|
35
|
+
const u = s?.metadata?.modelUsage;
|
|
36
|
+
if (!u) continue;
|
|
37
|
+
input += num(u.inputTokens) + num(u.cacheWriteTokens);
|
|
38
|
+
output += num(u.outputTokens);
|
|
39
|
+
cache += num(u.cacheReadTokens);
|
|
40
|
+
}
|
|
41
|
+
if (!input && !output) return '';
|
|
42
|
+
return [`${fmt(input)} in`, `${fmt(output)} out`, cache ? `${fmt(cache)} cache` : ''].filter(Boolean).join(' · ');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// toolbar -> { steps, el } it was labelled for: a labelled toolbar costs a
|
|
46
|
+
// few property reads, no DOM queries
|
|
47
|
+
const labelled = new WeakMap();
|
|
48
|
+
function label(toolbar) {
|
|
49
|
+
const steps = stepsOf(toolbar);
|
|
50
|
+
const prev = labelled.get(toolbar);
|
|
51
|
+
if (prev && prev.steps === steps && (!prev.el || prev.el.isConnected)) return;
|
|
52
|
+
const group = toolbar.querySelector(':scope > div > div.ml-auto'); // time, copy, thumbs
|
|
53
|
+
if (!group) return;
|
|
54
|
+
const text = steps ? lineFor(steps) : '';
|
|
55
|
+
let el = group.querySelector(':scope > .agy-turn-tokens');
|
|
56
|
+
if (!text) {
|
|
57
|
+
el?.remove();
|
|
58
|
+
labelled.set(toolbar, { steps, el: null });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!el) {
|
|
62
|
+
el = document.createElement('span');
|
|
63
|
+
el.className = CLASSES;
|
|
64
|
+
group.prepend(el);
|
|
65
|
+
}
|
|
66
|
+
if (el.textContent !== text) el.textContent = text;
|
|
67
|
+
labelled.set(toolbar, { steps, el });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// A toolbar mounts when its turn finishes: look inside what the transcript
|
|
71
|
+
// adds (small subtrees while a reply streams), and rescan it every 2s for
|
|
72
|
+
// the rest (a new viewport after navigation, steps that changed in place)
|
|
73
|
+
let viewport = null, observer = null;
|
|
74
|
+
function onMutations(records) {
|
|
75
|
+
try {
|
|
76
|
+
for (const r of records) {
|
|
77
|
+
for (const n of r.addedNodes) {
|
|
78
|
+
if (n.nodeType !== 1 || n.classList.contains('agy-turn-tokens')) continue;
|
|
79
|
+
if (n.matches(TOOLBAR)) label(n);
|
|
80
|
+
else n.querySelectorAll(TOOLBAR).forEach(label);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
// app internals changed: leave the toolbars as they are
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function scan() {
|
|
88
|
+
if (document.hidden) return;
|
|
89
|
+
const vp = document.querySelector('[data-testid="autoscroll-viewport"]');
|
|
90
|
+
if (vp !== viewport) {
|
|
91
|
+
observer?.disconnect();
|
|
92
|
+
viewport = vp;
|
|
93
|
+
if (vp) {
|
|
94
|
+
observer = new MutationObserver(onMutations);
|
|
95
|
+
observer.observe(vp, { childList: true, subtree: true });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
viewport?.querySelectorAll(TOOLBAR).forEach(label);
|
|
100
|
+
} catch {
|
|
101
|
+
// as above
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const timer = setInterval(scan, 2000);
|
|
106
|
+
scan();
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
dispose() {
|
|
110
|
+
clearInterval(timer);
|
|
111
|
+
observer?.disconnect();
|
|
112
|
+
document.querySelectorAll('.agy-turn-tokens').forEach((el) => el.remove());
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"default": "matte",
|
|
3
|
+
"themes": {
|
|
4
|
+
"antigravity": [],
|
|
5
|
+
"matte": ["matte.css"],
|
|
6
|
+
"paper": ["paper.css"],
|
|
7
|
+
"nordic": ["nordic.css"],
|
|
8
|
+
"md3e": ["md3e-tokens.css", "md3e.css", "md3e-icons.css"]
|
|
9
|
+
},
|
|
10
|
+
"fonts": {
|
|
11
|
+
"md3e": [
|
|
12
|
+
{ "family": "Roboto", "file": "../vendor/md3e/roboto-variable.woff2", "weight": "100 900", "stretch": "75% 100%" }
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
"ripple": ["md3e"],
|
|
16
|
+
"options": [
|
|
17
|
+
{ "key": "antigravity", "name": "Antigravity (Varsayılan)", "theme": "antigravity", "swatch": "transparent" },
|
|
18
|
+
{ "key": "matte", "name": "Matte", "theme": "matte", "swatch": "#ededee" },
|
|
19
|
+
{ "key": "paper", "name": "E-Ink / Paper", "theme": "paper", "swatch": "#e5e5e5" },
|
|
20
|
+
{ "key": "nordic", "name": "Nordic Frost", "theme": "nordic", "swatch": "#88c0d0" },
|
|
21
|
+
{ "key": "md3e-teal", "name": "Teal", "theme": "md3e", "seed": "teal", "swatch": "#a5faf9" },
|
|
22
|
+
{ "key": "md3e-ocean", "name": "Ocean", "theme": "md3e", "seed": "ocean", "swatch": "#9ecefe" },
|
|
23
|
+
{ "key": "md3e-forest", "name": "Forest", "theme": "md3e", "seed": "forest", "swatch": "#c8f2ae" },
|
|
24
|
+
{ "key": "md3e-amber", "name": "Amber", "theme": "md3e", "seed": "amber", "swatch": "#fecd79" },
|
|
25
|
+
{ "key": "md3e-coral", "name": "Coral", "theme": "md3e", "seed": "coral", "swatch": "#ffa6a8" }
|
|
26
|
+
]
|
|
27
|
+
}
|