mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
fix(panel): prevent top pill nav overflow in narrow sidebar via minmax(0, 1fr) and @container stages
This commit is contained in:
@@ -4285,12 +4285,14 @@ const TopLongPillNav = defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
patchText(entry.labelEl, item.label);
|
patchText(entry.labelEl, item.label);
|
||||||
if (item.badge !== undefined && item.badge !== null && item.badge !== '') {
|
const hasBadge = item.badge !== undefined && item.badge !== null && item.badge !== '';
|
||||||
|
if (hasBadge) {
|
||||||
patchAttr(entry.badgeEl, 'hidden', false);
|
patchAttr(entry.badgeEl, 'hidden', false);
|
||||||
patchText(entry.badgeEl, `(${item.badge})`);
|
patchText(entry.badgeEl, `(${item.badge})`);
|
||||||
} else {
|
} else {
|
||||||
patchAttr(entry.badgeEl, 'hidden', true);
|
patchAttr(entry.badgeEl, 'hidden', true);
|
||||||
}
|
}
|
||||||
|
patchAttr(entry.btn, 'title', hasBadge ? `${item.label} (${item.badge})` : item.label);
|
||||||
|
|
||||||
const isActive = item.value === modelValue;
|
const isActive = item.value === modelValue;
|
||||||
patchClasses(entry.btn, { 'is-active': isActive });
|
patchClasses(entry.btn, { 'is-active': isActive });
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>用量监控</title>
|
<title>用量监控</title>
|
||||||
<link rel="stylesheet" href="/styles.css?v=1794973728117">
|
<link rel="stylesheet" href="/styles.css?v=1794974101279">
|
||||||
<script src="/preload.js"></script>
|
<script src="/preload.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app-root"></div>
|
<div id="app-root"></div>
|
||||||
<script src="/app.js?v=1794973728117"></script>
|
<script src="/app.js?v=1794974101279"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -90,12 +90,14 @@ export const TopLongPillNav = defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
patchText(entry.labelEl, item.label);
|
patchText(entry.labelEl, item.label);
|
||||||
if (item.badge !== undefined && item.badge !== null && item.badge !== '') {
|
const hasBadge = item.badge !== undefined && item.badge !== null && item.badge !== '';
|
||||||
|
if (hasBadge) {
|
||||||
patchAttr(entry.badgeEl, 'hidden', false);
|
patchAttr(entry.badgeEl, 'hidden', false);
|
||||||
patchText(entry.badgeEl, `(${item.badge})`);
|
patchText(entry.badgeEl, `(${item.badge})`);
|
||||||
} else {
|
} else {
|
||||||
patchAttr(entry.badgeEl, 'hidden', true);
|
patchAttr(entry.badgeEl, 'hidden', true);
|
||||||
}
|
}
|
||||||
|
patchAttr(entry.btn, 'title', hasBadge ? `${item.label} (${item.badge})` : item.label);
|
||||||
|
|
||||||
const isActive = item.value === modelValue;
|
const isActive = item.value === modelValue;
|
||||||
patchClasses(entry.btn, { 'is-active': isActive });
|
patchClasses(entry.btn, { 'is-active': isActive });
|
||||||
|
|||||||
@@ -117,13 +117,15 @@
|
|||||||
/* --- 2. 顶部药丸导航栏 (Top Long-Pill Navigation Bar) --- */
|
/* --- 2. 顶部药丸导航栏 (Top Long-Pill Navigation Bar) --- */
|
||||||
.long-pill-nav {
|
.long-pill-nav {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
container-type: inline-size;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(var(--pill-count, 4), 1fr);
|
grid-template-columns: repeat(var(--pill-count, 4), minmax(0, 1fr));
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
background: var(--surface-panel);
|
background: var(--surface-panel);
|
||||||
border: 1px solid var(--border-hairline);
|
border: 1px solid var(--border-hairline);
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +151,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
min-width: 0;
|
||||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||||
padding: 2px var(--space-2);
|
padding: 2px var(--space-2);
|
||||||
border: none;
|
border: none;
|
||||||
@@ -158,6 +161,7 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.15;
|
line-height: 1.15;
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
transition: color var(--dur-instant) var(--ease-fast);
|
transition: color var(--dur-instant) var(--ease-fast);
|
||||||
@@ -171,20 +175,60 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pill-tab-label,
|
.pill-tab-label {
|
||||||
.pill-tab-badge {
|
display: block;
|
||||||
display: inline-flex;
|
min-width: 0;
|
||||||
align-items: center;
|
overflow: hidden;
|
||||||
min-height: 14px;
|
text-overflow: ellipsis;
|
||||||
line-height: 1.15;
|
white-space: nowrap;
|
||||||
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pill-tab-badge {
|
.pill-tab-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-height: 14px;
|
||||||
|
line-height: 1.15;
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
font-size: var(--fs-base-sm);
|
font-size: var(--fs-base-sm);
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@container (max-width: 30em) {
|
||||||
|
.pill-tab {
|
||||||
|
gap: 3.5px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
font-size: var(--fs-md);
|
||||||
|
}
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
.pill-tab-badge {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 23em) {
|
||||||
|
.pill-tab {
|
||||||
|
gap: 0;
|
||||||
|
padding: 2px 3px;
|
||||||
|
}
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 17.5em) {
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.pill-tab-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.pill-tab:hover {
|
.pill-tab:hover {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
.cons-split-3 {
|
.cons-split-3 {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.cons-matrix-bottom {
|
.cons-matrix-bottom {
|
||||||
|
|||||||
@@ -477,7 +477,7 @@
|
|||||||
/* --- 4. 上下文双列图例网格 (Context 10-Channel Legend Grid) --- */
|
/* --- 4. 上下文双列图例网格 (Context 10-Channel Legend Grid) --- */
|
||||||
.ctx-legend-grid {
|
.ctx-legend-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 5px var(--space-4);
|
gap: 5px var(--space-4);
|
||||||
padding: 2px 0 0 0;
|
padding: 2px 0 0 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -490,6 +490,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: var(--space-2);
|
gap: var(--space-2);
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.legend-left {
|
.legend-left {
|
||||||
|
|||||||
@@ -488,13 +488,15 @@ html[data-standalone="true"] .app-shell {
|
|||||||
/* --- 2. 顶部药丸导航栏 (Top Long-Pill Navigation Bar) --- */
|
/* --- 2. 顶部药丸导航栏 (Top Long-Pill Navigation Bar) --- */
|
||||||
.long-pill-nav {
|
.long-pill-nav {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
container-type: inline-size;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(var(--pill-count, 4), 1fr);
|
grid-template-columns: repeat(var(--pill-count, 4), minmax(0, 1fr));
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
background: var(--surface-panel);
|
background: var(--surface-panel);
|
||||||
border: 1px solid var(--border-hairline);
|
border: 1px solid var(--border-hairline);
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
|
overflow: hidden;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,6 +522,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
min-width: 0;
|
||||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||||
padding: 2px var(--space-2);
|
padding: 2px var(--space-2);
|
||||||
border: none;
|
border: none;
|
||||||
@@ -529,6 +532,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
line-height: 1.15;
|
line-height: 1.15;
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
transition: color var(--dur-instant) var(--ease-fast);
|
transition: color var(--dur-instant) var(--ease-fast);
|
||||||
@@ -542,20 +546,60 @@ html[data-standalone="true"] .app-shell {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pill-tab-label,
|
.pill-tab-label {
|
||||||
.pill-tab-badge {
|
display: block;
|
||||||
display: inline-flex;
|
min-width: 0;
|
||||||
align-items: center;
|
overflow: hidden;
|
||||||
min-height: 14px;
|
text-overflow: ellipsis;
|
||||||
line-height: 1.15;
|
white-space: nowrap;
|
||||||
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pill-tab-badge {
|
.pill-tab-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
min-height: 14px;
|
||||||
|
line-height: 1.15;
|
||||||
margin-left: -2px;
|
margin-left: -2px;
|
||||||
font-size: var(--fs-base-sm);
|
font-size: var(--fs-base-sm);
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@container (max-width: 30em) {
|
||||||
|
.pill-tab {
|
||||||
|
gap: 3.5px;
|
||||||
|
padding: 2px 4px;
|
||||||
|
font-size: var(--fs-md);
|
||||||
|
}
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
}
|
||||||
|
.pill-tab-badge {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 23em) {
|
||||||
|
.pill-tab {
|
||||||
|
gap: 0;
|
||||||
|
padding: 2px 3px;
|
||||||
|
}
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 17.5em) {
|
||||||
|
.pill-tab .svg-icon {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.pill-tab-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.pill-tab:hover {
|
.pill-tab:hover {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
@@ -1680,7 +1724,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
/* --- 4. 上下文双列图例网格 (Context 10-Channel Legend Grid) --- */
|
/* --- 4. 上下文双列图例网格 (Context 10-Channel Legend Grid) --- */
|
||||||
.ctx-legend-grid {
|
.ctx-legend-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 5px var(--space-4);
|
gap: 5px var(--space-4);
|
||||||
padding: 2px 0 0 0;
|
padding: 2px 0 0 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -1693,6 +1737,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: var(--space-2);
|
gap: var(--space-2);
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.legend-left {
|
.legend-left {
|
||||||
@@ -1900,7 +1945,7 @@ html[data-standalone="true"] .app-shell {
|
|||||||
|
|
||||||
.cons-split-3 {
|
.cons-split-3 {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.cons-matrix-bottom {
|
.cons-matrix-bottom {
|
||||||
|
|||||||
@@ -809,10 +809,13 @@ test('post-compaction context preserves static channels + checkpoint summary, ca
|
|||||||
assert.equal(ctx2.assistantTokens, 600);
|
assert.equal(ctx2.assistantTokens, 600);
|
||||||
assert.equal(ctx2.totalTokens, 31_100);
|
assert.equal(ctx2.totalTokens, 31_100);
|
||||||
|
|
||||||
// Verify capsule 100% slot CSS and non-hardcoded compaction suffix color
|
// Verify capsule 100% slot CSS, non-hardcoded compaction suffix color, and narrow-width top pill nav containment
|
||||||
const stylesCss = fs.readFileSync(new URL('../styles.css', import.meta.url), 'utf8');
|
const stylesCss = fs.readFileSync(new URL('../styles.css', import.meta.url), 'utf8');
|
||||||
assert.match(stylesCss, /\.wm-ctx-seg\s*\{[^}]*width:\s*58px;/);
|
assert.match(stylesCss, /\.wm-ctx-seg\s*\{[^}]*width:\s*58px;/);
|
||||||
assert.match(stylesCss, /\.wm-ctx-pct\s*\{[^}]*max-width:\s*none;[^}]*overflow:\s*visible;[^}]*text-overflow:\s*clip;/s);
|
assert.match(stylesCss, /\.wm-ctx-pct\s*\{[^}]*max-width:\s*none;[^}]*overflow:\s*visible;[^}]*text-overflow:\s*clip;/s);
|
||||||
assert.match(stylesCss, /\.step-model-compact\s*\{[^}]*color:\s*var\(--accent-primary\);/);
|
assert.match(stylesCss, /\.step-model-compact\s*\{[^}]*color:\s*var\(--accent-primary\);/);
|
||||||
assert.doesNotMatch(stylesCss, /\.step-model-compact\s*\{[^}]*--metric-info/);
|
assert.doesNotMatch(stylesCss, /\.step-model-compact\s*\{[^}]*--metric-info/);
|
||||||
|
assert.match(stylesCss, /\.long-pill-nav\s*\{[^}]*container-type:\s*inline-size;[^}]*minmax\(0,\s*1fr\)[^}]*overflow:\s*hidden;/s);
|
||||||
|
assert.match(stylesCss, /\.pill-tab\s*\{[^}]*min-width:\s*0;/s);
|
||||||
|
assert.match(stylesCss, /@container\s*\(max-width:\s*30em\)\s*\{[\s\S]*?\.pill-tab-badge\s*\{\s*display:\s*none\s*!important;/);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user