Skip to content

Commit dbc692a

Browse files
authored
Add files via upload
1 parent 47375a3 commit dbc692a

File tree

1 file changed

+17
-162
lines changed

1 file changed

+17
-162
lines changed

dist/fast-search-card.js

Lines changed: 17 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,13 +1253,11 @@ class FastSearchCard extends HTMLElement {
12531253
}
12541254

12551255
.category-buttons {
1256-
display: none; /* Wird per JS auf 'flex' gesetzt */
1257-
align-items: center; /* NEU: Zentriert die Buttons vertikal */
1258-
position: relative; /* WICHTIG: Kontext für die absoluten Buttons */
1259-
height: 72px;
1260-
width: 72px; /* Startbreite = 1 Button */
1261-
will-change: width, filter;
1262-
/* Filter wird per JS hinzugefügt und entfernt */
1256+
display: none;
1257+
flex-direction: row;
1258+
gap: 12px;
1259+
opacity: 0;
1260+
transform: translateX(20px);
12631261
}
12641262

12651263
/* Mobile: Category-Buttons zentrieren */
@@ -1285,13 +1283,6 @@ class FastSearchCard extends HTMLElement {
12851283
cursor: pointer;
12861284
transition: all 0.2s ease;
12871285
background: var(--glass-shadow);
1288-
1289-
/* WICHTIG für die Animation */
1290-
position: absolute; /* Buttons absolut im Container positionieren */
1291-
top: 0;
1292-
left: 0;
1293-
flex-shrink: 0;
1294-
will-change: transform, opacity;
12951286
}
12961287

12971288
.category-button:hover {
@@ -1313,11 +1304,6 @@ class FastSearchCard extends HTMLElement {
13131304
stroke-linecap: round;
13141305
stroke-linejoin: round;
13151306
transition: all 0.2s ease;
1316-
1317-
/* NEU: Für die Animation hinzufügen */
1318-
opacity: 0;
1319-
transform: scale(0.8);
1320-
will-change: opacity, transform;
13211307
}
13221308

13231309
.category-button.active svg {
@@ -4602,26 +4588,9 @@ class FastSearchCard extends HTMLElement {
46024588
height: 24px;
46034589
transition: all 0.2s ease;
46044590
}
4605-
4606-
4607-
4608-
4609-
4610-
46114591

46124592
</style>
46134593

4614-
<!-- ERSETZEN Sie den bestehenden SVG Filter mit diesem: -->
4615-
<svg class="gooey-filter">
4616-
<defs>
4617-
<filter id="categoryGooey">
4618-
<feGaussianBlur in="SourceGraphic" stdDeviation="15" result="blur" />
4619-
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -7" result="gooey" />
4620-
<feComposite in="SourceGraphic" in2="gooey" operator="atop"/>
4621-
</filter>
4622-
</defs>
4623-
</svg>
4624-
46254594
<div class="main-container">
46264595
<div class="search-row">
46274596
<div class="search-panel glass-panel">
@@ -4733,7 +4702,6 @@ class FastSearchCard extends HTMLElement {
47334702

47344703

47354704
</div>
4736-
47374705

47384706
<div class="results-container">
47394707
<div class="subcategories">
@@ -4782,9 +4750,6 @@ class FastSearchCard extends HTMLElement {
47824750
<div class="detail-panel glass-panel">
47834751
</div>
47844752

4785-
4786-
4787-
47884753
<div class="category-buttons">
47894754
<button class="category-button glass-panel active" data-category="devices" title="Geräte">
47904755
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -5021,83 +4986,24 @@ class FastSearchCard extends HTMLElement {
50214986
return window.innerWidth <= 768;
50224987
}
50234988

5024-
async showCategoryButtons() {
5025-
this.collapsePanel();
4989+
showCategoryButtons() {
4990+
this.collapsePanel(); // <-- HINZUGEFÜGTE ZEILE
4991+
4992+
// NEU: Search-Wrapper auf Mobile verstecken
50264993
if (this.isMobile()) {
50274994
const searchWrapper = this.shadowRoot.querySelector('.search-panel');
50284995
if (searchWrapper) {
50294996
searchWrapper.style.display = 'none';
50304997
}
50314998
}
4999+
5000+
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
50325001
this.isMenuView = true;
5033-
5034-
// --- NEUE SPOTLIGHT ANIMATION ---
5035-
5036-
const categoryButtonsContainer = this.shadowRoot.querySelector('.category-buttons');
5037-
const buttons = Array.from(categoryButtonsContainer.querySelectorAll('.category-button'));
5038-
// Wichtig: Wir brauchen den Weichzeichner im SVG-Filter, um ihn zu animieren
5039-
const gooeyFilter = this.shadowRoot.querySelector('#categoryGooey feGaussianBlur');
5040-
5041-
if (!categoryButtonsContainer || buttons.length === 0 || !gooeyFilter) {
5042-
console.error("Animations-Elemente nicht gefunden.");
5043-
return;
5044-
}
5045-
5046-
// --- Phase 1: Morphing & Trennung (Bild 1-6) ---
5047-
5048-
// 1. Vorbereitung
5049-
categoryButtonsContainer.classList.add('visible');
5050-
categoryButtonsContainer.style.filter = 'url(#categoryGooey)';
5051-
gooeyFilter.setAttribute('stdDeviation', '15'); // Weichzeichner aktivieren
5052-
5053-
buttons.forEach(btn => {
5054-
btn.style.transform = 'translateX(0px) scale(1)';
5055-
btn.style.opacity = '1';
5056-
btn.querySelector('svg').style.opacity = '0'; // Icons bleiben unsichtbar
5057-
});
5058-
5059-
// 2. Der "Wurm" wächst (Bild 2-3)
5060-
const containerWidth = buttons.length * 72 + (buttons.length - 1) * 12;
5061-
const containerAnimation = categoryButtonsContainer.animate(
5062-
{ width: [`72px`, `${containerWidth}px`] },
5063-
{ duration: 350, easing: 'cubic-bezier(0.4, 0, 0.2, 1)', fill: 'forwards' }
5064-
);
5065-
await containerAnimation.finished;
5066-
5067-
// 3. Die Trennung der "Tropfen" (Bild 4-6)
5068-
const separationAnimations = buttons.map((btn, index) => {
5069-
const finalX = index * (72 + 12);
5070-
return btn.animate(
5071-
{ transform: [`translateX(0px)`, `translateX(${finalX}px)`] },
5072-
{ duration: 500, delay: index * 50, easing: 'cubic-bezier(0.4, 0, 0.2, 1)', fill: 'forwards' }
5073-
);
5074-
});
5075-
await Promise.all(separationAnimations.map(a => a.finished));
5076-
5077-
// --- Phase 2: Verfestigung & Enthüllung (Bild 7-10) ---
5078-
5079-
// 4. Verfestigung: Den Weichzeichner auf 0 animieren
5080-
const solidificationAnimation = gooeyFilter.animate(
5081-
{ stdDeviation: [15, 0] },
5082-
{ duration: 300, easing: 'ease-out', fill: 'forwards' }
5083-
);
5084-
5085-
// 5. Enthüllung: Icons einblenden, während die Form fest wird
5086-
buttons.forEach((btn, index) => {
5087-
const icon = btn.querySelector('svg');
5088-
icon.animate(
5089-
{ opacity: [0, 1], transform: ['scale(0.8)', 'scale(1)'] },
5090-
{ duration: 300, delay: index * 30, easing: 'ease-out', fill: 'forwards' }
5091-
);
5092-
});
5093-
5094-
await solidificationAnimation.finished;
5095-
5096-
// 6. Aufräumen: Filter komplett entfernen, um die Performance zu schonen
5097-
categoryButtonsContainer.style.filter = 'none';
5002+
categoryButtons.classList.add('visible');
5003+
categoryButtons.animate([{ opacity: 0, transform: 'translateX(20px) scale(0.9)' }, { opacity: 1, transform: 'translateX(0) scale(1)' }], { duration: 400, easing: 'cubic-bezier(0.16, 1, 0.3, 1)', fill: 'forwards' });
50985004
}
50995005

5100-
async hideCategoryButtons() {
5006+
hideCategoryButtons() {
51015007
// NEU: Search-Wrapper wieder anzeigen
51025008
if (this.isMobile()) {
51035009
const searchWrapper = this.shadowRoot.querySelector('.search-panel');
@@ -5106,57 +5012,10 @@ class FastSearchCard extends HTMLElement {
51065012
}
51075013
}
51085014

5109-
const categoryButtonsContainer = this.shadowRoot.querySelector('.category-buttons');
5015+
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
51105016
if (!this.isMenuView) return;
5111-
5112-
const buttons = Array.from(categoryButtonsContainer.querySelectorAll('.category-button'));
5113-
const gooeyFilter = this.shadowRoot.querySelector('#categoryGooey feGaussianBlur');
5114-
5115-
if (!gooeyFilter) {
5116-
// Fallback zur einfachen Animation
5117-
categoryButtonsContainer.classList.remove('visible');
5118-
this.isMenuView = false;
5119-
return;
5120-
}
5121-
5122-
// Reverse Spotlight Animation
5123-
categoryButtonsContainer.style.filter = 'url(#categoryGooey)';
5124-
gooeyFilter.setAttribute('stdDeviation', '15');
5125-
5126-
// 1. Icons ausblenden
5127-
buttons.forEach((btn, index) => {
5128-
const icon = btn.querySelector('svg');
5129-
icon.animate(
5130-
{ opacity: [1, 0], transform: ['scale(1)', 'scale(0.8)'] },
5131-
{ duration: 200, delay: (buttons.length - index - 1) * 20, easing: 'ease-in', fill: 'forwards' }
5132-
);
5133-
});
5134-
5135-
await new Promise(resolve => setTimeout(resolve, 300));
5136-
5137-
// 2. Buttons zusammenziehen
5138-
const contractionAnimations = buttons.map((btn, index) => {
5139-
return btn.animate(
5140-
{ transform: [`translateX(${index * (72 + 12)}px)`, 'translateX(0px)'] },
5141-
{ duration: 400, delay: (buttons.length - index - 1) * 40, easing: 'ease-in', fill: 'forwards' }
5142-
);
5143-
});
5144-
5145-
await Promise.all(contractionAnimations.map(a => a.finished));
5146-
5147-
// 3. Container zusammenziehen
5148-
const containerWidth = buttons.length * 72 + (buttons.length - 1) * 12;
5149-
const containerAnimation = categoryButtonsContainer.animate(
5150-
{ width: [`${containerWidth}px`, '72px'] },
5151-
{ duration: 250, easing: 'ease-in', fill: 'forwards' }
5152-
);
5153-
5154-
await containerAnimation.finished;
5155-
5156-
// 4. Aufräumen
5157-
categoryButtonsContainer.classList.remove('visible');
5158-
categoryButtonsContainer.style.filter = 'none';
5159-
this.isMenuView = false;
5017+
const animation = categoryButtons.animate([{ opacity: 1, transform: 'translateX(0) scale(1)' }, { opacity: 0, transform: 'translateX(20px) scale(0.9)' }], { duration: 300, easing: 'ease-in', fill: 'forwards' });
5018+
animation.finished.then(() => { categoryButtons.classList.remove('visible'); this.isMenuView = false; });
51605019
}
51615020

51625021
handleCategorySelect(selectedButton) {
@@ -5182,10 +5041,6 @@ class FastSearchCard extends HTMLElement {
51825041
this.hideCategoryButtons();
51835042
}
51845043

5185-
5186-
5187-
5188-
51895044
handleSubcategorySelect(selectedChip) {
51905045
let subcategory = selectedChip.dataset.subcategory;
51915046
if (subcategory === this.activeSubcategory && subcategory !== 'all') {

0 commit comments

Comments
 (0)