Add smooth animations across WebUI for modern feel
- Tab panels: fade-in with subtle translateY on switch - Cards: hover lift (translateY -2px), staggered entrance animation - Modals: spring-curve entrance with backdrop blur - Buttons: press feedback (scale down on :active) - Toggle switches: spring overshoot on knob transition - Toast: smooth bounce-in replaces jarring shake - Sections: animated height collapse/expand with chevron rotation - Command palette: slide-down entrance animation - Theme switch: smooth color transitions on key elements - Dashboard: section collapse animation, target row hover - Respects prefers-reduced-motion globally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -71,3 +71,23 @@ body.modal-open {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Smooth theme transitions ── */
|
||||||
|
body,
|
||||||
|
.card,
|
||||||
|
.template-card,
|
||||||
|
.modal-content,
|
||||||
|
.dashboard-target,
|
||||||
|
.perf-chart-card,
|
||||||
|
header {
|
||||||
|
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Respect reduced motion preference ── */
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
*, *::before, *::after {
|
||||||
|
animation-duration: 0.01ms !important;
|
||||||
|
animation-iteration-count: 1 !important;
|
||||||
|
transition-duration: 0.01ms !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,12 +23,13 @@ section {
|
|||||||
border: 2px dashed var(--border-color);
|
border: 2px dashed var(--border-color);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
min-height: 160px;
|
min-height: 160px;
|
||||||
transition: border-color 0.2s, background 0.2s;
|
transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-device-card:hover {
|
.add-device-card:hover {
|
||||||
border-color: var(--primary-color);
|
border-color: var(--primary-color);
|
||||||
background: rgba(33, 150, 243, 0.05);
|
background: rgba(33, 150, 243, 0.05);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-device-icon {
|
.add-device-icon {
|
||||||
@@ -55,13 +56,24 @@ section {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 12px 20px 20px;
|
padding: 12px 20px 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: transform 0.2s, box-shadow 0.2s;
|
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover {
|
.card:hover {
|
||||||
box-shadow: 0 4px 12px var(--shadow-color);
|
box-shadow: 0 8px 24px var(--shadow-color);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Card entrance animation ── */
|
||||||
|
@keyframes cardEnter {
|
||||||
|
from { opacity: 0; transform: translateY(12px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-enter {
|
||||||
|
animation: cardEnter 0.25s ease-out both;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-tutorial-btn {
|
.card-tutorial-btn {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
}
|
}
|
||||||
@@ -68,6 +68,11 @@
|
|||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn:active:not(:disabled) {
|
||||||
|
transform: scale(0.97);
|
||||||
|
transition-duration: 0.06s;
|
||||||
|
}
|
||||||
|
|
||||||
.btn:disabled {
|
.btn:disabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
@@ -100,6 +105,11 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-icon:active:not(:disabled) {
|
||||||
|
transform: scale(0.92);
|
||||||
|
transition-duration: 0.06s;
|
||||||
|
}
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
@@ -129,7 +139,7 @@
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
background: var(--border-color);
|
background: var(--border-color);
|
||||||
border-radius: 9px;
|
border-radius: 9px;
|
||||||
transition: background 0.2s;
|
transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-toggle-slider::after {
|
.settings-toggle-slider::after {
|
||||||
@@ -141,7 +151,7 @@
|
|||||||
height: 14px;
|
height: 14px;
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
transition: transform 0.2s;
|
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings-toggle input:checked + .settings-toggle-slider {
|
.settings-toggle input:checked + .settings-toggle-slider {
|
||||||
@@ -172,7 +182,7 @@ select {
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
|
transition: border-color 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="number"]:disabled,
|
input[type="number"]:disabled,
|
||||||
@@ -196,7 +206,7 @@ input:focus,
|
|||||||
select:focus {
|
select:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: var(--primary-color);
|
border-color: var(--primary-color);
|
||||||
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
|
box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove browser autofill styling */
|
/* Remove browser autofill styling */
|
||||||
@@ -339,7 +349,7 @@ input:-webkit-autofill:focus {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.3s, transform 0.3s;
|
transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
z-index: 2500;
|
z-index: 2500;
|
||||||
box-shadow: 0 4px 20px var(--shadow-color);
|
box-shadow: 0 4px 20px var(--shadow-color);
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
@@ -349,13 +359,14 @@ input:-webkit-autofill:focus {
|
|||||||
.toast.show {
|
.toast.show {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateX(-50%) translateY(0);
|
transform: translateX(-50%) translateY(0);
|
||||||
animation: toastShake 0.5s ease-in-out;
|
animation: toastBounceIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes toastShake {
|
@keyframes toastBounceIn {
|
||||||
0%, 100% { transform: translateX(-50%) translateY(0); }
|
0% { transform: translateX(-50%) translateY(60px); opacity: 0; }
|
||||||
10%, 30%, 50%, 70%, 90% { transform: translateX(-50%) translateY(-5px); }
|
50% { transform: translateX(-50%) translateY(-4px); opacity: 1; }
|
||||||
20%, 40%, 60%, 80% { transform: translateX(-50%) translateY(5px); }
|
70% { transform: translateX(-50%) translateY(2px); }
|
||||||
|
100% { transform: translateX(-50%) translateY(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast.success {
|
.toast.success {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
width: 10px;
|
width: 10px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-section-count {
|
.dashboard-section-count {
|
||||||
@@ -80,6 +81,11 @@
|
|||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-target:hover {
|
||||||
|
box-shadow: 0 2px 8px var(--shadow-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard-target-info {
|
.dashboard-target-info {
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ h2 {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-bottom: 2px solid transparent;
|
border-bottom: 2px solid transparent;
|
||||||
margin-bottom: -2px;
|
margin-bottom: -2px;
|
||||||
transition: color 0.2s, border-color 0.2s;
|
transition: color 0.2s ease, border-color 0.25s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-btn:hover {
|
.tab-btn:hover {
|
||||||
@@ -171,6 +171,12 @@ h2 {
|
|||||||
|
|
||||||
.tab-panel.active {
|
.tab-panel.active {
|
||||||
display: block;
|
display: block;
|
||||||
|
animation: tabFadeIn 0.25s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes tabFadeIn {
|
||||||
|
from { opacity: 0; transform: translateY(8px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thin animated bar at top of tab panel during data refresh */
|
/* Thin animated bar at top of tab panel during data refresh */
|
||||||
@@ -257,6 +263,7 @@ h2 {
|
|||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(0, 0, 0, 0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
backdrop-filter: blur(2px);
|
backdrop-filter: blur(2px);
|
||||||
|
animation: fadeIn 0.15s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cp-dialog {
|
.cp-dialog {
|
||||||
@@ -272,6 +279,12 @@ h2 {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
animation: cpSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cpSlideDown {
|
||||||
|
from { opacity: 0; transform: translateY(-12px) scale(0.98); }
|
||||||
|
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
.cp-input {
|
.cp-input {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
animation: fadeIn 0.2s ease-out;
|
animation: fadeIn 0.2s ease-out;
|
||||||
|
backdrop-filter: blur(2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Confirm dialog must stack above all other modals */
|
/* Confirm dialog must stack above all other modals */
|
||||||
@@ -132,7 +133,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
box-shadow: 0 8px 32px var(--shadow-color);
|
box-shadow: 0 8px 32px var(--shadow-color);
|
||||||
animation: slideUp 0.3s ease-out;
|
animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#template-modal .modal-content {
|
#template-modal .modal-content {
|
||||||
@@ -146,11 +147,11 @@
|
|||||||
|
|
||||||
@keyframes slideUp {
|
@keyframes slideUp {
|
||||||
from {
|
from {
|
||||||
transform: translateY(20px);
|
transform: translateY(20px) scale(0.98);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
transform: translateY(0);
|
transform: translateY(0) scale(1);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,7 +480,7 @@
|
|||||||
content: '▶';
|
content: '▶';
|
||||||
font-size: 0.6rem;
|
font-size: 0.6rem;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
transition: transform 0.15s;
|
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,15 @@
|
|||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
transition: box-shadow 0.2s;
|
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.template-card:hover {
|
.template-card:hover {
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-template-card {
|
.add-template-card {
|
||||||
@@ -32,13 +33,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 2px dashed var(--border-color);
|
border: 2px dashed var(--border-color);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
transition: border-color 0.2s, background 0.2s;
|
transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-template-card:hover {
|
.add-template-card:hover {
|
||||||
border-color: var(--primary-color);
|
border-color: var(--primary-color);
|
||||||
background: rgba(33, 150, 243, 0.05);
|
background: rgba(33, 150, 243, 0.05);
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
transform: translateY(-2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-template-icon {
|
.add-template-icon {
|
||||||
@@ -550,7 +552,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-bottom: 2px solid transparent;
|
border-bottom: 2px solid transparent;
|
||||||
margin-bottom: -2px;
|
margin-bottom: -2px;
|
||||||
transition: color 0.2s, border-color 0.2s;
|
transition: color 0.2s ease, border-color 0.25s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stream-tab-btn:hover {
|
.stream-tab-btn:hover {
|
||||||
@@ -610,6 +612,7 @@
|
|||||||
|
|
||||||
.stream-tab-panel.active {
|
.stream-tab-panel.active {
|
||||||
display: block;
|
display: block;
|
||||||
|
animation: tabFadeIn 0.2s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sub-tab content sections */
|
/* Sub-tab content sections */
|
||||||
@@ -649,12 +652,18 @@
|
|||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prevent sticky header from clipping cards that lift on hover */
|
||||||
|
[data-cs-content] {
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.cs-chevron {
|
.cs-chevron {
|
||||||
font-size: 0.65rem;
|
font-size: 0.65rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
width: 12px;
|
width: 12px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cs-title {
|
.cs-title {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export class CardSection {
|
|||||||
const cardsHtml = items.map(i => i.html).join('');
|
const cardsHtml = items.map(i => i.html).join('');
|
||||||
|
|
||||||
const isCollapsed = !!_getCollapsedMap()[this.sectionKey];
|
const isCollapsed = !!_getCollapsedMap()[this.sectionKey];
|
||||||
const chevron = isCollapsed ? '\u25B6' : '\u25BC';
|
const chevronStyle = isCollapsed ? '' : ' style="transform:rotate(90deg)"';
|
||||||
const contentDisplay = isCollapsed ? ' style="display:none"' : '';
|
const contentDisplay = isCollapsed ? ' style="display:none"' : '';
|
||||||
|
|
||||||
const addCard = this.addCardOnclick
|
const addCard = this.addCardOnclick
|
||||||
@@ -75,7 +75,7 @@ export class CardSection {
|
|||||||
return `
|
return `
|
||||||
<div class="subtab-section" data-card-section="${this.sectionKey}">
|
<div class="subtab-section" data-card-section="${this.sectionKey}">
|
||||||
<div class="subtab-section-header cs-header" data-cs-toggle="${this.sectionKey}">
|
<div class="subtab-section-header cs-header" data-cs-toggle="${this.sectionKey}">
|
||||||
<span class="cs-chevron">${chevron}</span>
|
<span class="cs-chevron"${chevronStyle}>▶</span>
|
||||||
<span class="cs-title">${t(this.titleKey)}</span>
|
<span class="cs-title">${t(this.titleKey)}</span>
|
||||||
<span class="cs-count">${count}</span>
|
<span class="cs-count">${count}</span>
|
||||||
<div class="cs-filter-wrap">
|
<div class="cs-filter-wrap">
|
||||||
@@ -154,6 +154,9 @@ export class CardSection {
|
|||||||
|
|
||||||
// Tag card elements with their source HTML for future reconciliation
|
// Tag card elements with their source HTML for future reconciliation
|
||||||
this._tagCards(content);
|
this._tagCards(content);
|
||||||
|
|
||||||
|
// Stagger card entrance animation
|
||||||
|
this._animateEntrance(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,6 +219,19 @@ export class CardSection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Animate newly added cards
|
||||||
|
if (added.size > 0 && this.keyAttr && !window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||||
|
let delay = 0;
|
||||||
|
for (const key of added) {
|
||||||
|
const card = content.querySelector(`[${this.keyAttr}="${key}"]`);
|
||||||
|
if (card) {
|
||||||
|
card.style.animationDelay = `${delay}ms`;
|
||||||
|
card.classList.add('card-enter');
|
||||||
|
delay += 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Re-apply filter
|
// Re-apply filter
|
||||||
if (this._filterValue) {
|
if (this._filterValue) {
|
||||||
this._applyFilter(content, this._filterValue);
|
this._applyFilter(content, this._filterValue);
|
||||||
@@ -239,7 +255,7 @@ export class CardSection {
|
|||||||
if (content) content.style.display = '';
|
if (content) content.style.display = '';
|
||||||
if (header) {
|
if (header) {
|
||||||
const chevron = header.querySelector('.cs-chevron');
|
const chevron = header.querySelector('.cs-chevron');
|
||||||
if (chevron) chevron.textContent = '\u25BC';
|
if (chevron) chevron.style.transform = 'rotate(90deg)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
||||||
@@ -255,7 +271,7 @@ export class CardSection {
|
|||||||
if (content) content.style.display = 'none';
|
if (content) content.style.display = 'none';
|
||||||
if (header) {
|
if (header) {
|
||||||
const chevron = header.querySelector('.cs-chevron');
|
const chevron = header.querySelector('.cs-chevron');
|
||||||
if (chevron) chevron.textContent = '\u25B6';
|
if (chevron) chevron.style.transform = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
||||||
@@ -272,12 +288,22 @@ export class CardSection {
|
|||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
||||||
content.style.display = '';
|
content.style.display = '';
|
||||||
const chevron = header.querySelector('.cs-chevron');
|
const chevron = header.querySelector('.cs-chevron');
|
||||||
if (chevron) chevron.textContent = '\u25BC';
|
if (chevron) chevron.style.transform = 'rotate(90deg)';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── private ──
|
// ── private ──
|
||||||
|
|
||||||
|
_animateEntrance(content) {
|
||||||
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
||||||
|
const selector = this.keyAttr ? `[${this.keyAttr}]` : '.card, .template-card:not(.add-template-card)';
|
||||||
|
const cards = content.querySelectorAll(selector);
|
||||||
|
cards.forEach((card, i) => {
|
||||||
|
card.style.animationDelay = `${i * 30}ms`;
|
||||||
|
card.classList.add('card-enter');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_tagCards(content) {
|
_tagCards(content) {
|
||||||
if (!this.keyAttr || !this._lastItems) return;
|
if (!this.keyAttr || !this._lastItems) return;
|
||||||
const htmlMap = new Map(this._lastItems.map(i => [i.key, i.html]));
|
const htmlMap = new Map(this._lastItems.map(i => [i.key, i.html]));
|
||||||
@@ -294,9 +320,45 @@ export class CardSection {
|
|||||||
map[this.sectionKey] = nowCollapsed;
|
map[this.sectionKey] = nowCollapsed;
|
||||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
|
||||||
|
|
||||||
content.style.display = nowCollapsed ? 'none' : '';
|
|
||||||
const chevron = header.querySelector('.cs-chevron');
|
const chevron = header.querySelector('.cs-chevron');
|
||||||
if (chevron) chevron.textContent = nowCollapsed ? '\u25B6' : '\u25BC';
|
if (chevron) chevron.style.transform = nowCollapsed ? '' : 'rotate(90deg)';
|
||||||
|
|
||||||
|
// Cancel any running animation on this content
|
||||||
|
if (content._csAnim) { content._csAnim.cancel(); content._csAnim = null; }
|
||||||
|
|
||||||
|
// Skip animation when user prefers reduced motion
|
||||||
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||||
|
content.style.display = nowCollapsed ? 'none' : '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nowCollapsed) {
|
||||||
|
const h = content.offsetHeight;
|
||||||
|
content.style.overflow = 'hidden';
|
||||||
|
const anim = content.animate(
|
||||||
|
[{ height: h + 'px', opacity: 1 }, { height: '0px', opacity: 0 }],
|
||||||
|
{ duration: 200, easing: 'ease-in-out' }
|
||||||
|
);
|
||||||
|
content._csAnim = anim;
|
||||||
|
anim.onfinish = () => {
|
||||||
|
content.style.display = 'none';
|
||||||
|
content.style.overflow = '';
|
||||||
|
content._csAnim = null;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
content.style.display = '';
|
||||||
|
content.style.overflow = 'hidden';
|
||||||
|
const h = content.scrollHeight;
|
||||||
|
const anim = content.animate(
|
||||||
|
[{ height: '0px', opacity: 0 }, { height: h + 'px', opacity: 1 }],
|
||||||
|
{ duration: 200, easing: 'ease-in-out' }
|
||||||
|
);
|
||||||
|
content._csAnim = anim;
|
||||||
|
anim.onfinish = () => {
|
||||||
|
content.style.overflow = '';
|
||||||
|
content._csAnim = null;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyFilter(content, query) {
|
_applyFilter(content, query) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export function navigateToCard(tab, subTab, sectionKey, cardAttr, cardValue) {
|
|||||||
if (content && content.style.display === 'none') {
|
if (content && content.style.display === 'none') {
|
||||||
content.style.display = '';
|
content.style.display = '';
|
||||||
const chevron = header?.querySelector('.cs-chevron');
|
const chevron = header?.querySelector('.cs-chevron');
|
||||||
if (chevron) chevron.textContent = '\u25BC';
|
if (chevron) chevron.style.transform = 'rotate(90deg)';
|
||||||
const map = JSON.parse(localStorage.getItem('sections_collapsed') || '{}');
|
const map = JSON.parse(localStorage.getItem('sections_collapsed') || '{}');
|
||||||
map[sectionKey] = false;
|
map[sectionKey] = false;
|
||||||
localStorage.setItem('sections_collapsed', JSON.stringify(map));
|
localStorage.setItem('sections_collapsed', JSON.stringify(map));
|
||||||
|
|||||||
@@ -304,21 +304,43 @@ export function toggleDashboardSection(sectionKey) {
|
|||||||
if (!header) return;
|
if (!header) return;
|
||||||
const content = header.nextElementSibling;
|
const content = header.nextElementSibling;
|
||||||
const chevron = header.querySelector('.dashboard-section-chevron');
|
const chevron = header.querySelector('.dashboard-section-chevron');
|
||||||
if (collapsed[sectionKey]) {
|
const nowCollapsed = collapsed[sectionKey];
|
||||||
content.style.display = 'none';
|
if (chevron) chevron.style.transform = nowCollapsed ? '' : 'rotate(90deg)';
|
||||||
chevron.textContent = '\u25B6';
|
|
||||||
|
// Animate collapse/expand unless reduced motion
|
||||||
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||||
|
content.style.display = nowCollapsed ? 'none' : '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (content._dsAnim) { content._dsAnim.cancel(); content._dsAnim = null; }
|
||||||
|
if (nowCollapsed) {
|
||||||
|
const h = content.offsetHeight;
|
||||||
|
content.style.overflow = 'hidden';
|
||||||
|
const anim = content.animate(
|
||||||
|
[{ height: h + 'px', opacity: 1 }, { height: '0px', opacity: 0 }],
|
||||||
|
{ duration: 200, easing: 'ease-in-out' }
|
||||||
|
);
|
||||||
|
content._dsAnim = anim;
|
||||||
|
anim.onfinish = () => { content.style.display = 'none'; content.style.overflow = ''; content._dsAnim = null; };
|
||||||
} else {
|
} else {
|
||||||
content.style.display = '';
|
content.style.display = '';
|
||||||
chevron.textContent = '\u25BC';
|
content.style.overflow = 'hidden';
|
||||||
|
const h = content.scrollHeight;
|
||||||
|
const anim = content.animate(
|
||||||
|
[{ height: '0px', opacity: 0 }, { height: h + 'px', opacity: 1 }],
|
||||||
|
{ duration: 200, easing: 'ease-in-out' }
|
||||||
|
);
|
||||||
|
content._dsAnim = anim;
|
||||||
|
anim.onfinish = () => { content.style.overflow = ''; content._dsAnim = null; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _sectionHeader(sectionKey, label, count, extraHtml = '') {
|
function _sectionHeader(sectionKey, label, count, extraHtml = '') {
|
||||||
const collapsed = _getCollapsedSections();
|
const collapsed = _getCollapsedSections();
|
||||||
const isCollapsed = !!collapsed[sectionKey];
|
const isCollapsed = !!collapsed[sectionKey];
|
||||||
const chevron = isCollapsed ? '\u25B6' : '\u25BC';
|
const chevronStyle = isCollapsed ? '' : ' style="transform:rotate(90deg)"';
|
||||||
return `<div class="dashboard-section-header" data-dashboard-section="${sectionKey}" onclick="toggleDashboardSection('${sectionKey}')">
|
return `<div class="dashboard-section-header" data-dashboard-section="${sectionKey}" onclick="toggleDashboardSection('${sectionKey}')">
|
||||||
<span class="dashboard-section-chevron">${chevron}</span>
|
<span class="dashboard-section-chevron"${chevronStyle}>▶</span>
|
||||||
${label}
|
${label}
|
||||||
<span class="dashboard-section-count">${count}</span>
|
<span class="dashboard-section-count">${count}</span>
|
||||||
${extraHtml}
|
${extraHtml}
|
||||||
|
|||||||
Reference in New Issue
Block a user