feat(panel): add experimental modern UI, sliding switchers, cycle range, and fluid animations

This commit is contained in:
fish
2026-11-19 15:05:27 +09:00
parent 70629dcd74
commit 367ca0cd6d
35 changed files with 5066 additions and 294 deletions
+17 -2
View File
@@ -47,6 +47,7 @@ import { SegmentedControl } from '../components/ui/SegmentedControl.js';
/** 消耗统计顶栏支持的时间范围预设项 */
function getConsumptionTimeRangeOptions() {
return [
{ value: 'cycle', label: t('cons.rangeCycle') },
{ value: 'today', label: t('cons.rangeToday') },
{ value: '24h', label: t('cons.range24h') },
{ value: '7d', label: t('cons.range7d') },
@@ -135,8 +136,7 @@ export const ConsumptionView = defineComponent({
const customRangeBar = h(
'div',
{
style:
'display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 8px; background: var(--surface-subtle); border: 1px solid var(--border-hairline); border-radius: var(--radius-xs);',
className: 'cons-custom-range-bar',
hidden: true,
},
[
@@ -338,6 +338,7 @@ export const ConsumptionView = defineComponent({
activeHoverTargetEl = null;
}
patchAttr(breakdownPopoverEl, 'hidden', true);
patchClasses(breakdownPopoverEl, { 'is-tracking': false });
}
function positionBreakdownPopover(anchorEl, pointerClientX = null) {
@@ -413,8 +414,22 @@ export const ConsumptionView = defineComponent({
},
});
const wasHidden = breakdownPopoverEl.hasAttribute('hidden');
patchAttr(breakdownPopoverEl, 'hidden', false);
positionBreakdownPopover(anchorEl, pointerClientX);
if (wasHidden) {
patchClasses(breakdownPopoverEl, { 'is-tracking': false });
void breakdownPopoverEl.offsetWidth;
if (typeof window !== 'undefined' && typeof window.requestAnimationFrame === 'function') {
window.requestAnimationFrame(() => {
if (!breakdownPopoverEl.hasAttribute('hidden')) {
patchClasses(breakdownPopoverEl, { 'is-tracking': true });
}
});
} else {
patchClasses(breakdownPopoverEl, { 'is-tracking': true });
}
}
}
function createMonthModelSegment() {