Skip to content

Commit f61a590

Browse files
committed
refactor: convert register function to async and made pjs bundle independent
1 parent 82366ab commit f61a590

129 files changed

Lines changed: 6267 additions & 7987 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/all/package.dist.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
"@tsparticles/path-simplex-noise": "4.0.0-alpha.4",
116116
"@tsparticles/path-svg": "4.0.0-alpha.4",
117117
"@tsparticles/path-zig-zag": "4.0.0-alpha.4",
118-
"@tsparticles/pjs": "4.0.0-alpha.4",
119118
"@tsparticles/plugin-background-mask": "4.0.0-alpha.4",
120119
"@tsparticles/plugin-canvas-mask": "4.0.0-alpha.4",
121120
"@tsparticles/plugin-easing-back": "4.0.0-alpha.4",

bundles/all/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
"@tsparticles/path-simplex-noise": "workspace:4.0.0-alpha.4",
124124
"@tsparticles/path-svg": "workspace:4.0.0-alpha.4",
125125
"@tsparticles/path-zig-zag": "workspace:4.0.0-alpha.4",
126-
"@tsparticles/pjs": "workspace:4.0.0-alpha.4",
127126
"@tsparticles/plugin-background-mask": "workspace:4.0.0-alpha.4",
128127
"@tsparticles/plugin-canvas-mask": "workspace:4.0.0-alpha.4",
129128
"@tsparticles/plugin-easing-back": "workspace:4.0.0-alpha.4",

bundles/all/src/index.ts

Lines changed: 74 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ declare const __VERSION__: string;
1010
* This function is called automatically using CDN bundle files.
1111
* @param engine - the engine to use for loading all plugins
1212
*/
13-
export function loadAll(engine: Engine): void {
13+
export async function loadAll(engine: Engine): Promise<void> {
1414
engine.checkVersion(__VERSION__);
1515

16-
engine.register(async e => {
17-
const { initPjs } = await import("@tsparticles/pjs"),
18-
{ loadFull } = await import("tsparticles"),
16+
await engine.register(async e => {
17+
const { loadFull } = await import("tsparticles"),
1918
{ loadHsvColorPlugin } = await import("@tsparticles/plugin-hsv-color"),
2019
{ loadHwbColorPlugin } = await import("@tsparticles/plugin-hwb-color"),
2120
{ loadLabColorPlugin } = await import("@tsparticles/plugin-lab-color"),
@@ -75,78 +74,76 @@ export function loadAll(engine: Engine): void {
7574
{ loadEmittersShapePath } = await import("@tsparticles/plugin-emitters-shape-path"),
7675
{ loadEmittersShapePolygon } = await import("@tsparticles/plugin-emitters-shape-polygon");
7776

78-
initPjs(e);
79-
80-
loadFull(e);
81-
82-
loadEmittersShapeCanvas(e);
83-
loadEmittersShapePath(e);
84-
loadEmittersShapePolygon(e);
85-
86-
loadHsvColorPlugin(e);
87-
loadHwbColorPlugin(e);
88-
loadLabColorPlugin(e);
89-
loadLchColorPlugin(e);
90-
loadOklabColorPlugin(e);
91-
loadOklchColorPlugin(e);
92-
loadNamedColorPlugin(e);
93-
94-
loadEasingBackPlugin(e);
95-
loadEasingCircPlugin(e);
96-
loadEasingCubicPlugin(e);
97-
loadEasingExpoPlugin(e);
98-
loadEasingLinearPlugin(e);
99-
loadEasingQuartPlugin(e);
100-
loadEasingQuintPlugin(e);
101-
loadEasingSinePlugin(e);
102-
103-
loadBackgroundMaskPlugin(e);
104-
loadCanvasMaskPlugin(e);
105-
loadInfectionPlugin(e);
106-
loadManualParticlesPlugin(e);
107-
loadMotionPlugin(e);
108-
loadPoissonDiscPlugin(e);
109-
loadPolygonMaskPlugin(e);
110-
loadResponsivePlugin(e);
111-
loadSoundsPlugin(e);
112-
loadThemesPlugin(e);
113-
loadTrailPlugin(e);
114-
115-
loadExportImagePlugin(e);
116-
loadExportJSONPlugin(e);
117-
loadExportVideoPlugin(e);
118-
119-
loadExternalParticleInteraction(e);
120-
loadExternalPopInteraction(e);
121-
122-
loadLightInteraction(e);
123-
124-
loadParticlesRepulseInteraction(e);
125-
126-
loadGradientUpdater(e);
127-
loadOrbitUpdater(e);
128-
129-
loadCurlNoisePath(e);
130-
loadCurvesPath(e);
131-
loadFractalNoisePath(e);
132-
loadPerlinNoisePath(e);
133-
loadPolygonPath(e);
134-
loadSVGPath(e);
135-
loadZigZagPath(e);
136-
loadSimplexNoisePath(e);
137-
138-
loadBubbleEffect(e);
139-
loadShadowEffect(e);
140-
loadTrailEffect(e);
141-
142-
loadArrowShape(e);
143-
loadCardsShape(e);
144-
loadCogShape(e);
145-
loadHeartShape(e);
146-
loadInfinityShape(e);
147-
loadPathShape(e);
148-
loadRoundedPolygonShape(e);
149-
loadRoundedRectShape(e);
150-
loadSpiralShape(e);
77+
await loadFull(e);
78+
79+
await loadEmittersShapeCanvas(e);
80+
await loadEmittersShapePath(e);
81+
await loadEmittersShapePolygon(e);
82+
83+
await loadHsvColorPlugin(e);
84+
await loadHwbColorPlugin(e);
85+
await loadLabColorPlugin(e);
86+
await loadLchColorPlugin(e);
87+
await loadOklabColorPlugin(e);
88+
await loadOklchColorPlugin(e);
89+
await loadNamedColorPlugin(e);
90+
91+
await loadEasingBackPlugin(e);
92+
await loadEasingCircPlugin(e);
93+
await loadEasingCubicPlugin(e);
94+
await loadEasingExpoPlugin(e);
95+
await loadEasingLinearPlugin(e);
96+
await loadEasingQuartPlugin(e);
97+
await loadEasingQuintPlugin(e);
98+
await loadEasingSinePlugin(e);
99+
100+
await loadBackgroundMaskPlugin(e);
101+
await loadCanvasMaskPlugin(e);
102+
await loadInfectionPlugin(e);
103+
await loadManualParticlesPlugin(e);
104+
await loadMotionPlugin(e);
105+
await loadPoissonDiscPlugin(e);
106+
await loadPolygonMaskPlugin(e);
107+
await loadResponsivePlugin(e);
108+
await loadSoundsPlugin(e);
109+
await loadThemesPlugin(e);
110+
await loadTrailPlugin(e);
111+
112+
await loadExportImagePlugin(e);
113+
await loadExportJSONPlugin(e);
114+
await loadExportVideoPlugin(e);
115+
116+
await loadExternalParticleInteraction(e);
117+
await loadExternalPopInteraction(e);
118+
119+
await loadLightInteraction(e);
120+
121+
await loadParticlesRepulseInteraction(e);
122+
123+
await loadGradientUpdater(e);
124+
await loadOrbitUpdater(e);
125+
126+
await loadCurlNoisePath(e);
127+
await loadCurvesPath(e);
128+
await loadFractalNoisePath(e);
129+
await loadPerlinNoisePath(e);
130+
await loadPolygonPath(e);
131+
await loadSVGPath(e);
132+
await loadZigZagPath(e);
133+
await loadSimplexNoisePath(e);
134+
135+
await loadBubbleEffect(e);
136+
await loadShadowEffect(e);
137+
await loadTrailEffect(e);
138+
139+
await loadArrowShape(e);
140+
await loadCardsShape(e);
141+
await loadCogShape(e);
142+
await loadHeartShape(e);
143+
await loadInfinityShape(e);
144+
await loadPathShape(e);
145+
await loadRoundedPolygonShape(e);
146+
await loadRoundedRectShape(e);
147+
await loadSpiralShape(e);
151148
});
152149
}

bundles/basic/src/index.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ declare const __VERSION__: string;
1010
* This function is called automatically using CDN bundle files.
1111
* @param engine - the engine to use for loading all plugins
1212
*/
13-
export function loadBasic(engine: Engine): void {
13+
export async function loadBasic(engine: Engine): Promise<void> {
1414
engine.checkVersion(__VERSION__);
1515

16-
engine.register(async e => {
16+
await engine.register(async e => {
1717
const { loadHexColorPlugin } = await import("@tsparticles/plugin-hex-color"),
1818
{ loadHslColorPlugin } = await import("@tsparticles/plugin-hsl-color"),
1919
{ loadRgbColorPlugin } = await import("@tsparticles/plugin-rgb-color"),
@@ -24,17 +24,17 @@ export function loadBasic(engine: Engine): void {
2424
{ loadOutModesUpdater } = await import("@tsparticles/updater-out-modes"),
2525
{ loadSizeUpdater } = await import("@tsparticles/updater-size");
2626

27-
loadHexColorPlugin(e);
28-
loadHslColorPlugin(e);
29-
loadRgbColorPlugin(e);
27+
await loadHexColorPlugin(e);
28+
await loadHslColorPlugin(e);
29+
await loadRgbColorPlugin(e);
3030

31-
loadBaseMover(e);
31+
await loadBaseMover(e);
3232

33-
loadCircleShape(e);
33+
await loadCircleShape(e);
3434

35-
loadColorUpdater(e);
36-
loadOpacityUpdater(e);
37-
loadOutModesUpdater(e);
38-
loadSizeUpdater(e);
35+
await loadColorUpdater(e);
36+
await loadOpacityUpdater(e);
37+
await loadOutModesUpdater(e);
38+
await loadSizeUpdater(e);
3939
});
4040
}

bundles/confetti/src/confetti.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async function initPlugins(engine: Engine): Promise<void> {
9999

100100
engine.checkVersion(__VERSION__);
101101

102-
engine.register(async e => {
102+
await engine.register(async e => {
103103
const { loadEmittersPlugin } = await import("@tsparticles/plugin-emitters"),
104104
{ loadMotionPlugin } = await import("@tsparticles/plugin-motion"),
105105
{ loadCardsShape } = await import("@tsparticles/shape-cards"),
@@ -116,21 +116,21 @@ async function initPlugins(engine: Engine): Promise<void> {
116116
{ loadWobbleUpdater } = await import("@tsparticles/updater-wobble"),
117117
{ loadBasic } = await import("@tsparticles/basic");
118118

119-
loadEmittersPlugin(e);
120-
loadMotionPlugin(e);
121-
loadCardsShape(e);
122-
loadHeartShape(e);
123-
loadImageShape(e);
124-
loadPolygonShape(e);
125-
loadSquareShape(e);
126-
loadStarShape(e);
127-
loadEmojiShape(e);
128-
loadRotateUpdater(e);
129-
loadLifeUpdater(e);
130-
loadRollUpdater(e);
131-
loadTiltUpdater(e);
132-
loadWobbleUpdater(e);
133-
loadBasic(e);
119+
await loadEmittersPlugin(e);
120+
await loadMotionPlugin(e);
121+
await loadCardsShape(e);
122+
await loadHeartShape(e);
123+
await loadImageShape(e);
124+
await loadPolygonShape(e);
125+
await loadSquareShape(e);
126+
await loadStarShape(e);
127+
await loadEmojiShape(e);
128+
await loadRotateUpdater(e);
129+
await loadLifeUpdater(e);
130+
await loadRollUpdater(e);
131+
await loadTiltUpdater(e);
132+
await loadWobbleUpdater(e);
133+
await loadBasic(e);
134134
});
135135

136136
initializing = false;

bundles/fireworks/src/fireworks.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async function initPlugins(engine: Engine): Promise<void> {
9797

9898
engine.checkVersion(__VERSION__);
9999

100-
engine.register(async e => {
100+
await engine.register(async e => {
101101
const { loadEmittersPlugin } = await import("@tsparticles/plugin-emitters"),
102102
{ loadSoundsPlugin } = await import("@tsparticles/plugin-sounds"),
103103
{ loadRotateUpdater } = await import("@tsparticles/updater-rotate"),
@@ -107,14 +107,14 @@ async function initPlugins(engine: Engine): Promise<void> {
107107
{ loadBasic } = await import("@tsparticles/basic"),
108108
{ loadEmittersShapeSquare } = await import("@tsparticles/plugin-emitters-shape-square");
109109

110-
loadEmittersPlugin(e);
111-
loadEmittersShapeSquare(e);
112-
loadSoundsPlugin(e);
113-
loadRotateUpdater(e);
114-
loadDestroyUpdater(e);
115-
loadLifeUpdater(e);
116-
loadTrailEffect(e);
117-
loadBasic(e);
110+
await loadEmittersPlugin(e);
111+
await loadEmittersShapeSquare(e);
112+
await loadSoundsPlugin(e);
113+
await loadRotateUpdater(e);
114+
await loadDestroyUpdater(e);
115+
await loadLifeUpdater(e);
116+
await loadTrailEffect(e);
117+
await loadBasic(e);
118118
});
119119

120120
initializing = false;

bundles/full/src/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ declare const __VERSION__: string;
1010
* This function is called automatically using CDN bundle files.
1111
* @param engine - the engine to use for loading all plugins
1212
*/
13-
export function loadFull(engine: Engine): void {
13+
export async function loadFull(engine: Engine): Promise<void> {
1414
engine.checkVersion(__VERSION__);
1515

16-
engine.register(async e => {
16+
await engine.register(async e => {
1717
const { loadDestroyUpdater } = await import("@tsparticles/updater-destroy"),
1818
{ loadRollUpdater } = await import("@tsparticles/updater-roll"),
1919
{ loadTiltUpdater } = await import("@tsparticles/updater-tilt"),
@@ -27,22 +27,22 @@ export function loadFull(engine: Engine): void {
2727
{ loadEmittersShapeSquare } = await import("@tsparticles/plugin-emitters-shape-square"),
2828
{ loadSlim } = await import("@tsparticles/slim");
2929

30-
loadSlim(e);
30+
await loadSlim(e);
3131

32-
loadDestroyUpdater(e);
33-
loadRollUpdater(e);
34-
loadTiltUpdater(e);
35-
loadTwinkleUpdater(e);
36-
loadWobbleUpdater(e);
32+
await loadDestroyUpdater(e);
33+
await loadRollUpdater(e);
34+
await loadTiltUpdater(e);
35+
await loadTwinkleUpdater(e);
36+
await loadWobbleUpdater(e);
3737

38-
loadTextShape(e);
38+
await loadTextShape(e);
3939

40-
loadExternalTrailInteraction(e);
40+
await loadExternalTrailInteraction(e);
4141

42-
loadAbsorbersPlugin(e);
43-
loadEmittersPlugin(e);
42+
await loadAbsorbersPlugin(e);
43+
await loadEmittersPlugin(e);
4444

45-
loadEmittersShapeCircle(e);
46-
loadEmittersShapeSquare(e);
45+
await loadEmittersShapeCircle(e);
46+
await loadEmittersShapeSquare(e);
4747
});
4848
}

0 commit comments

Comments
 (0)