@anubis609/astroanimate-core 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +212 -0
- package/dist/components/AnimatedBorderButton/AnimatedBorderButton.astro +129 -0
- package/dist/components/AnimatedBorderButton/index.js +3 -0
- package/dist/components/AnimatedBorderButton/index.js.map +1 -0
- package/dist/components/AnimatedButton/AnimatedButton.astro +299 -0
- package/dist/components/AnimatedButton/index.js +3 -0
- package/dist/components/AnimatedButton/index.js.map +1 -0
- package/dist/components/AnimatedCard/AnimatedCard.astro +832 -0
- package/dist/components/AnimatedCard/index.js +3 -0
- package/dist/components/AnimatedCard/index.js.map +1 -0
- package/dist/components/AnimatedTabs/AnimatedTabs.astro +348 -0
- package/dist/components/AnimatedTabs/index.js +3 -0
- package/dist/components/AnimatedTabs/index.js.map +1 -0
- package/dist/components/ArrowCTAButton/ArrowCTAButton.astro +159 -0
- package/dist/components/ArticleCard/ArticleCard.astro +208 -0
- package/dist/components/CardStack/CardStack.astro +444 -0
- package/dist/components/CardStack/index.js +3 -0
- package/dist/components/CardStack/index.js.map +1 -0
- package/dist/components/CountUp/CountUp.astro +89 -0
- package/dist/components/CountUp/index.js +3 -0
- package/dist/components/CountUp/index.js.map +1 -0
- package/dist/components/Dock/Dock.astro +567 -0
- package/dist/components/Dock/DockItem.astro +135 -0
- package/dist/components/Dropdown/Dropdown.astro +264 -0
- package/dist/components/ExpandableCard/ExpandableCard.astro +402 -0
- package/dist/components/ExpandableCard/index.js +3 -0
- package/dist/components/ExpandableCard/index.js.map +1 -0
- package/dist/components/FadeInText/FadeInText.astro +314 -0
- package/dist/components/FadeInText/index.js +3 -0
- package/dist/components/FadeInText/index.js.map +1 -0
- package/dist/components/FillHoverButton/FillHoverButton.astro +125 -0
- package/dist/components/GitHubShineButton/GitHubShineButton.astro +208 -0
- package/dist/components/GlassCard/GlassCard.astro +245 -0
- package/dist/components/GlassCard/index.js +3 -0
- package/dist/components/GlassCard/index.js.map +1 -0
- package/dist/components/GridDotsBackground/GridDotsBackground.astro +144 -0
- package/dist/components/HighlightText/HighlightText.astro +106 -0
- package/dist/components/InfiniteMarquee/InfiniteMarquee.astro +339 -0
- package/dist/components/JobCard/JobCard.astro +230 -0
- package/dist/components/LiquidGlassCard/LiquidGlassCard.astro +569 -0
- package/dist/components/Loader/Loader.astro +156 -0
- package/dist/components/Loader/index.js +3 -0
- package/dist/components/Loader/index.js.map +1 -0
- package/dist/components/NewsletterPopupCard/NewsletterPopupCard.astro +331 -0
- package/dist/components/ProductReviewCard/ProductReviewCard.astro +188 -0
- package/dist/components/ProgressBar/ProgressBar.astro +137 -0
- package/dist/components/ProgressBar/index.js +3 -0
- package/dist/components/ProgressBar/index.js.map +1 -0
- package/dist/components/RevealImage/RevealImage.astro +160 -0
- package/dist/components/RevealImage/index.js +3 -0
- package/dist/components/RevealImage/index.js.map +1 -0
- package/dist/components/ScaleIn/ScaleIn.astro +231 -0
- package/dist/components/ScaleIn/index.js +3 -0
- package/dist/components/ScaleIn/index.js.map +1 -0
- package/dist/components/SlidingOverlayButton/SlidingOverlayButton.astro +126 -0
- package/dist/components/StaggerTextButton/StaggerTextButton.astro +132 -0
- package/dist/components/Tooltip/Tooltip.astro +255 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/TypewriterText/TypewriterText.astro +380 -0
- package/dist/components/TypewriterText/index.js +3 -0
- package/dist/components/TypewriterText/index.js.map +1 -0
- package/dist/components/index.js +33 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/countup.js +90 -0
- package/dist/internal/countup.js.map +1 -0
- package/dist/internal/dropdown.js +166 -0
- package/dist/internal/dropdown.js.map +1 -0
- package/dist/internal/fadein.js +116 -0
- package/dist/internal/fadein.js.map +1 -0
- package/dist/internal/guards.js +12 -0
- package/dist/internal/guards.js.map +1 -0
- package/dist/internal/tabs.js +140 -0
- package/dist/internal/tabs.js.map +1 -0
- package/package.json +229 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
actionLabel?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
href = "#",
|
|
15
|
+
image,
|
|
16
|
+
actionLabel = "Find out more",
|
|
17
|
+
class: className = "",
|
|
18
|
+
} = Astro.props;
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
/* ✅ CRITERION 7: CSS-FIRST */
|
|
23
|
+
|
|
24
|
+
[data-ac] {
|
|
25
|
+
width: min(20rem, 100%);
|
|
26
|
+
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
|
|
29
|
+
border: 1px solid #e5e7eb;
|
|
30
|
+
border-radius: 0.75rem;
|
|
31
|
+
|
|
32
|
+
background: white;
|
|
33
|
+
|
|
34
|
+
font-family:
|
|
35
|
+
Inter,
|
|
36
|
+
ui-sans-serif,
|
|
37
|
+
system-ui,
|
|
38
|
+
-apple-system,
|
|
39
|
+
BlinkMacSystemFont,
|
|
40
|
+
"Segoe UI",
|
|
41
|
+
Arial,
|
|
42
|
+
sans-serif;
|
|
43
|
+
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
-moz-osx-font-smoothing: grayscale;
|
|
46
|
+
|
|
47
|
+
box-shadow:
|
|
48
|
+
0 1px 2px rgba(0,0,0,0.05);
|
|
49
|
+
|
|
50
|
+
transition:
|
|
51
|
+
transform 250ms ease,
|
|
52
|
+
box-shadow 250ms ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-ac]:hover {
|
|
56
|
+
transform: translateY(-4px);
|
|
57
|
+
|
|
58
|
+
box-shadow:
|
|
59
|
+
0 12px 24px rgba(0,0,0,0.08);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.media {
|
|
63
|
+
width: 100%;
|
|
64
|
+
height: 150px;
|
|
65
|
+
|
|
66
|
+
background:
|
|
67
|
+
linear-gradient(
|
|
68
|
+
135deg,
|
|
69
|
+
rgb(239,205,255),
|
|
70
|
+
rgb(220,180,255)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.media img {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
|
|
80
|
+
object-fit: cover;
|
|
81
|
+
|
|
82
|
+
display: block;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.content {
|
|
86
|
+
padding: 1.1rem;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.title-link {
|
|
90
|
+
text-decoration: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.title {
|
|
94
|
+
color: #111827;
|
|
95
|
+
|
|
96
|
+
font-size: 1.125rem;
|
|
97
|
+
line-height: 1.5rem;
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
|
|
100
|
+
letter-spacing: -0.03em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.description {
|
|
104
|
+
margin-top: 0.65rem;
|
|
105
|
+
|
|
106
|
+
color: #6b7280;
|
|
107
|
+
|
|
108
|
+
font-size: 0.92rem;
|
|
109
|
+
line-height: 1.65;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.action {
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: 0.35rem;
|
|
116
|
+
|
|
117
|
+
margin-top: 1rem;
|
|
118
|
+
padding: 0.45rem 0.75rem;
|
|
119
|
+
|
|
120
|
+
border-radius: 0.45rem;
|
|
121
|
+
|
|
122
|
+
background: #2563eb;
|
|
123
|
+
color: white;
|
|
124
|
+
|
|
125
|
+
font-size: 0.875rem;
|
|
126
|
+
font-weight: 500;
|
|
127
|
+
|
|
128
|
+
text-decoration: none;
|
|
129
|
+
|
|
130
|
+
transition:
|
|
131
|
+
background-color 200ms ease,
|
|
132
|
+
transform 200ms ease;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.action:hover,
|
|
136
|
+
.action:focus-visible {
|
|
137
|
+
background: #1d4ed8;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.arrow {
|
|
141
|
+
transition: transform 300ms ease;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.action:hover .arrow,
|
|
145
|
+
.action:focus-visible .arrow {
|
|
146
|
+
transform: translateX(4px);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Accessibility */
|
|
150
|
+
.title-link:focus-visible,
|
|
151
|
+
.action:focus-visible {
|
|
152
|
+
outline: 2px solid #2563eb;
|
|
153
|
+
outline-offset: 4px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* ✅ CRITERION 6: REDUCED MOTION */
|
|
157
|
+
@media (prefers-reduced-motion: reduce) {
|
|
158
|
+
[data-ac],
|
|
159
|
+
[data-ac] * {
|
|
160
|
+
transition: none !important;
|
|
161
|
+
transform: none !important;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
165
|
+
|
|
166
|
+
<article
|
|
167
|
+
data-ac
|
|
168
|
+
class={className}
|
|
169
|
+
>
|
|
170
|
+
<div class="media">
|
|
171
|
+
{image && (
|
|
172
|
+
<img
|
|
173
|
+
src={image}
|
|
174
|
+
alt=""
|
|
175
|
+
loading="lazy"
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div class="content">
|
|
181
|
+
<a
|
|
182
|
+
href={href}
|
|
183
|
+
class="title-link"
|
|
184
|
+
>
|
|
185
|
+
<span class="title">
|
|
186
|
+
{title}
|
|
187
|
+
</span>
|
|
188
|
+
</a>
|
|
189
|
+
|
|
190
|
+
<p class="description">
|
|
191
|
+
{description}
|
|
192
|
+
</p>
|
|
193
|
+
|
|
194
|
+
<a
|
|
195
|
+
class="action"
|
|
196
|
+
href={href}
|
|
197
|
+
>
|
|
198
|
+
{actionLabel}
|
|
199
|
+
|
|
200
|
+
<span
|
|
201
|
+
class="arrow"
|
|
202
|
+
aria-hidden="true"
|
|
203
|
+
>
|
|
204
|
+
→
|
|
205
|
+
</span>
|
|
206
|
+
</a>
|
|
207
|
+
</div>
|
|
208
|
+
</article>
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* ✅ CRITERION 1: Visible Without JS
|
|
4
|
+
* The stack is rendered using CSS nth-last-child and absolute positioning.
|
|
5
|
+
* baseline state is fully visible and layered.
|
|
6
|
+
*
|
|
7
|
+
* ✅ CRITERION 2: Zero Hydration
|
|
8
|
+
* Uses a vanilla JS script with is:inline to avoid hydration overhead.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface Card {
|
|
12
|
+
id?: number | string;
|
|
13
|
+
title: string;
|
|
14
|
+
content: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
role?: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
image?: string;
|
|
19
|
+
bgColor?: string;
|
|
20
|
+
textColor?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Props {
|
|
24
|
+
cards: Card[];
|
|
25
|
+
/**
|
|
26
|
+
* Explicit opt-in to JS enhancement (Draggable).
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
enhance?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Number of cards visible in the stack.
|
|
32
|
+
* @default 3
|
|
33
|
+
*/
|
|
34
|
+
stackSize?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Distance in pixels to trigger a swipe.
|
|
37
|
+
* @default 120
|
|
38
|
+
*/
|
|
39
|
+
swipeThreshold?: number;
|
|
40
|
+
/**
|
|
41
|
+
* How much the card rotates when dragged.
|
|
42
|
+
* @default 20
|
|
43
|
+
*/
|
|
44
|
+
rotationSensitivity?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Duration of the fly-out animation in ms.
|
|
47
|
+
* @default 500
|
|
48
|
+
*/
|
|
49
|
+
animationDuration?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Default background color for cards.
|
|
52
|
+
* @default "#ffffff"
|
|
53
|
+
*/
|
|
54
|
+
cardBackgroundColor?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Default text color for cards.
|
|
57
|
+
* @default "#1a1a1a"
|
|
58
|
+
*/
|
|
59
|
+
cardTextColor?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
cards,
|
|
64
|
+
enhance = true,
|
|
65
|
+
stackSize = 3,
|
|
66
|
+
swipeThreshold = 120,
|
|
67
|
+
rotationSensitivity = 20,
|
|
68
|
+
animationDuration = 500,
|
|
69
|
+
cardBackgroundColor = "#ffffff",
|
|
70
|
+
cardTextColor = "#1a1a1a",
|
|
71
|
+
} = Astro.props;
|
|
72
|
+
|
|
73
|
+
const cardsWithIds = cards.map((card, index) => ({
|
|
74
|
+
...card,
|
|
75
|
+
id: card.id || index,
|
|
76
|
+
color: card.color || "#6366f1",
|
|
77
|
+
name: card.name || "Anonymous",
|
|
78
|
+
role: card.role || "",
|
|
79
|
+
textColor: card.textColor || cardTextColor,
|
|
80
|
+
}));
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
<div
|
|
84
|
+
class="astro-card-stack-container"
|
|
85
|
+
data-astro-card-stack
|
|
86
|
+
data-enhance={enhance ? "true" : "false"}
|
|
87
|
+
data-stack-size={stackSize}
|
|
88
|
+
data-threshold={swipeThreshold}
|
|
89
|
+
data-rotation={rotationSensitivity}
|
|
90
|
+
data-duration={animationDuration}
|
|
91
|
+
>
|
|
92
|
+
{
|
|
93
|
+
cardsWithIds.reverse().map((item) => (
|
|
94
|
+
<div
|
|
95
|
+
class="stack-card"
|
|
96
|
+
data-id={item.id}
|
|
97
|
+
style={`background-color: ${item.bgColor || cardBackgroundColor}; color: ${item.textColor};`}
|
|
98
|
+
>
|
|
99
|
+
<div class="card-content">
|
|
100
|
+
<div class="quote-icon">
|
|
101
|
+
<svg
|
|
102
|
+
viewBox="0 0 24 24"
|
|
103
|
+
fill="none"
|
|
104
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
105
|
+
>
|
|
106
|
+
<path
|
|
107
|
+
d="M10 3H4V11C4 15.4183 7.58172 19 12 19V15C9.79086 15 8 13.2091 8 11V9H10V3ZM20 3H14V11C14 15.4183 17.5817 19 22 19V15C19.7909 15 18 13.2091 18 11V9H20V3Z"
|
|
108
|
+
fill="currentColor"
|
|
109
|
+
/>
|
|
110
|
+
</svg>
|
|
111
|
+
</div>
|
|
112
|
+
<h3 class="card-title">{item.title}</h3>
|
|
113
|
+
<p class="quote">{item.content}</p>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="card-footer">
|
|
116
|
+
{item.image ? (
|
|
117
|
+
<img class="avatar avatar-img" src={item.image} alt={item.name} />
|
|
118
|
+
) : (
|
|
119
|
+
<div class="avatar" style={`background: ${item.color}`} />
|
|
120
|
+
)}
|
|
121
|
+
<div class="info">
|
|
122
|
+
<span class="name">{item.name}</span>
|
|
123
|
+
<span class="role">{item.role}</span>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
))
|
|
128
|
+
}
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<style>
|
|
132
|
+
/**
|
|
133
|
+
* ✅ CRITERION 7: CSS-First
|
|
134
|
+
* Stack layout is defined in CSS using nth-last-child.
|
|
135
|
+
*/
|
|
136
|
+
.astro-card-stack-container {
|
|
137
|
+
position: relative;
|
|
138
|
+
width: 100%;
|
|
139
|
+
max-width: 400px;
|
|
140
|
+
height: 320px;
|
|
141
|
+
margin: 4rem auto;
|
|
142
|
+
display: flex;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
align-items: center;
|
|
145
|
+
perspective: 1000px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.stack-card {
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 260px;
|
|
152
|
+
padding: 1.5rem 2rem;
|
|
153
|
+
background: #ffffff;
|
|
154
|
+
color: #1a1a1a;
|
|
155
|
+
border-radius: 32px;
|
|
156
|
+
box-shadow:
|
|
157
|
+
0 1px 2px rgba(0, 0, 0, 0.05),
|
|
158
|
+
0 10px 30px -10px rgba(0, 0, 0, 0.1);
|
|
159
|
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
justify-content: flex-start;
|
|
163
|
+
cursor: grab;
|
|
164
|
+
transform-origin: center bottom;
|
|
165
|
+
will-change: transform, opacity;
|
|
166
|
+
user-select: none;
|
|
167
|
+
touch-action: none;
|
|
168
|
+
transition:
|
|
169
|
+
transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
|
|
170
|
+
opacity 0.6s ease;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* ✅ CRITERION 6: Reduced Motion Respected
|
|
175
|
+
*/
|
|
176
|
+
@media (prefers-reduced-motion: reduce) {
|
|
177
|
+
.stack-card {
|
|
178
|
+
transition: none !important;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (prefers-color-scheme: dark) {
|
|
183
|
+
.stack-card {
|
|
184
|
+
border-color: rgba(255, 255, 255, 0.08);
|
|
185
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.stack-card:nth-last-child(1) {
|
|
190
|
+
z-index: 3;
|
|
191
|
+
transform: translate3d(0, 0, 0);
|
|
192
|
+
}
|
|
193
|
+
.stack-card:nth-last-child(2) {
|
|
194
|
+
z-index: 2;
|
|
195
|
+
transform: translate3d(0, 15px, -30px) scale(0.94);
|
|
196
|
+
opacity: 0.8;
|
|
197
|
+
}
|
|
198
|
+
.stack-card:nth-last-child(3) {
|
|
199
|
+
z-index: 1;
|
|
200
|
+
transform: translate3d(0, 30px, -60px) scale(0.88);
|
|
201
|
+
opacity: 0.4;
|
|
202
|
+
}
|
|
203
|
+
.stack-card:nth-last-child(n + 4) {
|
|
204
|
+
opacity: 0;
|
|
205
|
+
transform: translate3d(0, 45px, -90px) scale(0.82);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.stack-card.dragging {
|
|
209
|
+
cursor: grabbing;
|
|
210
|
+
transition: none;
|
|
211
|
+
z-index: 50;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.quote-icon {
|
|
215
|
+
width: 32px;
|
|
216
|
+
opacity: 0.1;
|
|
217
|
+
margin-bottom: 1.5rem;
|
|
218
|
+
color: #6366f1;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.card-title {
|
|
222
|
+
font-size: 1.1rem;
|
|
223
|
+
font-weight: 700;
|
|
224
|
+
margin-bottom: 0.75rem;
|
|
225
|
+
color: inherit;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.quote {
|
|
229
|
+
font-size: 1rem;
|
|
230
|
+
line-height: 1.6;
|
|
231
|
+
font-weight: 400;
|
|
232
|
+
color: inherit;
|
|
233
|
+
overflow-y: auto;
|
|
234
|
+
max-height: 80px;
|
|
235
|
+
scrollbar-width: none;
|
|
236
|
+
-ms-overflow-style: none;
|
|
237
|
+
}
|
|
238
|
+
.quote::-webkit-scrollbar {
|
|
239
|
+
display: none;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.card-footer {
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
gap: 1rem;
|
|
246
|
+
padding-top: 1.5rem;
|
|
247
|
+
margin-top: auto;
|
|
248
|
+
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@media (prefers-color-scheme: dark) {
|
|
252
|
+
.card-footer {
|
|
253
|
+
border-top-color: rgba(255, 255, 255, 0.05);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.avatar {
|
|
258
|
+
width: 44px;
|
|
259
|
+
height: 44px;
|
|
260
|
+
border-radius: 14px;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.avatar-img {
|
|
264
|
+
object-fit: cover;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.info {
|
|
268
|
+
display: flex;
|
|
269
|
+
flex-direction: column;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.name {
|
|
273
|
+
font-weight: 700;
|
|
274
|
+
font-size: 1rem;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.role {
|
|
278
|
+
font-size: 0.8rem;
|
|
279
|
+
opacity: 0.5;
|
|
280
|
+
}
|
|
281
|
+
</style>
|
|
282
|
+
|
|
283
|
+
<!-- ✅ CRITERION 8: JS Only Enhances -->
|
|
284
|
+
{enhance && (
|
|
285
|
+
<script is:inline>
|
|
286
|
+
(function () {
|
|
287
|
+
if (typeof window === "undefined") return;
|
|
288
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
289
|
+
|
|
290
|
+
var initialized = new WeakMap();
|
|
291
|
+
|
|
292
|
+
function enhanceCardStack(stack) {
|
|
293
|
+
if (!(stack instanceof HTMLElement)) return;
|
|
294
|
+
if (initialized.has(stack)) return;
|
|
295
|
+
|
|
296
|
+
var stackSize = parseInt(stack.dataset.stackSize || "3", 10);
|
|
297
|
+
var threshold = parseInt(stack.dataset.threshold || "120", 10);
|
|
298
|
+
var rotationSensitivity = parseInt(stack.dataset.rotation || "20", 10);
|
|
299
|
+
var duration = parseInt(stack.dataset.duration || "500", 10);
|
|
300
|
+
|
|
301
|
+
var isDragging = false;
|
|
302
|
+
var startX = 0, startY = 0;
|
|
303
|
+
var currentX = 0, currentY = 0;
|
|
304
|
+
var animationFrameId = null;
|
|
305
|
+
var flyTimeout = null;
|
|
306
|
+
|
|
307
|
+
var handleStart = function (e) {
|
|
308
|
+
var topCard = stack.lastElementChild;
|
|
309
|
+
if (!topCard) return;
|
|
310
|
+
|
|
311
|
+
isDragging = true;
|
|
312
|
+
var point = e.touches ? e.touches[0] : e;
|
|
313
|
+
startX = point.clientX;
|
|
314
|
+
startY = point.clientY;
|
|
315
|
+
currentX = 0;
|
|
316
|
+
currentY = 0;
|
|
317
|
+
|
|
318
|
+
topCard.classList.add("dragging");
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
var handleMove = function (e) {
|
|
322
|
+
if (!isDragging) return;
|
|
323
|
+
|
|
324
|
+
if (animationFrameId) {
|
|
325
|
+
cancelAnimationFrame(animationFrameId);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
animationFrameId = requestAnimationFrame(function () {
|
|
329
|
+
var topCard = stack.lastElementChild;
|
|
330
|
+
var nextCard = topCard.previousElementSibling;
|
|
331
|
+
|
|
332
|
+
var point = e.touches ? e.touches[0] : e;
|
|
333
|
+
currentX = point.clientX - startX;
|
|
334
|
+
currentY = point.clientY - startY;
|
|
335
|
+
|
|
336
|
+
var rotation = currentX / rotationSensitivity;
|
|
337
|
+
topCard.style.transform = "translate3d(" + currentX + "px, " + currentY + "px, 0) rotate(" + rotation + "deg)";
|
|
338
|
+
|
|
339
|
+
if (nextCard) {
|
|
340
|
+
var distance = Math.max(Math.abs(currentX), Math.abs(currentY));
|
|
341
|
+
var progress = Math.min(distance / threshold, 1);
|
|
342
|
+
var scale = 0.94 + 0.06 * progress;
|
|
343
|
+
var translateY = 15 - 15 * progress;
|
|
344
|
+
nextCard.style.transform = "translate3d(0, " + translateY + "px, -30px) scale(" + scale + ")";
|
|
345
|
+
nextCard.style.opacity = (0.8 + 0.2 * progress).toString();
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
var handleEnd = function () {
|
|
351
|
+
if (!isDragging) return;
|
|
352
|
+
isDragging = false;
|
|
353
|
+
|
|
354
|
+
if (animationFrameId) {
|
|
355
|
+
cancelAnimationFrame(animationFrameId);
|
|
356
|
+
animationFrameId = null;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
var topCard = stack.lastElementChild;
|
|
360
|
+
topCard.classList.remove("dragging");
|
|
361
|
+
|
|
362
|
+
var success = Math.abs(currentX) > threshold || Math.abs(currentY) > threshold;
|
|
363
|
+
|
|
364
|
+
if (success) {
|
|
365
|
+
var flyX = currentX * 3;
|
|
366
|
+
var flyY = currentY * 3;
|
|
367
|
+
var flyRotation = currentX / 10;
|
|
368
|
+
topCard.style.transition = "transform " + duration + "ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity " + duration + "ms ease-out";
|
|
369
|
+
topCard.style.transform = "translate3d(" + flyX + "px, " + flyY + "px, 0) rotate(" + flyRotation + "deg)";
|
|
370
|
+
topCard.style.opacity = "0";
|
|
371
|
+
|
|
372
|
+
flyTimeout = setTimeout(function () {
|
|
373
|
+
flyTimeout = null;
|
|
374
|
+
topCard.style.transition = "none";
|
|
375
|
+
topCard.style.transform = "";
|
|
376
|
+
topCard.style.opacity = "";
|
|
377
|
+
stack.prepend(topCard);
|
|
378
|
+
|
|
379
|
+
Array.prototype.slice.call(stack.children).forEach(function (child) {
|
|
380
|
+
child.style.transform = "";
|
|
381
|
+
child.style.opacity = "";
|
|
382
|
+
});
|
|
383
|
+
}, duration);
|
|
384
|
+
} else {
|
|
385
|
+
topCard.style.transition = "transform " + duration + "ms cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
386
|
+
topCard.style.transform = "";
|
|
387
|
+
|
|
388
|
+
var nextCard = topCard.previousElementSibling;
|
|
389
|
+
if (nextCard) {
|
|
390
|
+
nextCard.style.transition = "transform " + duration + "ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity " + duration + "ms ease";
|
|
391
|
+
nextCard.style.transform = "";
|
|
392
|
+
nextCard.style.opacity = "";
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
currentX = 0;
|
|
397
|
+
currentY = 0;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
var cleanup = function () {
|
|
401
|
+
stack.removeEventListener("mousedown", handleStart);
|
|
402
|
+
stack.removeEventListener("touchstart", handleStart);
|
|
403
|
+
window.removeEventListener("mousemove", handleMove);
|
|
404
|
+
window.removeEventListener("touchmove", handleMove);
|
|
405
|
+
window.removeEventListener("mouseup", handleEnd);
|
|
406
|
+
window.removeEventListener("touchend", handleEnd);
|
|
407
|
+
if (animationFrameId) cancelAnimationFrame(animationFrameId);
|
|
408
|
+
if (flyTimeout) clearTimeout(flyTimeout);
|
|
409
|
+
initialized.delete(stack);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
stack.addEventListener("mousedown", handleStart);
|
|
413
|
+
stack.addEventListener("touchstart", handleStart);
|
|
414
|
+
window.addEventListener("mousemove", handleMove);
|
|
415
|
+
window.addEventListener("touchmove", handleMove, { passive: false });
|
|
416
|
+
window.addEventListener("mouseup", handleEnd);
|
|
417
|
+
window.addEventListener("touchend", handleEnd);
|
|
418
|
+
|
|
419
|
+
initialized.set(stack, cleanup);
|
|
420
|
+
|
|
421
|
+
// ✅ CRITERION 3: Multiple Instances Safe
|
|
422
|
+
// Handle removal via MutationObserver
|
|
423
|
+
var observer = new MutationObserver(function () {
|
|
424
|
+
if (!document.contains(stack)) {
|
|
425
|
+
cleanup();
|
|
426
|
+
observer.disconnect();
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function initAll() {
|
|
433
|
+
document.querySelectorAll("[data-astro-card-stack][data-enhance='true']").forEach(function (el) {
|
|
434
|
+
enhanceCardStack(el);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
initAll();
|
|
439
|
+
|
|
440
|
+
// Re-run on page changes (Astro transitions)
|
|
441
|
+
document.addEventListener("astro:page-load", initAll);
|
|
442
|
+
})();
|
|
443
|
+
</script>
|
|
444
|
+
)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|