react-confetti-burst 1.0.5 → 1.0.7

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.
@@ -115,10 +115,26 @@ export interface TextShape {
115
115
  /** Cached bitmap for performance */
116
116
  readonly _bitmap?: ImageBitmap | HTMLCanvasElement;
117
117
  }
118
+ /**
119
+ * Custom shape created from an image (URL or HTMLImageElement)
120
+ */
121
+ export interface ImageShape {
122
+ readonly type: "image";
123
+ /** Image source URL */
124
+ readonly src: string;
125
+ /** Pre-loaded image element */
126
+ readonly image?: HTMLImageElement;
127
+ /** Scale factor. Default: 1 */
128
+ readonly scalar?: number;
129
+ /** Display width */
130
+ readonly width?: number;
131
+ /** Display height */
132
+ readonly height?: number;
133
+ }
118
134
  /**
119
135
  * Custom shape union type
120
136
  */
121
- export type CustomShape = PathShape | TextShape;
137
+ export type CustomShape = PathShape | TextShape | ImageShape;
122
138
  /**
123
139
  * Shape types for confetti particles
124
140
  */
@@ -392,7 +408,7 @@ export interface CanvasConfig {
392
408
  readonly height: number | null;
393
409
  /** Auto-resize on window resize. Default: true */
394
410
  readonly autoResize: boolean;
395
- /** Resize debounce delay (ms). Default: 100 */
411
+ /** @deprecated Currently unused. Resize events are handled immediately via ResizeObserver. */
396
412
  readonly resizeDebounce: number;
397
413
  /** Frame rate cap (null = uncapped/60fps). Default: null */
398
414
  readonly frameRate: number | null;
@@ -709,6 +725,110 @@ export interface ConfettiButtonProps extends React$1.ButtonHTMLAttributes<HTMLBu
709
725
  readonly fireOnClick?: boolean;
710
726
  /** Children elements */
711
727
  readonly children: React$1.ReactNode;
728
+ /** Offset the burst origin from the button center (in pixels) */
729
+ readonly originOffset?: {
730
+ x?: number;
731
+ y?: number;
732
+ };
733
+ /** Shorthand direction for the burst (e.g., 'up', 'down') */
734
+ readonly direction?: BurstDirection;
735
+ }
736
+ /**
737
+ * Props for the Confetti component (react-confetti compatible API)
738
+ */
739
+ export interface ConfettiProps {
740
+ /** Canvas width */
741
+ readonly width?: number;
742
+ /** Canvas height */
743
+ readonly height?: number;
744
+ /** Number of confetti pieces at one time */
745
+ readonly numberOfPieces?: number;
746
+ /** Rectangle where confetti should spawn */
747
+ readonly confettiSource?: SpawnArea;
748
+ /** Friction coefficient */
749
+ readonly friction?: number;
750
+ /** Wind force */
751
+ readonly wind?: number;
752
+ /** Gravity strength */
753
+ readonly gravity?: number;
754
+ /** Initial horizontal velocity */
755
+ readonly initialVelocityX?: number | {
756
+ min: number;
757
+ max: number;
758
+ };
759
+ /** Initial vertical velocity */
760
+ readonly initialVelocityY?: number | {
761
+ min: number;
762
+ max: number;
763
+ };
764
+ /** Colors array */
765
+ readonly colors?: string[];
766
+ /** Opacity */
767
+ readonly opacity?: number;
768
+ /** Keep spawning confetti */
769
+ readonly recycle?: boolean;
770
+ /** Run the animation */
771
+ readonly run?: boolean;
772
+ /** Frame rate cap */
773
+ readonly frameRate?: number;
774
+ /** Tween duration */
775
+ readonly tweenDuration?: number;
776
+ /** Tween function */
777
+ readonly tweenFunction?: EasingFunction;
778
+ /** Custom draw function */
779
+ readonly drawShape?: (ctx: CanvasRenderingContext2D) => void;
780
+ /** Callback when all confetti has fallen */
781
+ readonly onConfettiComplete?: () => void;
782
+ /** Canvas ref */
783
+ readonly canvasRef?: React$1.RefObject<HTMLCanvasElement>;
784
+ /** Canvas class name */
785
+ readonly className?: string;
786
+ /** Canvas style */
787
+ readonly style?: React$1.CSSProperties;
788
+ }
789
+ /**
790
+ * Preset configuration names
791
+ */
792
+ export type PresetName = "default" | "celebration" | "firework" | "snow" | "rain" | "sparkle" | "confetti" | "emoji" | "hearts" | "stars" | "money" | "pride" | "christmas" | "halloween" | "newYear" | "birthday";
793
+ /**
794
+ * Preset configuration
795
+ */
796
+ export interface PresetConfig {
797
+ readonly name: PresetName;
798
+ readonly options: ConfettiBurstOptions;
799
+ readonly description: string;
800
+ }
801
+ /**
802
+ * Confetti instance created by confetti.create()
803
+ */
804
+ export interface ConfettiInstance {
805
+ (options?: CanvasConfettiOptions): Promise<void> | null;
806
+ reset(): void;
807
+ }
808
+ /**
809
+ * The confetti function type with all attached convenience methods.
810
+ * This provides proper TypeScript types for the functional API's
811
+ * attached methods like confetti.fireworks(), confetti.snow(), etc.
812
+ */
813
+ export interface ConfettiFunction {
814
+ (options?: CanvasConfettiOptions): Promise<void> | null;
815
+ create(canvas: HTMLCanvasElement, options?: ConfettiCreateOptions): ConfettiInstance;
816
+ reset(): void;
817
+ fireworks(options?: Partial<CanvasConfettiOptions>): Promise<void>;
818
+ schoolPride(options?: Partial<CanvasConfettiOptions>): {
819
+ cancel: () => void;
820
+ };
821
+ snow(options?: {
822
+ duration?: number;
823
+ } & Partial<CanvasConfettiOptions>): {
824
+ cancel: () => void;
825
+ };
826
+ burst(origin: {
827
+ x: number;
828
+ y: number;
829
+ }, options?: Partial<CanvasConfettiOptions>): Promise<void> | null;
830
+ destroyAll(): void;
831
+ getShapes(): string[];
712
832
  }
713
833
  /**
714
834
  * Default vibrant color palette for confetti particles
@@ -730,6 +850,34 @@ export declare const DEFAULT_DIRECTION: DirectionConfig;
730
850
  * Optimized for realistic confetti appearance
731
851
  */
732
852
  export declare const DEFAULT_PARTICLE: ParticleConfig;
853
+ /**
854
+ * Default trail configuration
855
+ */
856
+ export declare const DEFAULT_TRAIL: TrailConfig;
857
+ /**
858
+ * Default glow configuration
859
+ */
860
+ export declare const DEFAULT_GLOW: GlowConfig;
861
+ /**
862
+ * Default continuous mode configuration
863
+ */
864
+ export declare const DEFAULT_CONTINUOUS: ContinuousConfig;
865
+ /**
866
+ * Default firework configuration
867
+ */
868
+ export declare const DEFAULT_FIREWORK: FireworkConfig;
869
+ /**
870
+ * Default canvas configuration
871
+ */
872
+ export declare const DEFAULT_CANVAS: CanvasConfig;
873
+ /**
874
+ * Default accessibility configuration
875
+ */
876
+ export declare const DEFAULT_ACCESSIBILITY: {
877
+ readonly disableForReducedMotion: false;
878
+ readonly ariaLabel: "Confetti animation";
879
+ readonly ariaHidden: true;
880
+ };
733
881
  /**
734
882
  * Complete default configuration
735
883
  */
@@ -742,6 +890,16 @@ export declare const DIRECTION_ANGLES: Record<Exclude<BurstDirection, "custom" |
742
890
  * Easing functions for smooth animations
743
891
  */
744
892
  export declare const EASING_FUNCTIONS: Record<EasingPreset, EasingFunction>;
893
+ /**
894
+ * Sets the maximum particle pool size.
895
+ * Call before creating any ConfettiEngine instances.
896
+ * @param size - Maximum number of particles to pool (default: 500)
897
+ */
898
+ export declare function setMaxPoolSize(size: number): void;
899
+ /**
900
+ * Gets the current maximum particle pool size.
901
+ */
902
+ export declare function getMaxPoolSize(): number;
745
903
  /**
746
904
  * Main confetti engine class
747
905
  */
@@ -861,6 +1019,77 @@ export declare function forceCleanup(): void;
861
1019
  * ```
862
1020
  */
863
1021
  export declare function useConfetti(): UseConfettiReturn;
1022
+ /**
1023
+ * Hook for confetti triggered by a ref element
1024
+ *
1025
+ * @param options - Confetti configuration options
1026
+ * @returns Ref to attach to trigger element and fire function
1027
+ *
1028
+ * @example
1029
+ * ```tsx
1030
+ * const { ref, fire } = useConfettiTrigger();
1031
+ *
1032
+ * return (
1033
+ * <button ref={ref} onClick={fire}>
1034
+ * Celebrate!
1035
+ * </button>
1036
+ * );
1037
+ * ```
1038
+ */
1039
+ export declare function useConfettiTrigger<T extends HTMLElement = HTMLElement>(options?: ConfettiBurstOptions): {
1040
+ ref: React$1.RefObject<T>;
1041
+ fire: () => ExplosionHandle | null;
1042
+ isActive: boolean;
1043
+ };
1044
+ /**
1045
+ * Hook for auto-firing confetti when a condition becomes true
1046
+ *
1047
+ * @param condition - When true, fires confetti
1048
+ * @param origin - Origin point for the burst
1049
+ * @param options - Confetti configuration options
1050
+ *
1051
+ * @example
1052
+ * ```tsx
1053
+ * const [isComplete, setIsComplete] = useState(false);
1054
+ *
1055
+ * useConfettiOnCondition(isComplete, { x: 500, y: 300 });
1056
+ * ```
1057
+ */
1058
+ export declare function useConfettiOnCondition(condition: boolean, origin: BurstOrigin, options?: ConfettiBurstOptions): void;
1059
+ /**
1060
+ * Hook for sequencing multiple confetti bursts
1061
+ *
1062
+ * @param bursts - Array of burst configurations with delays
1063
+ * @returns Start function and active state
1064
+ *
1065
+ * @example
1066
+ * ```tsx
1067
+ * const { start, isActive } = useConfettiSequence([
1068
+ * { origin: { x: 100, y: 100 }, delay: 0 },
1069
+ * { origin: { x: 300, y: 100 }, delay: 200 },
1070
+ * { origin: { x: 500, y: 100 }, delay: 400 },
1071
+ * ]);
1072
+ * ```
1073
+ */
1074
+ export declare function useConfettiSequence(bursts: Array<{
1075
+ origin: BurstOrigin;
1076
+ options?: ConfettiBurstOptions;
1077
+ delay: number;
1078
+ }>): {
1079
+ start: () => void;
1080
+ isActive: boolean;
1081
+ cancel: () => void;
1082
+ };
1083
+ /**
1084
+ * Hook for viewport-centered confetti
1085
+ *
1086
+ * @param options - Confetti configuration options
1087
+ * @returns Fire function for center-screen confetti
1088
+ */
1089
+ export declare function useConfettiCenter(options?: ConfettiBurstOptions): {
1090
+ fire: () => ExplosionHandle;
1091
+ isActive: boolean;
1092
+ };
864
1093
  /**
865
1094
  * Declarative confetti component that fires when active prop changes
866
1095
  *
@@ -883,6 +1112,33 @@ export declare function useConfetti(): UseConfettiReturn;
883
1112
  * ```
884
1113
  */
885
1114
  export declare function ConfettiBurst({ active, origin, triggerRef, options, onComplete, }: ConfettiBurstProps): null;
1115
+ /**
1116
+ * Handle type for ConfettiTrigger ref
1117
+ */
1118
+ export interface ConfettiTriggerHandle {
1119
+ fire: () => ExplosionHandle | null;
1120
+ }
1121
+ /**
1122
+ * Invisible trigger component that fires confetti from its position
1123
+ *
1124
+ * @example
1125
+ * ```tsx
1126
+ * const triggerRef = useRef<ConfettiTriggerHandle>(null);
1127
+ *
1128
+ * return (
1129
+ * <div style={{ position: 'relative' }}>
1130
+ * <ConfettiTrigger ref={triggerRef} options={{ particleCount: 100 }} />
1131
+ * <button onClick={() => triggerRef.current?.fire()}>
1132
+ * Fire!
1133
+ * </button>
1134
+ * </div>
1135
+ * );
1136
+ * ```
1137
+ */
1138
+ export declare const ConfettiTrigger: React$1.ForwardRefExoticComponent<{
1139
+ options?: ConfettiBurstProps["options"];
1140
+ style?: React$1.CSSProperties;
1141
+ } & React$1.RefAttributes<ConfettiTriggerHandle>>;
886
1142
  /**
887
1143
  * Button component that automatically fires confetti on click
888
1144
  *
@@ -900,11 +1156,163 @@ export declare function ConfettiBurst({ active, origin, triggerRef, options, onC
900
1156
  */
901
1157
  export declare const ConfettiButton: React$1.ForwardRefExoticComponent<ConfettiButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
902
1158
  /**
903
- * Generates a random number within a range
1159
+ * Props for ConfettiOnMount component
1160
+ */
1161
+ export interface ConfettiOnMountProps {
1162
+ origin?: BurstOrigin;
1163
+ options?: ConfettiBurstProps["options"];
1164
+ onComplete?: () => void;
1165
+ delay?: number;
1166
+ }
1167
+ /**
1168
+ * Component that fires confetti when mounted
1169
+ *
1170
+ * @example
1171
+ * ```tsx
1172
+ * // Fire confetti when a success page loads
1173
+ * function SuccessPage() {
1174
+ * return (
1175
+ * <div>
1176
+ * <ConfettiOnMount
1177
+ * origin={{ x: window.innerWidth / 2, y: window.innerHeight / 3 }}
1178
+ * options={{ particleCount: 100 }}
1179
+ * />
1180
+ * <h1>Success!</h1>
1181
+ * </div>
1182
+ * );
1183
+ * }
1184
+ * ```
1185
+ */
1186
+ export declare function ConfettiOnMount({ origin, options, onComplete, delay, }: ConfettiOnMountProps): null;
1187
+ /**
1188
+ * Props for ConfettiCannon component
1189
+ */
1190
+ export interface ConfettiCannonProps {
1191
+ /** Position from left (percentage or pixels) */
1192
+ left?: number | string;
1193
+ /** Position from top (percentage or pixels) */
1194
+ top?: number | string;
1195
+ /** Angle in degrees (0 = right, 90 = up) */
1196
+ angle?: number;
1197
+ /** Confetti options */
1198
+ options?: ConfettiBurstProps["options"];
1199
+ /** When true, fires the cannon */
1200
+ fire?: boolean;
1201
+ /** Callback when animation completes */
1202
+ onComplete?: () => void;
1203
+ }
1204
+ /**
1205
+ * Positioned cannon component for directional confetti bursts
1206
+ *
1207
+ * @example
1208
+ * ```tsx
1209
+ * <ConfettiCannon
1210
+ * left="10%"
1211
+ * top="80%"
1212
+ * angle={60}
1213
+ * fire={shouldFire}
1214
+ * options={{ particleCount: 50 }}
1215
+ * />
1216
+ * ```
1217
+ */
1218
+ export declare function ConfettiCannon({ left, top, angle, options, fire: shouldFire, onComplete, }: ConfettiCannonProps): null;
1219
+ /**
1220
+ * React-confetti compatible Confetti component
1221
+ *
1222
+ * This component provides a drop-in replacement for react-confetti
1223
+ * with continuous confetti that falls from the top of the screen.
1224
+ *
1225
+ * @example
1226
+ * ```tsx
1227
+ * // Basic usage - continuous confetti
1228
+ * <Confetti />
1229
+ *
1230
+ * // With options
1231
+ * <Confetti
1232
+ * width={window.innerWidth}
1233
+ * height={window.innerHeight}
1234
+ * numberOfPieces={200}
1235
+ * recycle={true}
1236
+ * run={true}
1237
+ * />
1238
+ *
1239
+ * // With custom draw function
1240
+ * <Confetti
1241
+ * drawShape={ctx => {
1242
+ * ctx.beginPath();
1243
+ * ctx.arc(0, 0, 5, 0, Math.PI * 2);
1244
+ * ctx.fill();
1245
+ * }}
1246
+ * />
1247
+ * ```
1248
+ */
1249
+ export interface ConfettiComponentProps {
1250
+ /** Width of the canvas in pixels (default: window.innerWidth) */
1251
+ width?: number;
1252
+ /** Height of the canvas in pixels (default: window.innerHeight) */
1253
+ height?: number;
1254
+ /** Number of confetti pieces (default: 200) */
1255
+ numberOfPieces?: number;
1256
+ /** Spawn area for confetti pieces */
1257
+ confettiSource?: {
1258
+ x: number;
1259
+ y: number;
1260
+ w?: number;
1261
+ h?: number;
1262
+ };
1263
+ /** Initial horizontal velocity range (default: [4, 10]) */
1264
+ initialVelocityX?: number | {
1265
+ min: number;
1266
+ max: number;
1267
+ };
1268
+ /** Initial vertical velocity range (default: [10, 30]) */
1269
+ initialVelocityY?: number | {
1270
+ min: number;
1271
+ max: number;
1272
+ };
1273
+ /** Whether to recycle confetti (default: true) */
1274
+ recycle?: boolean;
1275
+ /** Whether the animation is running (default: true) */
1276
+ run?: boolean;
1277
+ /** Gravity value (default: 0.3) */
1278
+ gravity?: number;
1279
+ /** Wind value (default: 0) */
1280
+ wind?: number;
1281
+ /** Opacity of confetti pieces (0-1, default: 1) */
1282
+ opacity?: number;
1283
+ /** Custom draw function */
1284
+ drawShape?: (ctx: CanvasRenderingContext2D) => void;
1285
+ /** Tween duration when recycle changes (ms) */
1286
+ tweenDuration?: number;
1287
+ /** Array of colors */
1288
+ colors?: string[];
1289
+ /** Callback when confetti is created */
1290
+ onConfettiComplete?: (confetti: any) => void;
1291
+ /** Frame rate limit */
1292
+ frameRate?: number;
1293
+ /** Z-index of the canvas */
1294
+ style?: React$1.CSSProperties;
1295
+ /** Class name for the canvas */
1296
+ className?: string;
1297
+ }
1298
+ export declare function Confetti({ width, height, numberOfPieces, confettiSource, initialVelocityX, initialVelocityY, recycle, run, gravity, wind, opacity, drawShape, tweenDuration, colors, onConfettiComplete, frameRate, }: ConfettiComponentProps): null;
1299
+ export declare namespace Confetti {
1300
+ var displayName: string;
1301
+ }
1302
+ /**
1303
+ * Generates a random number within a range (inclusive min, exclusive max)
1304
+ * @param min - Minimum value (inclusive)
1305
+ * @param max - Maximum value (exclusive)
1306
+ * @returns Random number in [min, max)
1307
+ * @example randomInRange(5, 15) // e.g. 8.342
904
1308
  */
905
1309
  export declare function randomInRange(min: number, max: number): number;
906
1310
  /**
907
- * Generates a random integer within a range (inclusive)
1311
+ * Generates a random integer within a range (inclusive on both ends)
1312
+ * @param min - Minimum integer value (inclusive)
1313
+ * @param max - Maximum integer value (inclusive)
1314
+ * @returns Random integer in [min, max]
1315
+ * @example randomInt(1, 6) // e.g. 3
908
1316
  */
909
1317
  export declare function randomInt(min: number, max: number): number;
910
1318
  /**
@@ -913,18 +1321,34 @@ export declare function randomInt(min: number, max: number): number;
913
1321
  export declare function randomFromArray<T>(array: readonly T[]): T;
914
1322
  /**
915
1323
  * Clamps a value between min and max
1324
+ * @param value - Value to clamp
1325
+ * @param min - Minimum bound
1326
+ * @param max - Maximum bound
1327
+ * @returns Clamped value in [min, max]
1328
+ * @example clamp(15, 0, 10) // 10
916
1329
  */
917
1330
  export declare function clamp(value: number, min: number, max: number): number;
918
1331
  /**
919
1332
  * Linear interpolation between two values
1333
+ * @param start - Start value (t=0)
1334
+ * @param end - End value (t=1)
1335
+ * @param t - Interpolation factor, clamped to [0, 1]
1336
+ * @returns Interpolated value
1337
+ * @example lerp(0, 100, 0.5) // 50
920
1338
  */
921
1339
  export declare function lerp(start: number, end: number, t: number): number;
922
1340
  /**
923
1341
  * Converts degrees to radians
1342
+ * @param degrees - Angle in degrees
1343
+ * @returns Angle in radians
1344
+ * @example degToRad(180) // Math.PI
924
1345
  */
925
1346
  export declare function degToRad(degrees: number): number;
926
1347
  /**
927
1348
  * Converts radians to degrees
1349
+ * @param radians - Angle in radians
1350
+ * @returns Angle in degrees
1351
+ * @example radToDeg(Math.PI) // 180
928
1352
  */
929
1353
  export declare function radToDeg(radians: number): number;
930
1354
  /**
@@ -985,10 +1409,14 @@ export declare namespace confetti {
985
1409
  };
986
1410
  var reset: () => void;
987
1411
  var fireworks: (options?: Partial<CanvasConfettiOptions>) => Promise<void>;
988
- var schoolPride: (options?: Partial<CanvasConfettiOptions>) => void;
1412
+ var schoolPride: (options?: Partial<CanvasConfettiOptions>) => {
1413
+ cancel: () => void;
1414
+ };
989
1415
  var snow: (options?: {
990
1416
  duration?: number;
991
- } & Partial<CanvasConfettiOptions>) => void;
1417
+ } & Partial<CanvasConfettiOptions>) => {
1418
+ cancel: () => void;
1419
+ };
992
1420
  var burst: (origin: {
993
1421
  x: number;
994
1422
  y: number;
@@ -996,6 +1424,300 @@ export declare namespace confetti {
996
1424
  var destroyAll: () => void;
997
1425
  var getShapes: () => string[];
998
1426
  }
1427
+ /**
1428
+ * Color palettes for presets
1429
+ */
1430
+ export declare const COLOR_PALETTES: {
1431
+ readonly rainbow: readonly string[];
1432
+ readonly pride: readonly [
1433
+ "#E40303",
1434
+ "#FF8C00",
1435
+ "#FFED00",
1436
+ "#008026",
1437
+ "#24408E",
1438
+ "#732982"
1439
+ ];
1440
+ readonly christmas: readonly [
1441
+ "#C41E3A",
1442
+ "#165B33",
1443
+ "#FFD700",
1444
+ "#FFFFFF",
1445
+ "#BB2528"
1446
+ ];
1447
+ readonly halloween: readonly [
1448
+ "#FF6600",
1449
+ "#000000",
1450
+ "#8B008B",
1451
+ "#00FF00",
1452
+ "#FFD700"
1453
+ ];
1454
+ readonly pastel: readonly [
1455
+ "#FFB3BA",
1456
+ "#FFDFBA",
1457
+ "#FFFFBA",
1458
+ "#BAFFC9",
1459
+ "#BAE1FF"
1460
+ ];
1461
+ readonly neon: readonly [
1462
+ "#FF00FF",
1463
+ "#00FFFF",
1464
+ "#FF0080",
1465
+ "#80FF00",
1466
+ "#FF8000"
1467
+ ];
1468
+ readonly gold: readonly [
1469
+ "#FFD700",
1470
+ "#DAA520",
1471
+ "#B8860B",
1472
+ "#FFC125",
1473
+ "#FFDF00"
1474
+ ];
1475
+ readonly silver: readonly [
1476
+ "#C0C0C0",
1477
+ "#A8A8A8",
1478
+ "#D3D3D3",
1479
+ "#DCDCDC",
1480
+ "#E8E8E8"
1481
+ ];
1482
+ readonly hearts: readonly [
1483
+ "#FF69B4",
1484
+ "#FF1493",
1485
+ "#FF007F",
1486
+ "#DC143C",
1487
+ "#FFB6C1"
1488
+ ];
1489
+ readonly ocean: readonly [
1490
+ "#006994",
1491
+ "#00CED1",
1492
+ "#20B2AA",
1493
+ "#48D1CC",
1494
+ "#87CEEB"
1495
+ ];
1496
+ };
1497
+ /**
1498
+ * Emoji sets for presets
1499
+ */
1500
+ export declare const EMOJI_SETS: {
1501
+ readonly celebration: readonly [
1502
+ "\uD83C\uDF89",
1503
+ "\uD83C\uDF8A",
1504
+ "\uD83E\uDD73",
1505
+ "\u2728",
1506
+ "\uD83C\uDF88"
1507
+ ];
1508
+ readonly hearts: readonly [
1509
+ "\u2764\uFE0F",
1510
+ "\uD83D\uDC95",
1511
+ "\uD83D\uDC96",
1512
+ "\uD83D\uDC97",
1513
+ "\uD83D\uDC93",
1514
+ "\uD83D\uDC98"
1515
+ ];
1516
+ readonly stars: readonly [
1517
+ "\u2B50",
1518
+ "\uD83C\uDF1F",
1519
+ "\u2728",
1520
+ "\uD83D\uDCAB",
1521
+ "\u26A1"
1522
+ ];
1523
+ readonly money: readonly [
1524
+ "\uD83D\uDCB0",
1525
+ "\uD83D\uDCB5",
1526
+ "\uD83D\uDCB8",
1527
+ "\uD83E\uDD11",
1528
+ "\uD83D\uDC8E"
1529
+ ];
1530
+ readonly christmas: readonly [
1531
+ "\uD83C\uDF84",
1532
+ "\uD83C\uDF85",
1533
+ "\uD83C\uDF81",
1534
+ "\u2744\uFE0F",
1535
+ "\u2B50"
1536
+ ];
1537
+ readonly halloween: readonly [
1538
+ "\uD83C\uDF83",
1539
+ "\uD83D\uDC7B",
1540
+ "\uD83E\uDD87",
1541
+ "\uD83D\uDD77\uFE0F",
1542
+ "\uD83D\uDC80"
1543
+ ];
1544
+ readonly birthday: readonly [
1545
+ "\uD83C\uDF82",
1546
+ "\uD83C\uDF81",
1547
+ "\uD83C\uDF88",
1548
+ "\uD83C\uDF89",
1549
+ "\uD83E\uDD73"
1550
+ ];
1551
+ readonly food: readonly [
1552
+ "\uD83C\uDF55",
1553
+ "\uD83C\uDF54",
1554
+ "\uD83C\uDF5F",
1555
+ "\uD83C\uDF2D",
1556
+ "\uD83C\uDF7F"
1557
+ ];
1558
+ };
1559
+ /**
1560
+ * Preset configurations for quick setup
1561
+ */
1562
+ export declare const PRESETS: Record<PresetName, PresetConfig>;
1563
+ /**
1564
+ * Get a preset configuration by name
1565
+ */
1566
+ export declare function getPreset(name: PresetName): PresetConfig;
1567
+ /**
1568
+ * Get all available preset names
1569
+ */
1570
+ export declare function getPresetNames(): readonly PresetName[];
1571
+ /**
1572
+ * Convert a preset's ConfettiBurstOptions to CanvasConfettiOptions
1573
+ * for use with the confetti() functional API.
1574
+ *
1575
+ * Presets use the nested ConfettiBurstOptions format (particle.colors,
1576
+ * physics.gravity, direction.spread), but confetti() expects the flat
1577
+ * CanvasConfettiOptions format (colors, gravity, spread).
1578
+ *
1579
+ * @example
1580
+ * ```ts
1581
+ * import { getPreset, presetToCanvasOptions, confetti } from 'react-confetti-burst';
1582
+ *
1583
+ * const preset = getPreset('celebration');
1584
+ * confetti(presetToCanvasOptions(preset.options));
1585
+ * ```
1586
+ *
1587
+ * @param options - ConfettiBurstOptions from a preset (or any hook/component options)
1588
+ * @returns Equivalent CanvasConfettiOptions for use with confetti()
1589
+ */
1590
+ export declare function presetToCanvasOptions(options: ConfettiBurstOptions): CanvasConfettiOptions;
1591
+ /**
1592
+ * Options for creating a shape from an SVG path
1593
+ */
1594
+ export interface ShapeFromPathOptions {
1595
+ /** SVG path string (d attribute) */
1596
+ readonly path: string;
1597
+ /** Optional 2D transformation matrix [a, b, c, d, e, f] */
1598
+ readonly matrix?: readonly number[];
1599
+ /** Fill color (optional, will use particle color if not set) */
1600
+ readonly fillColor?: string;
1601
+ /** Stroke color (optional) */
1602
+ readonly strokeColor?: string;
1603
+ /** Stroke width (optional) */
1604
+ readonly strokeWidth?: number;
1605
+ }
1606
+ /**
1607
+ * Options for creating a shape from text/emoji
1608
+ */
1609
+ export interface ShapeFromTextOptions {
1610
+ /** Text or emoji to render */
1611
+ readonly text: string;
1612
+ /** Scale factor for the text size. Default: 1 */
1613
+ readonly scalar?: number;
1614
+ /** Text color (optional, will use particle color if not set) */
1615
+ readonly color?: string;
1616
+ /** Font family. Default: 'serif' */
1617
+ readonly fontFamily?: string;
1618
+ /** Font weight. Default: 'normal' */
1619
+ readonly fontWeight?: string | number;
1620
+ /** Font style. Default: 'normal' */
1621
+ readonly fontStyle?: "normal" | "italic" | "oblique";
1622
+ }
1623
+ /**
1624
+ * Create a custom shape from an SVG path string.
1625
+ *
1626
+ * This is compatible with canvas-confetti's shapeFromPath function.
1627
+ *
1628
+ * @example
1629
+ * ```typescript
1630
+ * // Simple star shape
1631
+ * const star = shapeFromPath({
1632
+ * path: 'M0,-1 L0.588,0.809 L-0.951,-0.309 L0.951,-0.309 L-0.588,0.809 Z'
1633
+ * });
1634
+ *
1635
+ * // With transformation matrix
1636
+ * const scaledStar = shapeFromPath({
1637
+ * path: 'M0,-1 L0.588,0.809 L-0.951,-0.309 L0.951,-0.309 L-0.588,0.809 Z',
1638
+ * matrix: [2, 0, 0, 2, 0, 0] // Scale 2x
1639
+ * });
1640
+ *
1641
+ * // Usage with confetti
1642
+ * fire({ x: 0.5, y: 0.5 }, {
1643
+ * particle: { shapes: [star, 'circle'] }
1644
+ * });
1645
+ * ```
1646
+ *
1647
+ * @param options - Shape configuration options
1648
+ * @returns PathShape object for use in confetti configuration
1649
+ */
1650
+ export declare function shapeFromPath(options: ShapeFromPathOptions): PathShape;
1651
+ /**
1652
+ * Create a custom shape from text or an emoji.
1653
+ *
1654
+ * This is compatible with canvas-confetti's shapeFromText function.
1655
+ *
1656
+ * @example
1657
+ * ```typescript
1658
+ * // Emoji confetti
1659
+ * const heart = shapeFromText({ text: '❤️' });
1660
+ * const party = shapeFromText({ text: '🎉', scalar: 2 });
1661
+ *
1662
+ * // Custom text
1663
+ * const yay = shapeFromText({
1664
+ * text: 'YAY',
1665
+ * fontFamily: 'Impact',
1666
+ * color: '#ff0000'
1667
+ * });
1668
+ *
1669
+ * // Usage with confetti
1670
+ * fire({ x: 0.5, y: 0.5 }, {
1671
+ * particle: { shapes: [heart, party, yay] }
1672
+ * });
1673
+ * ```
1674
+ *
1675
+ * @param options - Text shape configuration options
1676
+ * @returns TextShape object for use in confetti configuration
1677
+ */
1678
+ export declare function shapeFromText(options: ShapeFromTextOptions): TextShape;
1679
+ /**
1680
+ * Create a bitmap shape from an image URL or HTMLImageElement.
1681
+ *
1682
+ * @example
1683
+ * ```typescript
1684
+ * const logo = await shapeFromImage({
1685
+ * src: '/logo.png',
1686
+ * width: 32,
1687
+ * height: 32
1688
+ * });
1689
+ *
1690
+ * fire({ x: 0.5, y: 0.5 }, {
1691
+ * particle: { shapes: [logo] }
1692
+ * });
1693
+ * ```
1694
+ *
1695
+ * @param options - Image shape configuration options
1696
+ * @returns Promise resolving to a custom shape
1697
+ */
1698
+ export declare function shapeFromImage(options: {
1699
+ readonly src: string | HTMLImageElement;
1700
+ readonly width?: number;
1701
+ readonly height?: number;
1702
+ readonly scalar?: number;
1703
+ }): Promise<ImageShape>;
1704
+ /**
1705
+ * Create multiple shapes from an array of emoji.
1706
+ *
1707
+ * @example
1708
+ * ```typescript
1709
+ * const partyEmoji = shapesFromEmoji(['🎉', '🎊', '✨', '🥳']);
1710
+ *
1711
+ * fire({ x: 0.5, y: 0.5 }, {
1712
+ * particle: { shapes: partyEmoji }
1713
+ * });
1714
+ * ```
1715
+ *
1716
+ * @param emojis - Array of emoji strings
1717
+ * @param options - Optional common options for all emoji
1718
+ * @returns Array of TextShape objects
1719
+ */
1720
+ export declare function shapesFromEmoji(emojis: readonly string[], options?: Omit<ShapeFromTextOptions, "text">): TextShape[];
999
1721
 
1000
1722
  export {
1001
1723
  confetti as default,