(done)
| 520 | ); |
| 521 | |
| 522 | function animateCardsIntoHeaderAndThen(done) { |
| 523 | const sb = getSidebar(); |
| 524 | const top = getTopZone(); |
| 525 | const liveCards = []; |
| 526 | |
| 527 | if (sb) liveCards.push(...sb.querySelectorAll('#uploadCard, #folderManagementCard')); |
| 528 | if (top) liveCards.push(...top.querySelectorAll('#uploadCard, #folderManagementCard')); |
| 529 | |
| 530 | if (!liveCards.length) { |
| 531 | done(); |
| 532 | return; |
| 533 | } |
| 534 | |
| 535 | // Snapshot their current positions before we move the real DOM |
| 536 | const snapshots = liveCards.map(card => { |
| 537 | const rect = card.getBoundingClientRect(); |
| 538 | return { card, rect }; |
| 539 | }); |
| 540 | |
| 541 | // Make sure header dock is visible so icons are laid out |
| 542 | showHeaderDockPersistent(); |
| 543 | |
| 544 | // Move real cards into header (hidden container + icons) |
| 545 | snapshots.forEach(({ card }) => { |
| 546 | try { insertCardInHeader(card); } catch (e) {} |
| 547 | }); |
| 548 | |
| 549 | const ghosts = []; |
| 550 | |
| 551 | snapshots.forEach(({ card, rect }) => { |
| 552 | // remember the size and center for the expand animation later |
| 553 | card.dataset.lastWidth = String(rect.width); |
| 554 | card.dataset.lastHeight = String(rect.height); |
| 555 | card.dataset.lastTargetLeft = String(rect.left); |
| 556 | card.dataset.lastTargetTop = String(rect.top); |
| 557 | card.dataset.lastTargetCx = String(rect.left + rect.width / 2); |
| 558 | card.dataset.lastTargetCy = String(rect.top + rect.height / 2); |
| 559 | |
| 560 | const iconBtn = card.headerIconButton; |
| 561 | if (!iconBtn) return; |
| 562 | |
| 563 | iconBtn.classList.remove('is-launching'); |
| 564 | iconBtn.classList.add('is-landing'); |
| 565 | iconBtn.style.setProperty('--header-icon-delay', `${HEADER_ICON_LAND_DELAY_MS}ms`); |
| 566 | iconBtn.style.setProperty('--header-icon-land-ms', `${HEADER_ICON_LAND_MS}ms`); |
| 567 | setTimeout(() => { |
| 568 | if (!iconBtn.isConnected) return; |
| 569 | iconBtn.classList.remove('is-landing'); |
| 570 | iconBtn.style.removeProperty('--header-icon-delay'); |
| 571 | iconBtn.style.removeProperty('--header-icon-land-ms'); |
| 572 | }, HEADER_ICON_LAND_DELAY_MS + HEADER_ICON_LAND_MS + 40); |
| 573 | |
| 574 | const iconRect = iconBtn.getBoundingClientRect(); |
| 575 | |
| 576 | const iconName = card.id === 'uploadCard' |
| 577 | ? 'cloud_upload' |
| 578 | : card.id === 'folderManagementCard' |
| 579 | ? 'folder' |
no test coverage detected