mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
perf(panel): instant consumption time-range switching via pruned scope API and client preset cache
This commit is contained in:
@@ -920,13 +920,18 @@ export function createTrendAreaChart() {
|
||||
hmMonthsEl.appendChild(mEl);
|
||||
}
|
||||
|
||||
// 重建 7 行 × N 周列的每日小格子(一格一天)
|
||||
// 重建 7 行 × N 周列的每日小格子(一格一天),使用 DocumentFragment 一次性批量挂载减少重排
|
||||
while (hmGridEl.firstChild) hmGridEl.removeChild(hmGridEl.firstChild);
|
||||
hoveredCellEl = null;
|
||||
currentCellEls = new Array(slots.length);
|
||||
const gridFrag =
|
||||
typeof document !== 'undefined' && typeof document.createDocumentFragment === 'function'
|
||||
? document.createDocumentFragment()
|
||||
: null;
|
||||
const gridTarget = gridFrag || hmGridEl;
|
||||
|
||||
for (let pad = 0; pad < firstDow; pad++) {
|
||||
hmGridEl.appendChild(
|
||||
gridTarget.appendChild(
|
||||
h('span', { className: 'trend-hm-cell is-pad', 'aria-hidden': 'true' })
|
||||
);
|
||||
}
|
||||
@@ -945,9 +950,12 @@ export function createTrendAreaChart() {
|
||||
'data-hm-row': String(row),
|
||||
role: 'gridcell',
|
||||
});
|
||||
hmGridEl.appendChild(cellEl);
|
||||
gridTarget.appendChild(cellEl);
|
||||
currentCellEls[i] = cellEl;
|
||||
}
|
||||
if (gridFrag) {
|
||||
hmGridEl.appendChild(gridFrag);
|
||||
}
|
||||
|
||||
if (typeof requestAnimationFrame === 'function') {
|
||||
requestAnimationFrame(() => {
|
||||
|
||||
Reference in New Issue
Block a user