Skip to content

Commit 8991047

Browse files
authored
Merge pull request tsparticles#5738 from tsparticles/v4
V4
2 parents 5afc49f + 7008e79 commit 8991047

534 files changed

Lines changed: 4724 additions & 871 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bundles/confetti/src/ConfettiOptions.ts

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,93 +12,57 @@ import {
1212
} from "@tsparticles/engine";
1313
import type { IConfettiOptions } from "./IConfettiOptions.js";
1414

15-
/**
16-
*
17-
*/
15+
/** Confetti options class */
1816
export class ConfettiOptions implements IConfettiOptions, IOptionLoader<IConfettiOptions> {
19-
/**
20-
*
21-
*/
17+
/** Confetti angle */
2218
angle: number;
2319

24-
/**
25-
*
26-
*/
20+
/** Confetti colors */
2721
colors: SingleOrMultiple<string>;
2822

29-
/**
30-
*
31-
*/
23+
/** Number of confetti particles to emit */
3224
count: number;
3325

34-
/**
35-
*
36-
*/
26+
/** Confetti decay rate */
3727
decay: number;
3828

39-
/**
40-
*
41-
*/
29+
/** Disables confetti for users who prefer reduced motion */
4230
disableForReducedMotion: boolean;
4331

44-
/**
45-
*
46-
*/
32+
/** Confetti drift offset */
4733
drift: number;
4834

49-
/**
50-
*
51-
*/
35+
/** Enables flat confetti */
5236
flat: boolean;
5337

54-
/**
55-
*
56-
*/
38+
/** Confetti gravity */
5739
gravity: number;
5840

59-
/**
60-
*
61-
*/
41+
/** Confetti position, in percent values */
6242
position: ICoordinates;
6343

64-
/**
65-
*
66-
*/
44+
/** Confetti size scalar */
6745
scalar: number;
6846

69-
/**
70-
*
71-
*/
47+
/** Per-shape options */
7248
shapeOptions: ShapeData;
7349

74-
/**
75-
*
76-
*/
50+
/** Confetti shape types */
7751
shapes: SingleOrMultiple<string>;
7852

79-
/**
80-
*
81-
*/
53+
/** Confetti spread angle */
8254
spread: number;
8355

84-
/**
85-
*
86-
*/
56+
/** Confetti initial velocity */
8757
startVelocity: number;
8858

89-
/**
90-
*
91-
*/
59+
/** Confetti animation ticks */
9260
ticks: number;
9361

94-
/**
95-
*
96-
*/
62+
/** Confetti z-index */
9763
zIndex: number;
9864

99-
/**
100-
*
101-
*/
65+
/** Creates a new ConfettiOptions instance with default values */
10266
constructor() {
10367
this.angle = 90;
10468
this.count = 50;
@@ -156,7 +120,7 @@ export class ConfettiOptions implements IConfettiOptions, IOptionLoader<IConfett
156120
}
157121

158122
/**
159-
*
123+
* Loads confetti options from the provided data
160124
* @param data -
161125
*/
162126
load(data?: RecursivePartial<IConfettiOptions>): void {
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
import type { IConfettiOptions } from "./IConfettiOptions.js";
22
import type { RecursivePartial } from "@tsparticles/engine";
33

4-
/**
5-
* The {@link confetti} parameter object definition
6-
*/
4+
/** The confetti parameter object definition */
75
export interface ConfettiParams {
8-
/**
9-
*
10-
*/
6+
/** The canvas element to use for the confetti animation */
117
canvas?: HTMLCanvasElement;
128

13-
/**
14-
*
15-
*/
9+
/** The unique identifier for the confetti canvas */
1610
id: string;
1711

18-
/**
19-
*
20-
*/
12+
/** The confetti options object */
2113
options: RecursivePartial<IConfettiOptions>;
2214
}
Lines changed: 17 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,29 @@
11
import type { ICoordinates, SingleOrMultiple } from "@tsparticles/engine";
22

3-
/**
4-
*
5-
*/
3+
/** Confetti options interface */
64
export interface IConfettiOptions {
7-
/**
8-
*
9-
*/
5+
/** Confetti emission angle */
106
angle: number;
117

12-
/**
13-
*
14-
*/
8+
/** Confetti colors */
159
colors: SingleOrMultiple<string>;
1610

17-
/**
18-
*
19-
*/
11+
/** Number of confetti particles */
2012
count: number;
2113

22-
/**
23-
*
24-
*/
14+
/** Confetti decay rate */
2515
decay: number;
2616

27-
/**
28-
*
29-
*/
17+
/** Disables confetti for users who prefer reduced motion */
3018
disableForReducedMotion: boolean;
3119

32-
/**
33-
*
34-
*/
20+
/** Confetti drift */
3521
drift: number;
3622

37-
/**
38-
*
39-
*/
23+
/** Enables flat confetti */
4024
flat: boolean;
4125

42-
/**
43-
*
44-
*/
26+
/** Confetti gravity */
4527
gravity: number;
4628

4729
/**
@@ -54,43 +36,27 @@ export interface IConfettiOptions {
5436
*/
5537
particleCount: number;
5638

57-
/**
58-
*
59-
*/
39+
/** Confetti position in percent */
6040
position: ICoordinates;
6141

62-
/**
63-
*
64-
*/
42+
/** Confetti size scalar */
6543
scalar: number;
6644

67-
/**
68-
*
69-
*/
45+
/** Per-shape options */
7046
shapeOptions: Record<string, SingleOrMultiple<unknown>>;
7147

72-
/**
73-
*
74-
*/
48+
/** Confetti shape types */
7549
shapes: SingleOrMultiple<string>;
7650

77-
/**
78-
*
79-
*/
51+
/** Confetti spread */
8052
spread: number;
8153

82-
/**
83-
*
84-
*/
54+
/** Confetti initial velocity */
8555
startVelocity: number;
8656

87-
/**
88-
*
89-
*/
57+
/** Number of animation ticks */
9058
ticks: number;
9159

92-
/**
93-
*
94-
*/
60+
/** Confetti z-index */
9561
zIndex: number;
9662
}

bundles/confetti/src/confetti.lazy.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,24 @@ import { setConfetti } from "./utils.js";
66
declare const __VERSION__: string;
77

88
declare global {
9-
/**
10-
*
11-
*/
9+
/** The global confetti function */
1210
var confetti: ConfettiFunc & {
13-
/**
14-
*
15-
* @param canvas -
16-
* @param options -
17-
* @returns the confetti function
18-
*/
11+
/** Creates a confetti animation bound to a specific canvas */
1912
create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IConfettiOptions>) => Promise<ConfettiFunc>;
2013

14+
/** Initializes the confetti plugins */
2115
init: () => Promise<void>;
2216

23-
/**
24-
* the confetti version number
25-
*/
17+
/** The confetti bundle version */
2618
version: string;
2719
};
2820
}
2921

3022
let initPromise: Promise<void> | null = null;
3123

3224
/**
33-
* @param engine -
25+
* Initializes all required plugins for the confetti bundle
26+
* @param engine - The engine to register plugins with
3427
* @returns the init plugins promise
3528
* @internal
3629
*/
@@ -186,13 +179,12 @@ confetti.create = async (
186179
};
187180
};
188181

182+
/** Initializes the confetti plugins without creating an animation */
189183
confetti.init = async (): Promise<void> => {
190184
await initPlugins(tsParticles);
191185
};
192186

193-
/**
194-
*
195-
*/
187+
/** The confetti bundle version */
196188
confetti.version = __VERSION__;
197189

198190
globalThis.confetti = confetti;

bundles/confetti/src/confetti.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,24 @@ import { setConfetti } from "./utils.js";
2121
declare const __VERSION__: string;
2222

2323
declare global {
24-
/**
25-
*
26-
*/
24+
/** The global confetti function */
2725
var confetti: ConfettiFunc & {
28-
/**
29-
*
30-
* @param canvas -
31-
* @param options -
32-
* @returns the confetti function
33-
*/
26+
/** Creates a confetti animation bound to a specific canvas */
3427
create: (canvas?: HTMLCanvasElement | null, options?: RecursivePartial<IConfettiOptions>) => Promise<ConfettiFunc>;
3528

29+
/** Initializes the confetti plugins */
3630
init: () => Promise<void>;
3731

38-
/**
39-
* the confetti version number
40-
*/
32+
/** The confetti bundle version */
4133
version: string;
4234
};
4335
}
4436

4537
let initPromise: Promise<void> | null = null;
4638

4739
/**
48-
* @param engine -
40+
* Initializes all required plugins for the confetti bundle
41+
* @param engine - The engine to register plugins with
4942
* @returns the init plugins promise
5043
* @internal
5144
*/
@@ -161,13 +154,12 @@ confetti.create = async (
161154
};
162155
};
163156

157+
/** Initializes the confetti plugins without creating an animation */
164158
confetti.init = async (): Promise<void> => {
165159
await initPlugins(tsParticles);
166160
};
167161

168-
/**
169-
*
170-
*/
162+
/** The confetti bundle version */
171163
confetti.version = __VERSION__;
172164

173165
globalThis.confetti = confetti;

bundles/confetti/src/index.lazy.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { IConfettiOptions } from "./IConfettiOptions.js";
22
import type { RecursivePartial } from "@tsparticles/engine/lazy";
33

4-
/**
5-
*
6-
*/
4+
/** Confetti options type */
75
export type ConfettiOptions = RecursivePartial<IConfettiOptions>;
86

97
export * from "./confetti.lazy.js";

bundles/confetti/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { IConfettiOptions } from "./IConfettiOptions.js";
22
import type { RecursivePartial } from "@tsparticles/engine";
33

4-
/**
5-
*
6-
*/
4+
/** Confetti options type */
75
export type ConfettiOptions = RecursivePartial<IConfettiOptions>;
86

97
export * from "./confetti.js";

0 commit comments

Comments
 (0)