@tsparticles/fireworks 4.0.0-beta.9 → 4.0.1

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.
Files changed (141) hide show
  1. package/README.md +98 -45
  2. package/browser/browser.js +5 -0
  3. package/browser/bundle.js +4 -0
  4. package/browser/fireworks.js +32 -216
  5. package/browser/fireworks.lazy.js +64 -0
  6. package/browser/index.lazy.js +1 -0
  7. package/browser/types.js +1 -0
  8. package/browser/utils.js +195 -0
  9. package/cjs/browser.js +5 -0
  10. package/cjs/bundle.js +4 -0
  11. package/cjs/fireworks.js +32 -216
  12. package/cjs/fireworks.lazy.js +64 -0
  13. package/cjs/index.lazy.js +1 -0
  14. package/cjs/types.js +1 -0
  15. package/cjs/utils.js +195 -0
  16. package/esm/browser.js +5 -0
  17. package/esm/bundle.js +4 -0
  18. package/esm/fireworks.js +32 -216
  19. package/esm/fireworks.lazy.js +64 -0
  20. package/esm/index.lazy.js +1 -0
  21. package/esm/types.js +1 -0
  22. package/esm/utils.js +195 -0
  23. package/package.json +19 -12
  24. package/report.html +4949 -94
  25. package/tsparticles.fireworks.bundle.js +9132 -977
  26. package/tsparticles.fireworks.bundle.min.js +1 -2
  27. package/tsparticles.fireworks.js +395 -467
  28. package/tsparticles.fireworks.min.js +1 -2
  29. package/types/browser.d.ts +1 -0
  30. package/types/fireworks.d.ts +3 -6
  31. package/types/fireworks.lazy.d.ts +17 -0
  32. package/types/index.lazy.d.ts +4 -0
  33. package/types/types.d.ts +6 -0
  34. package/types/utils.d.ts +6 -0
  35. package/1241.min.js +0 -1
  36. package/1581.min.js +0 -1
  37. package/2049.min.js +0 -1
  38. package/2066.min.js +0 -1
  39. package/2127.min.js +0 -1
  40. package/218.min.js +0 -1
  41. package/2191.min.js +0 -1
  42. package/2270.min.js +0 -1
  43. package/2556.min.js +0 -1
  44. package/2602.min.js +0 -1
  45. package/2760.min.js +0 -1
  46. package/2865.min.js +0 -33
  47. package/3047.min.js +0 -1
  48. package/3073.min.js +0 -1
  49. package/3384.min.js +0 -1
  50. package/3443.min.js +0 -1
  51. package/3583.min.js +0 -1
  52. package/374.min.js +0 -1
  53. package/382.min.js +0 -1
  54. package/4068.min.js +0 -1
  55. package/4186.min.js +0 -1
  56. package/4217.min.js +0 -1
  57. package/4427.min.js +0 -1
  58. package/4519.min.js +0 -1
  59. package/4626.min.js +0 -1
  60. package/5048.min.js +0 -1
  61. package/5218.min.js +0 -1
  62. package/5294.min.js +0 -1
  63. package/5344.min.js +0 -1
  64. package/5445.min.js +0 -1
  65. package/5492.min.js +0 -1
  66. package/5629.min.js +0 -1
  67. package/5675.min.js +0 -1
  68. package/6055.min.js +0 -1
  69. package/6067.min.js +0 -1
  70. package/6099.min.js +0 -1
  71. package/6171.min.js +0 -1
  72. package/648.min.js +0 -1
  73. package/6602.min.js +0 -1
  74. package/6943.min.js +0 -1
  75. package/6996.min.js +0 -1
  76. package/7162.min.js +0 -1
  77. package/7698.min.js +0 -1
  78. package/7711.min.js +0 -1
  79. package/7757.min.js +0 -1
  80. package/7792.min.js +0 -1
  81. package/8272.min.js +0 -1
  82. package/8386.min.js +0 -1
  83. package/8529.min.js +0 -1
  84. package/8607.min.js +0 -1
  85. package/8656.min.js +0 -1
  86. package/8731.min.js +0 -1
  87. package/9407.min.js +0 -1
  88. package/9674.min.js +0 -1
  89. package/basic_dist_browser_index_js.js +0 -30
  90. package/dist_browser_FireworksInstance_js.js +0 -30
  91. package/engine_dist_browser_Core_Container_js.js +0 -100
  92. package/plugins_blend_dist_browser_BlendPluginInstance_js.js +0 -30
  93. package/plugins_blend_dist_browser_BlendPlugin_js.js +0 -40
  94. package/plugins_blend_dist_browser_index_js.js +0 -30
  95. package/plugins_colors_hex_dist_browser_HexColorManager_js.js +0 -30
  96. package/plugins_colors_hex_dist_browser_index_js.js +0 -30
  97. package/plugins_colors_hsl_dist_browser_HslColorManager_js.js +0 -30
  98. package/plugins_colors_hsl_dist_browser_index_js.js +0 -30
  99. package/plugins_colors_rgb_dist_browser_RgbColorManager_js.js +0 -30
  100. package/plugins_colors_rgb_dist_browser_index_js.js +0 -30
  101. package/plugins_emittersShapes_square_dist_browser_EmittersSquareShapeGenerator_js.js +0 -100
  102. package/plugins_emittersShapes_square_dist_browser_index_js.js +0 -30
  103. package/plugins_emitters_dist_browser_EmitterInstance_js.js +0 -30
  104. package/plugins_emitters_dist_browser_EmittersInstancesManager_js.js +0 -100
  105. package/plugins_emitters_dist_browser_EmittersInteractor_js.js +0 -210
  106. package/plugins_emitters_dist_browser_EmittersPluginInstance_js.js +0 -30
  107. package/plugins_emitters_dist_browser_EmittersPlugin_js.js +0 -100
  108. package/plugins_emitters_dist_browser_ShapeManager_js.js +0 -30
  109. package/plugins_emitters_dist_browser_addEmittersShapesManager_js.js +0 -30
  110. package/plugins_emitters_dist_browser_getEmittersInstancesManager_js.js +0 -30
  111. package/plugins_emitters_dist_browser_index_js.js +0 -80
  112. package/plugins_emitters_dist_browser_plugin_js.js +0 -50
  113. package/plugins_interactivity_dist_browser_InteractivityPluginInstance_js.js +0 -50
  114. package/plugins_interactivity_dist_browser_InteractivityPlugin_js.js +0 -70
  115. package/plugins_interactivity_dist_browser_index_js.js +0 -120
  116. package/plugins_move_dist_browser_MovePluginInstance_js.js +0 -40
  117. package/plugins_move_dist_browser_MovePlugin_js.js +0 -30
  118. package/plugins_move_dist_browser_index_js.js +0 -30
  119. package/plugins_sounds_dist_browser_SoundsPluginInstance_js.js +0 -40
  120. package/plugins_sounds_dist_browser_SoundsPlugin_js.js +0 -130
  121. package/plugins_sounds_dist_browser_index_js.js +0 -30
  122. package/shapes_circle_dist_browser_CircleDrawer_js.js +0 -40
  123. package/shapes_circle_dist_browser_index_js.js +0 -30
  124. package/shapes_line_dist_browser_LineDrawer_js.js +0 -40
  125. package/shapes_line_dist_browser_index_js.js +0 -30
  126. package/updaters_destroy_dist_browser_DestroyUpdater_js.js +0 -100
  127. package/updaters_destroy_dist_browser_index_js.js +0 -30
  128. package/updaters_fillColor_dist_browser_FillColorUpdater_js.js +0 -30
  129. package/updaters_fillColor_dist_browser_index_js.js +0 -30
  130. package/updaters_life_dist_browser_LifeUpdater_js.js +0 -70
  131. package/updaters_life_dist_browser_index_js.js +0 -30
  132. package/updaters_opacity_dist_browser_OpacityUpdater_js.js +0 -30
  133. package/updaters_opacity_dist_browser_index_js.js +0 -30
  134. package/updaters_outModes_dist_browser_OutOfCanvasUpdater_js.js +0 -80
  135. package/updaters_outModes_dist_browser_index_js.js +0 -30
  136. package/updaters_rotate_dist_browser_RotateUpdater_js.js +0 -50
  137. package/updaters_rotate_dist_browser_index_js.js +0 -30
  138. package/updaters_size_dist_browser_SizeUpdater_js.js +0 -30
  139. package/updaters_size_dist_browser_index_js.js +0 -30
  140. package/updaters_strokeColor_dist_browser_StrokeColorUpdater_js.js +0 -30
  141. package/updaters_strokeColor_dist_browser_index_js.js +0 -30
@@ -0,0 +1,195 @@
1
+ import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, getRangeMax, getRangeMin, isNumber, setRangeValue, } from "@tsparticles/engine";
2
+ import { FireworkOptions } from "./FireworkOptions.js";
3
+ const instances = new Map();
4
+ export const explodeSoundCheck = (args) => {
5
+ const data = args.data;
6
+ return data?.particle?.options.move.gravity.enable ?? false;
7
+ };
8
+ export function getOptions(options, canvas) {
9
+ const identity = 1;
10
+ return {
11
+ detectRetina: true,
12
+ background: {
13
+ color: options.background,
14
+ },
15
+ blend: {
16
+ enable: true,
17
+ mode: "lighter",
18
+ },
19
+ fullScreen: {
20
+ enable: !canvas,
21
+ },
22
+ fpsLimit: 60,
23
+ emitters: {
24
+ direction: MoveDirection.top,
25
+ life: {
26
+ count: 0,
27
+ duration: 0.1,
28
+ delay: 0.1,
29
+ },
30
+ rate: {
31
+ delay: isNumber(options.rate)
32
+ ? identity / options.rate
33
+ : { min: identity / getRangeMin(options.rate), max: identity / getRangeMax(options.rate) },
34
+ quantity: 1,
35
+ },
36
+ size: {
37
+ width: 100,
38
+ height: 0,
39
+ },
40
+ position: {
41
+ y: 100,
42
+ x: 50,
43
+ },
44
+ },
45
+ particles: {
46
+ number: {
47
+ value: 0,
48
+ },
49
+ paint: {
50
+ fill: {
51
+ enable: false,
52
+ },
53
+ stroke: {
54
+ color: {
55
+ value: options.colors,
56
+ },
57
+ width: 2,
58
+ },
59
+ },
60
+ destroy: {
61
+ mode: "split",
62
+ bounds: {
63
+ top: setRangeValue(options.minHeight),
64
+ },
65
+ split: {
66
+ count: 1,
67
+ factor: {
68
+ value: 0.333333,
69
+ },
70
+ rate: {
71
+ value: options.splitCount,
72
+ },
73
+ strokeColorOffset: {
74
+ s: options.saturation,
75
+ l: options.brightness,
76
+ },
77
+ particles: {
78
+ group: "split",
79
+ number: {
80
+ value: 0,
81
+ },
82
+ opacity: {
83
+ value: {
84
+ min: 0.1,
85
+ max: 1,
86
+ },
87
+ animation: {
88
+ enable: true,
89
+ speed: { min: 2, max: 4 },
90
+ sync: true,
91
+ startValue: StartValueType.max,
92
+ destroy: DestroyType.min,
93
+ count: 1,
94
+ },
95
+ },
96
+ size: {
97
+ value: { min: 5, max: 10 },
98
+ },
99
+ life: {
100
+ count: 1,
101
+ duration: {
102
+ value: {
103
+ min: 0.5,
104
+ max: 1,
105
+ },
106
+ },
107
+ },
108
+ move: {
109
+ decay: 0.05,
110
+ enable: true,
111
+ gravity: {
112
+ enable: false,
113
+ },
114
+ speed: {
115
+ min: 10,
116
+ max: 25,
117
+ },
118
+ direction: "outside",
119
+ outModes: OutMode.destroy,
120
+ },
121
+ },
122
+ },
123
+ },
124
+ life: {
125
+ count: 1,
126
+ },
127
+ shape: {
128
+ type: "line",
129
+ options: {
130
+ line: {
131
+ cap: "round",
132
+ },
133
+ },
134
+ },
135
+ size: {
136
+ value: { min: 10, max: 20 },
137
+ },
138
+ rotate: {
139
+ path: true,
140
+ },
141
+ move: {
142
+ enable: true,
143
+ gravity: {
144
+ acceleration: setRangeValue(options.gravity),
145
+ enable: true,
146
+ inverse: true,
147
+ maxSpeed: 150,
148
+ },
149
+ speed: setRangeValue(options.speed),
150
+ outModes: {
151
+ default: OutMode.destroy,
152
+ top: OutMode.none,
153
+ },
154
+ },
155
+ },
156
+ sounds: {
157
+ enable: options.sounds,
158
+ events: [
159
+ {
160
+ event: EventType.particleRemoved,
161
+ filter: explodeSoundCheck,
162
+ audio: [
163
+ "https://particles.js.org/audio/explosion0.mp3",
164
+ "https://particles.js.org/audio/explosion1.mp3",
165
+ "https://particles.js.org/audio/explosion2.mp3",
166
+ ],
167
+ },
168
+ ],
169
+ volume: 50,
170
+ },
171
+ };
172
+ }
173
+ export async function getFireworksInstance(engine, id, sourceOptions, canvas) {
174
+ const existing = instances.get(id);
175
+ if (existing instanceof Promise) {
176
+ return existing;
177
+ }
178
+ if (existing) {
179
+ return existing;
180
+ }
181
+ const create = async () => {
182
+ const options = new FireworkOptions();
183
+ options.load(sourceOptions);
184
+ const particlesOptions = getOptions(options, canvas), container = await engine.load({ id, element: canvas, options: particlesOptions });
185
+ if (!container) {
186
+ instances.delete(id);
187
+ return;
188
+ }
189
+ const { FireworksInstance } = await import("./FireworksInstance.js"), instance = new FireworksInstance(container);
190
+ instances.set(id, instance);
191
+ return instance;
192
+ }, createPromise = create();
193
+ instances.set(id, createPromise);
194
+ return createPromise;
195
+ }
package/cjs/browser.js ADDED
@@ -0,0 +1,5 @@
1
+ import { fireworks } from "./index.js";
2
+ const globalObject = globalThis;
3
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
4
+ globalObject.fireworks = fireworks;
5
+ export * from "./index.js";
package/cjs/bundle.js CHANGED
@@ -1,2 +1,6 @@
1
+ import { fireworks } from "./index.js";
1
2
  export * from "./index.js";
2
3
  export * from "@tsparticles/engine";
4
+ const globalObject = globalThis;
5
+ globalObject.__tsParticlesInternals = globalObject.__tsParticlesInternals ?? {};
6
+ globalObject.fireworks = fireworks;
package/cjs/fireworks.js CHANGED
@@ -1,230 +1,45 @@
1
- import { DestroyType, EventType, MoveDirection, OutMode, StartValueType, getRangeMax, getRangeMin, isNumber, isString, setRangeValue, tsParticles, } from "@tsparticles/engine";
2
- import { FireworkOptions } from "./FireworkOptions.js";
3
- let initialized = false, initializing = false;
4
- const explodeSoundCheck = (args) => {
5
- const data = args.data;
6
- return data?.particle?.options.move.gravity.enable ?? false;
7
- };
8
- async function initPlugins(engine) {
9
- if (initialized) {
10
- return;
11
- }
12
- if (initializing) {
13
- return new Promise(resolve => {
14
- const timeout = 100, interval = setInterval(() => {
15
- if (!initialized) {
16
- return;
17
- }
18
- clearInterval(interval);
19
- resolve();
20
- }, timeout);
21
- });
22
- }
23
- initializing = true;
24
- engine.checkVersion("4.0.0-beta.9");
1
+ import { isString, tsParticles } from "@tsparticles/engine";
2
+ import { getFireworksInstance } from "./utils.js";
3
+ import { loadBasic } from "@tsparticles/basic";
4
+ import { loadBlendPlugin } from "@tsparticles/plugin-blend";
5
+ import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
6
+ import { loadEmittersPluginSimple } from "@tsparticles/plugin-emitters/plugin";
7
+ import { loadEmittersShapeSquare } from "@tsparticles/plugin-emitters-shape-square";
8
+ import { loadLifeUpdater } from "@tsparticles/updater-life";
9
+ import { loadLineShape } from "@tsparticles/shape-line";
10
+ import { loadPaintUpdater } from "@tsparticles/updater-paint";
11
+ import { loadRotateUpdater } from "@tsparticles/updater-rotate";
12
+ import { loadSoundsPlugin } from "@tsparticles/plugin-sounds";
13
+ let initPromise = null;
14
+ async function doInitPlugins(engine) {
15
+ engine.checkVersion("4.0.1");
25
16
  await engine.pluginManager.register(async (e) => {
26
- const [{ loadBasic }, { loadLineShape }, { loadBlendPlugin }, { loadEmittersPluginSimple }, { loadEmittersShapeSquare }, { loadSoundsPlugin }, { loadRotateUpdater }, { loadDestroyUpdater }, { loadLifeUpdater }, { loadStrokeColorUpdater },] = await Promise.all([
27
- import("@tsparticles/basic"),
28
- import("@tsparticles/shape-line"),
29
- import("@tsparticles/plugin-blend"),
30
- import("@tsparticles/plugin-emitters/plugin"),
31
- import("@tsparticles/plugin-emitters-shape-square"),
32
- import("@tsparticles/plugin-sounds"),
33
- import("@tsparticles/updater-rotate"),
34
- import("@tsparticles/updater-destroy"),
35
- import("@tsparticles/updater-life"),
36
- import("@tsparticles/updater-stroke-color"),
37
- ]);
17
+ const loadEmittersForFireworks = async (e) => {
18
+ await loadEmittersPluginSimple(e);
19
+ await loadEmittersShapeSquare(e);
20
+ };
38
21
  await Promise.all([
39
22
  loadBasic(e),
40
23
  loadLineShape(e),
41
24
  loadBlendPlugin(e),
42
- (async () => {
43
- await loadEmittersPluginSimple(e);
44
- await loadEmittersShapeSquare(e);
45
- })(),
25
+ loadEmittersForFireworks(e),
46
26
  loadSoundsPlugin(e),
47
27
  loadRotateUpdater(e),
48
28
  loadDestroyUpdater(e),
49
29
  loadLifeUpdater(e),
50
- loadStrokeColorUpdater(e),
30
+ loadPaintUpdater(e),
51
31
  ]);
52
32
  });
53
- initializing = false;
54
- initialized = true;
55
33
  }
56
- function getOptions(options, canvas) {
57
- const identity = 1;
58
- return {
59
- detectRetina: true,
60
- background: {
61
- color: options.background,
62
- },
63
- blend: {
64
- enable: true,
65
- mode: "lighter",
66
- },
67
- fullScreen: {
68
- enable: !canvas,
69
- },
70
- fpsLimit: 60,
71
- emitters: {
72
- direction: MoveDirection.top,
73
- life: {
74
- count: 0,
75
- duration: 0.1,
76
- delay: 0.1,
77
- },
78
- rate: {
79
- delay: isNumber(options.rate)
80
- ? identity / options.rate
81
- : { min: identity / getRangeMin(options.rate), max: identity / getRangeMax(options.rate) },
82
- quantity: 1,
83
- },
84
- size: {
85
- width: 100,
86
- height: 0,
87
- },
88
- position: {
89
- y: 100,
90
- x: 50,
91
- },
92
- },
93
- particles: {
94
- number: {
95
- value: 0,
96
- },
97
- stroke: {
98
- color: {
99
- value: options.colors,
100
- },
101
- width: 2,
102
- },
103
- destroy: {
104
- mode: "split",
105
- bounds: {
106
- top: setRangeValue(options.minHeight),
107
- },
108
- split: {
109
- count: 1,
110
- factor: {
111
- value: 0.333333,
112
- },
113
- rate: {
114
- value: options.splitCount,
115
- },
116
- strokeColorOffset: {
117
- s: options.saturation,
118
- l: options.brightness,
119
- },
120
- particles: {
121
- group: "split",
122
- number: {
123
- value: 0,
124
- },
125
- opacity: {
126
- value: {
127
- min: 0.1,
128
- max: 1,
129
- },
130
- animation: {
131
- enable: true,
132
- speed: { min: 2, max: 4 },
133
- sync: true,
134
- startValue: StartValueType.max,
135
- destroy: DestroyType.min,
136
- count: 1,
137
- },
138
- },
139
- size: {
140
- value: { min: 5, max: 10 },
141
- },
142
- life: {
143
- count: 1,
144
- duration: {
145
- value: {
146
- min: 0.5,
147
- max: 1,
148
- },
149
- },
150
- },
151
- move: {
152
- decay: 0.05,
153
- enable: true,
154
- gravity: {
155
- enable: false,
156
- },
157
- speed: {
158
- min: 10,
159
- max: 25,
160
- },
161
- direction: "outside",
162
- outModes: OutMode.destroy,
163
- },
164
- },
165
- },
166
- },
167
- life: {
168
- count: 1,
169
- },
170
- shape: {
171
- type: "line",
172
- options: {
173
- line: {
174
- cap: "round",
175
- },
176
- },
177
- },
178
- size: {
179
- value: { min: 10, max: 20 },
180
- },
181
- rotate: {
182
- path: true,
183
- },
184
- move: {
185
- enable: true,
186
- gravity: {
187
- acceleration: setRangeValue(options.gravity),
188
- enable: true,
189
- inverse: true,
190
- maxSpeed: 150,
191
- },
192
- speed: setRangeValue(options.speed),
193
- outModes: {
194
- default: OutMode.destroy,
195
- top: OutMode.none,
196
- },
197
- },
198
- },
199
- sounds: {
200
- enable: options.sounds,
201
- events: [
202
- {
203
- event: EventType.particleRemoved,
204
- filter: explodeSoundCheck,
205
- audio: [
206
- "https://particles.js.org/audio/explosion0.mp3",
207
- "https://particles.js.org/audio/explosion1.mp3",
208
- "https://particles.js.org/audio/explosion2.mp3",
209
- ],
210
- },
211
- ],
212
- volume: 50,
213
- },
214
- };
215
- }
216
- async function getFireworksInstance(id, sourceOptions, canvas) {
217
- await initPlugins(tsParticles);
218
- const options = new FireworkOptions();
219
- options.load(sourceOptions);
220
- const particlesOptions = getOptions(options, canvas), container = await tsParticles.load({ id, element: canvas, options: particlesOptions });
221
- if (!container) {
222
- return;
34
+ async function initPlugins(engine) {
35
+ if (initPromise) {
36
+ return initPromise;
223
37
  }
224
- const { FireworksInstance } = await import("./FireworksInstance.js");
225
- return new FireworksInstance(container);
38
+ initPromise = doInitPlugins(engine);
39
+ return initPromise;
226
40
  }
227
41
  export async function fireworks(idOrOptions, sourceOptions) {
42
+ await initPlugins(tsParticles);
228
43
  let id, options;
229
44
  if (isString(idOrOptions)) {
230
45
  id = idOrOptions;
@@ -234,14 +49,15 @@ export async function fireworks(idOrOptions, sourceOptions) {
234
49
  id = "fireworks";
235
50
  options = idOrOptions ?? {};
236
51
  }
237
- return getFireworksInstance(id, options);
52
+ return getFireworksInstance(tsParticles, id, options);
238
53
  }
239
54
  fireworks.create = async (canvas, options) => {
240
- const id = canvas.id || "fireworks";
241
- return getFireworksInstance(id, options ?? {}, canvas);
55
+ await initPlugins(tsParticles);
56
+ const id = canvas?.id ?? "fireworks";
57
+ return getFireworksInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
242
58
  };
243
59
  fireworks.init = async () => {
244
60
  await initPlugins(tsParticles);
245
61
  };
246
- fireworks.version = "4.0.0-beta.9";
62
+ fireworks.version = "4.0.1";
247
63
  globalThis.fireworks = fireworks;
@@ -0,0 +1,64 @@
1
+ import { isString, tsParticles } from "@tsparticles/engine/lazy";
2
+ import { getFireworksInstance } from "./utils.js";
3
+ let initPromise = null;
4
+ async function doInitPlugins(engine) {
5
+ engine.checkVersion("4.0.1");
6
+ await engine.pluginManager.register(async (e) => {
7
+ const [{ loadBasic }, { loadLineShape }, { loadBlendPlugin }, { loadEmittersPluginSimple }, { loadEmittersShapeSquare }, { loadSoundsPlugin }, { loadRotateUpdater }, { loadDestroyUpdater }, { loadLifeUpdater }, { loadPaintUpdater },] = await Promise.all([
8
+ import("@tsparticles/basic/lazy"),
9
+ import("@tsparticles/shape-line"),
10
+ import("@tsparticles/plugin-blend"),
11
+ import("@tsparticles/plugin-emitters/plugin"),
12
+ import("@tsparticles/plugin-emitters-shape-square"),
13
+ import("@tsparticles/plugin-sounds"),
14
+ import("@tsparticles/updater-rotate/lazy"),
15
+ import("@tsparticles/updater-destroy/lazy"),
16
+ import("@tsparticles/updater-life/lazy"),
17
+ import("@tsparticles/updater-paint/lazy"),
18
+ ]), loadEmittersForFireworks = async (e) => {
19
+ await loadEmittersPluginSimple(e);
20
+ await loadEmittersShapeSquare(e);
21
+ };
22
+ await Promise.all([
23
+ loadBasic(e),
24
+ loadLineShape(e),
25
+ loadBlendPlugin(e),
26
+ loadEmittersForFireworks(e),
27
+ loadSoundsPlugin(e),
28
+ loadRotateUpdater(e),
29
+ loadDestroyUpdater(e),
30
+ loadLifeUpdater(e),
31
+ loadPaintUpdater(e),
32
+ ]);
33
+ });
34
+ }
35
+ async function initPlugins(engine) {
36
+ if (initPromise) {
37
+ return initPromise;
38
+ }
39
+ initPromise = doInitPlugins(engine);
40
+ return initPromise;
41
+ }
42
+ export async function fireworks(idOrOptions, sourceOptions) {
43
+ await initPlugins(tsParticles);
44
+ let id, options;
45
+ if (isString(idOrOptions)) {
46
+ id = idOrOptions;
47
+ options = sourceOptions ?? {};
48
+ }
49
+ else {
50
+ id = "fireworks";
51
+ options = idOrOptions ?? {};
52
+ }
53
+ return getFireworksInstance(tsParticles, id, options);
54
+ }
55
+ fireworks.create = async (canvas, options) => {
56
+ await initPlugins(tsParticles);
57
+ const id = canvas?.id ?? "fireworks";
58
+ return getFireworksInstance(tsParticles, id, options ?? {}, canvas ?? undefined);
59
+ };
60
+ fireworks.init = async () => {
61
+ await initPlugins(tsParticles);
62
+ };
63
+ fireworks.version = "4.0.1";
64
+ globalThis.fireworks = fireworks;
@@ -0,0 +1 @@
1
+ export * from "./fireworks.lazy.js";
package/cjs/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};