@tsparticles/fireworks 4.0.0-beta.11 → 4.0.0-beta.15

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