@jepepa/like-button 0.8.0 → 0.8.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/README.md +2 -2
- package/dist/{chunk-WTGBDIZW.js → chunk-BQEOACLZ.js} +2 -4
- package/dist/index.d.ts +17 -58
- package/dist/index.js +5 -9
- package/dist/styles.css +161 -0
- package/dist/vanilla.d.ts +1 -1
- package/dist/vanilla.js +5 -9
- package/package.json +4 -3
- /package/dist/{chunk-WTGBDIZW.js.map → chunk-BQEOACLZ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ function App() {
|
|
|
69
69
|
|
|
70
70
|
### Built-in Presets
|
|
71
71
|
|
|
72
|
-
Choose from 5
|
|
72
|
+
Choose from 5 designed particle effects:
|
|
73
73
|
|
|
74
74
|
```tsx
|
|
75
75
|
// Quick explosion of hearts (12 particles)
|
|
@@ -90,7 +90,7 @@ Choose from 5 professionally designed particle effects:
|
|
|
90
90
|
|
|
91
91
|
### Custom Particle Configuration
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Or fully customize particle behavior:
|
|
94
94
|
|
|
95
95
|
```tsx
|
|
96
96
|
<LikeButton particleConfig={{
|
|
@@ -830,12 +830,10 @@ function LikeButtonVanilla({
|
|
|
830
830
|
|
|
831
831
|
export {
|
|
832
832
|
DefaultHeartIcon,
|
|
833
|
-
|
|
834
|
-
Particle,
|
|
833
|
+
PARTICLE_PRESETS,
|
|
835
834
|
LIKE_BUTTON_DEFAULTS,
|
|
836
835
|
useLikeButton,
|
|
837
836
|
LikeButton,
|
|
838
|
-
ParticleVanilla,
|
|
839
837
|
LikeButtonVanilla
|
|
840
838
|
};
|
|
841
|
-
//# sourceMappingURL=chunk-
|
|
839
|
+
//# sourceMappingURL=chunk-BQEOACLZ.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -182,6 +182,13 @@ interface ParticleConfig {
|
|
|
182
182
|
*/
|
|
183
183
|
fadeOut?: boolean;
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Preset configuration type.
|
|
187
|
+
* Used internally to define preset configurations.
|
|
188
|
+
*/
|
|
189
|
+
type ParticlePresetConfig = Required<Omit<ParticleConfig, "shape">> & {
|
|
190
|
+
shape: ParticleShapePreset;
|
|
191
|
+
};
|
|
185
192
|
|
|
186
193
|
/** Data structure for a single particle effect */
|
|
187
194
|
interface ParticleData {
|
|
@@ -515,66 +522,18 @@ declare function LikeButton({ size, fillColor, waveColor, className, showParticl
|
|
|
515
522
|
*/
|
|
516
523
|
declare function LikeButtonVanilla({ size, fillColor, waveColor, className, showParticles, renderIcon, shape, styles, cursor, minFillPercent, ...hookOptions }: LikeButtonVanillaProps): react_jsx_runtime.JSX.Element;
|
|
517
524
|
|
|
518
|
-
/** Props for particle components */
|
|
519
|
-
interface ParticleProps {
|
|
520
|
-
/** Angle in degrees (0-360) for particle direction */
|
|
521
|
-
angle: number;
|
|
522
|
-
/** Distance in pixels the particle travels */
|
|
523
|
-
distance: number;
|
|
524
|
-
/** Scale multiplier for particle size */
|
|
525
|
-
scale: number;
|
|
526
|
-
/** Color of the particle (hex or CSS color) */
|
|
527
|
-
color: string;
|
|
528
|
-
/** Particle shape (preset or custom) */
|
|
529
|
-
shape: ParticleShape;
|
|
530
|
-
/** Animation duration in milliseconds */
|
|
531
|
-
speed: number;
|
|
532
|
-
/** CSS easing function for animation */
|
|
533
|
-
easing: string;
|
|
534
|
-
/** Whether particle should fade out */
|
|
535
|
-
fadeOut: boolean;
|
|
536
|
-
}
|
|
537
|
-
/** Return type for the useParticle hook */
|
|
538
|
-
interface UseParticleReturn {
|
|
539
|
-
/** Whether the animation has started */
|
|
540
|
-
isAnimating: boolean;
|
|
541
|
-
/** X position offset in pixels */
|
|
542
|
-
x: number;
|
|
543
|
-
/** Y position offset in pixels */
|
|
544
|
-
y: number;
|
|
545
|
-
/** Computed transform string */
|
|
546
|
-
transform: string;
|
|
547
|
-
/** Computed opacity value */
|
|
548
|
-
opacity: number;
|
|
549
|
-
/** Animation duration in milliseconds */
|
|
550
|
-
speed: number;
|
|
551
|
-
/** CSS easing function */
|
|
552
|
-
easing: string;
|
|
553
|
-
/** Whether to fade out */
|
|
554
|
-
fadeOut: boolean;
|
|
555
|
-
}
|
|
556
525
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*/
|
|
560
|
-
declare function useParticle({ angle, distance, scale, speed, easing, fadeOut, }: Pick<ParticleProps, "angle" | "distance" | "scale" | "speed" | "easing" | "fadeOut">): UseParticleReturn;
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Particle - Animated particle for burst effects.
|
|
564
|
-
* This version uses Tailwind CSS for styling.
|
|
526
|
+
* Built-in particle effect presets.
|
|
527
|
+
* Each preset provides a distinct visual effect optimized for different use cases.
|
|
565
528
|
*
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
|
|
569
|
-
declare function Particle({ angle, distance, scale, color, shape, speed, easing, fadeOut, }: ParticleProps): react_jsx_runtime.JSX.Element;
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Particle - Animated particle for burst effects.
|
|
573
|
-
* This version uses vanilla CSS (no Tailwind dependency).
|
|
529
|
+
* @example
|
|
530
|
+
* ```tsx
|
|
531
|
+
* import { PARTICLE_PRESETS } from '@jepepa/like-button';
|
|
574
532
|
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
533
|
+
* // Use a preset directly
|
|
534
|
+
* const burstConfig = PARTICLE_PRESETS.burst;
|
|
535
|
+
* ```
|
|
577
536
|
*/
|
|
578
|
-
declare
|
|
537
|
+
declare const PARTICLE_PRESETS: Record<ParticlePreset, ParticlePresetConfig>;
|
|
579
538
|
|
|
580
|
-
export { type BaseLikeButtonProps, type Cursor, type CursorPreset, type CustomCursor, type CustomShape, DefaultHeartIcon, type IconRenderProps, LIKE_BUTTON_DEFAULTS, LikeButton, type LikeButtonProps, LikeButtonVanilla, type LikeButtonVanillaProps,
|
|
539
|
+
export { type BaseLikeButtonProps, type Cursor, type CursorPreset, type CustomCursor, type CustomParticleShape, type CustomShape, DefaultHeartIcon, type IconRenderProps, LIKE_BUTTON_DEFAULTS, LikeButton, type LikeButtonProps, LikeButtonVanilla, type LikeButtonVanillaProps, PARTICLE_PRESETS, type ParticleConfig, type ParticleData, type ParticlePreset, type ParticleShape, type ParticleShapePreset, type ParticleShapeProps, type Range, type Shape, type ShapePreset, type StyleOverrides, type UseLikeButtonOptions, type UseLikeButtonReturn, LikeButton as default, useLikeButton };
|
package/dist/index.js
CHANGED
|
@@ -3,20 +3,16 @@ import {
|
|
|
3
3
|
LIKE_BUTTON_DEFAULTS,
|
|
4
4
|
LikeButton,
|
|
5
5
|
LikeButtonVanilla,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
useParticle
|
|
10
|
-
} from "./chunk-WTGBDIZW.js";
|
|
6
|
+
PARTICLE_PRESETS,
|
|
7
|
+
useLikeButton
|
|
8
|
+
} from "./chunk-BQEOACLZ.js";
|
|
11
9
|
export {
|
|
12
10
|
DefaultHeartIcon,
|
|
13
11
|
LIKE_BUTTON_DEFAULTS,
|
|
14
12
|
LikeButton,
|
|
15
13
|
LikeButtonVanilla,
|
|
16
|
-
|
|
17
|
-
ParticleVanilla,
|
|
14
|
+
PARTICLE_PRESETS,
|
|
18
15
|
LikeButton as default,
|
|
19
|
-
useLikeButton
|
|
20
|
-
useParticle
|
|
16
|
+
useLikeButton
|
|
21
17
|
};
|
|
22
18
|
//# sourceMappingURL=index.js.map
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/* LikeButton Vanilla CSS - No Tailwind dependency */
|
|
2
|
+
|
|
3
|
+
/* ============================================
|
|
4
|
+
Animations
|
|
5
|
+
============================================ */
|
|
6
|
+
|
|
7
|
+
@keyframes wave-scroll-left {
|
|
8
|
+
from {
|
|
9
|
+
transform: translateX(0);
|
|
10
|
+
}
|
|
11
|
+
to {
|
|
12
|
+
transform: translateX(-50%);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@keyframes wave-scroll-right {
|
|
17
|
+
from {
|
|
18
|
+
transform: translateX(-50%);
|
|
19
|
+
}
|
|
20
|
+
to {
|
|
21
|
+
transform: translateX(0);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* ============================================
|
|
26
|
+
Container
|
|
27
|
+
============================================ */
|
|
28
|
+
|
|
29
|
+
.like-button-container {
|
|
30
|
+
position: relative;
|
|
31
|
+
display: inline-block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ============================================
|
|
35
|
+
Button Base
|
|
36
|
+
Note: border-radius, border, box-shadow, and
|
|
37
|
+
background-color are set via inline styles
|
|
38
|
+
to support customization props
|
|
39
|
+
============================================ */
|
|
40
|
+
|
|
41
|
+
.like-button {
|
|
42
|
+
position: relative;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
z-index: 10;
|
|
45
|
+
border-style: solid;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
transition:
|
|
50
|
+
box-shadow 0.15s ease,
|
|
51
|
+
transform 0.15s ease;
|
|
52
|
+
cursor:
|
|
53
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%23EF4444'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E"),
|
|
54
|
+
pointer;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ============================================
|
|
58
|
+
Focus States
|
|
59
|
+
============================================ */
|
|
60
|
+
|
|
61
|
+
.like-button:focus {
|
|
62
|
+
outline: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.like-button:focus-visible {
|
|
66
|
+
outline: 4px solid #111827;
|
|
67
|
+
outline-offset: 2px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ============================================
|
|
71
|
+
Disabled State
|
|
72
|
+
============================================ */
|
|
73
|
+
|
|
74
|
+
.like-button:disabled {
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
opacity: 0.7;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.like-button:disabled:hover {
|
|
80
|
+
transform: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* ============================================
|
|
84
|
+
Liquid Fill
|
|
85
|
+
============================================ */
|
|
86
|
+
|
|
87
|
+
.like-button__fill {
|
|
88
|
+
position: absolute;
|
|
89
|
+
bottom: 0;
|
|
90
|
+
left: 0;
|
|
91
|
+
right: 0;
|
|
92
|
+
z-index: 0;
|
|
93
|
+
transition: height 0.5s ease-out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* ============================================
|
|
97
|
+
Wave Containers
|
|
98
|
+
============================================ */
|
|
99
|
+
|
|
100
|
+
.like-button__wave {
|
|
101
|
+
position: absolute;
|
|
102
|
+
bottom: 100%;
|
|
103
|
+
left: 0;
|
|
104
|
+
width: 200%;
|
|
105
|
+
height: 16px;
|
|
106
|
+
display: flex;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.like-button__wave--back {
|
|
110
|
+
animation: wave-scroll-left 3s linear infinite;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.like-button__wave--front {
|
|
114
|
+
animation: wave-scroll-right 1.5s linear infinite;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.like-button__wave-svg {
|
|
118
|
+
width: 50%;
|
|
119
|
+
height: 100%;
|
|
120
|
+
fill: currentColor;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ============================================
|
|
124
|
+
Icon
|
|
125
|
+
============================================ */
|
|
126
|
+
|
|
127
|
+
.like-button__icon {
|
|
128
|
+
position: relative;
|
|
129
|
+
z-index: 20;
|
|
130
|
+
transition: color 0.3s ease;
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* ============================================
|
|
135
|
+
Particles Container
|
|
136
|
+
============================================ */
|
|
137
|
+
|
|
138
|
+
.like-button__particles {
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: 50%;
|
|
141
|
+
left: 50%;
|
|
142
|
+
transform: translate(-50%, -50%);
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Particle Vanilla CSS - No Tailwind dependency */
|
|
147
|
+
|
|
148
|
+
.particle {
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 40px;
|
|
151
|
+
height: 40px;
|
|
152
|
+
/* Transition properties (duration, timing-function) are set inline via style prop */
|
|
153
|
+
transition-property: transform, opacity;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.particle__icon {
|
|
157
|
+
width: 100%;
|
|
158
|
+
height: 100%;
|
|
159
|
+
fill: currentColor;
|
|
160
|
+
}
|
|
161
|
+
|
package/dist/vanilla.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { BaseLikeButtonProps, Cursor, CursorPreset, CustomCursor, CustomShape, DefaultHeartIcon, IconRenderProps, LIKE_BUTTON_DEFAULTS, LikeButton, LikeButtonProps, LikeButtonVanilla, LikeButtonVanillaProps,
|
|
1
|
+
export { BaseLikeButtonProps, Cursor, CursorPreset, CustomCursor, CustomParticleShape, CustomShape, DefaultHeartIcon, IconRenderProps, LIKE_BUTTON_DEFAULTS, LikeButton, LikeButtonProps, LikeButtonVanilla, LikeButtonVanillaProps, PARTICLE_PRESETS, ParticleConfig, ParticleData, ParticlePreset, ParticleShape, ParticleShapePreset, ParticleShapeProps, Range, Shape, ShapePreset, StyleOverrides, UseLikeButtonOptions, UseLikeButtonReturn, LikeButtonVanilla as default, useLikeButton } from './index.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
package/dist/vanilla.js
CHANGED
|
@@ -3,20 +3,16 @@ import {
|
|
|
3
3
|
LIKE_BUTTON_DEFAULTS,
|
|
4
4
|
LikeButton,
|
|
5
5
|
LikeButtonVanilla,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
useParticle
|
|
10
|
-
} from "./chunk-WTGBDIZW.js";
|
|
6
|
+
PARTICLE_PRESETS,
|
|
7
|
+
useLikeButton
|
|
8
|
+
} from "./chunk-BQEOACLZ.js";
|
|
11
9
|
export {
|
|
12
10
|
DefaultHeartIcon,
|
|
13
11
|
LIKE_BUTTON_DEFAULTS,
|
|
14
12
|
LikeButton,
|
|
15
13
|
LikeButtonVanilla,
|
|
16
|
-
|
|
17
|
-
ParticleVanilla,
|
|
14
|
+
PARTICLE_PRESETS,
|
|
18
15
|
LikeButtonVanilla as default,
|
|
19
|
-
useLikeButton
|
|
20
|
-
useParticle
|
|
16
|
+
useLikeButton
|
|
21
17
|
};
|
|
22
18
|
//# sourceMappingURL=vanilla.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jepepa/like-button",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Animated like button with liquid fill and particle effects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,13 +14,14 @@
|
|
|
14
14
|
"./vanilla": {
|
|
15
15
|
"types": "./dist/vanilla.d.ts",
|
|
16
16
|
"import": "./dist/vanilla.js"
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"./styles.css": "./dist/styles.css"
|
|
18
19
|
},
|
|
19
20
|
"files": [
|
|
20
21
|
"dist"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "tsup",
|
|
24
|
+
"build": "tsup && cat src/LikeButton/LikeButton.vanilla.css src/Particle/Particle.vanilla.css > dist/styles.css",
|
|
24
25
|
"dev": "tsup --watch",
|
|
25
26
|
"test": "vitest run",
|
|
26
27
|
"test:watch": "vitest",
|
|
File without changes
|