diff --git a/bundles/full/src/FullV1Plugin.ts b/bundles/full/src/FullV1Plugin.ts new file mode 100644 index 00000000000..abf9a3358f8 --- /dev/null +++ b/bundles/full/src/FullV1Plugin.ts @@ -0,0 +1,22 @@ +import type { IContainerPlugin, IPlugin, Options } from "tsparticles-engine"; +import { fixOptions } from "./fixOptions"; + +export class FullV1Plugin implements IPlugin { + readonly id: string; + + constructor() { + this.id = "tsparticles-v1-plugin"; + } + + needsPlugin(): boolean { + return true; + } + + getPlugin(): IContainerPlugin { + return {}; + } + + loadOptions(options: Options): void { + fixOptions(options); + } +} diff --git a/bundles/full/src/fixOptions.ts b/bundles/full/src/fixOptions.ts new file mode 100644 index 00000000000..cfcb91b7ce8 --- /dev/null +++ b/bundles/full/src/fixOptions.ts @@ -0,0 +1,7 @@ +import type { + ISourceOptions +} from "tsparticles-engine"; + +export const fixOptions = (options: ISourceOptions): ISourceOptions => { + return options; +} diff --git a/bundles/full/src/index.ts b/bundles/full/src/index.ts index 000bc1d74bf..d42989f77f2 100644 --- a/bundles/full/src/index.ts +++ b/bundles/full/src/index.ts @@ -1,4 +1,5 @@ import type { Engine } from "tsparticles-engine"; +import { FullV1Plugin } from "./FullV1Plugin"; import { loadAbsorbersPlugin } from "tsparticles-plugin-absorbers"; import { loadEmittersPlugin } from "tsparticles-plugin-emitters"; import { loadExternalTrailInteraction } from "tsparticles-interaction-external-trail"; @@ -9,6 +10,8 @@ import { loadTiltUpdater } from "tsparticles-updater-tilt"; import { loadWobbleUpdater } from "tsparticles-updater-wobble"; export async function loadFull(engine: Engine): Promise { + await engine.addPlugin(new FullV1Plugin()); + await loadSlim(engine); await loadTiltUpdater(engine); diff --git a/bundles/pjs/src/particlesJSPlugin.ts b/bundles/pjs/src/ParticlesJSPlugin.ts similarity index 100% rename from bundles/pjs/src/particlesJSPlugin.ts rename to bundles/pjs/src/ParticlesJSPlugin.ts diff --git a/bundles/pjs/src/fixOptions.ts b/bundles/pjs/src/fixOptions.ts index 169a4f2fda6..c6047d96b9f 100644 --- a/bundles/pjs/src/fixOptions.ts +++ b/bundles/pjs/src/fixOptions.ts @@ -14,7 +14,7 @@ import type { import { deepExtend, setRangeValue } from "tsparticles-engine"; import type { IParticlesJSOptions } from "./IParticlesJSOptions"; -const fixOptions = (options: RecursivePartial): ISourceOptions => { +export const fixOptions = (options: RecursivePartial): ISourceOptions => { if (options.retina_detect !== undefined) { options.detectRetina = options.retina_detect; } @@ -170,5 +170,3 @@ const fixOptions = (options: RecursivePartial): ISourceOpti return options; }; - -export { fixOptions }; diff --git a/bundles/pjs/src/index.ts b/bundles/pjs/src/index.ts index c63c067b745..f7a8fd99a56 100644 --- a/bundles/pjs/src/index.ts +++ b/bundles/pjs/src/index.ts @@ -5,7 +5,7 @@ import type { Container, Engine, Particle, RecursivePartial } from "tsparticles-engine"; import type { IParticlesJS } from "./IParticlesJS"; import type { IParticlesJSOptions } from "./IParticlesJSOptions"; -import { ParticlesJSPlugin } from "./particlesJSPlugin"; +import { ParticlesJSPlugin } from "./ParticlesJSPlugin"; const initPjs = (engine: Engine): { particlesJS: IParticlesJS; pJSDom: Container[] } => { engine.addPlugin(new ParticlesJSPlugin()); diff --git a/bundles/slim/src/SlimV1Plugin.ts b/bundles/slim/src/SlimV1Plugin.ts new file mode 100644 index 00000000000..57e7c4b4d08 --- /dev/null +++ b/bundles/slim/src/SlimV1Plugin.ts @@ -0,0 +1,22 @@ +import type { IContainerPlugin, IPlugin, Options } from "tsparticles-engine"; +import { fixOptions } from "./fixOptions"; + +export class SlimV1Plugin implements IPlugin { + readonly id: string; + + constructor() { + this.id = "slim-v1-plugin"; + } + + needsPlugin(): boolean { + return true; + } + + getPlugin(): IContainerPlugin { + return {}; + } + + loadOptions(options: Options): void { + fixOptions(options); + } +} diff --git a/bundles/slim/src/fixOptions.ts b/bundles/slim/src/fixOptions.ts new file mode 100644 index 00000000000..cfcb91b7ce8 --- /dev/null +++ b/bundles/slim/src/fixOptions.ts @@ -0,0 +1,7 @@ +import type { + ISourceOptions +} from "tsparticles-engine"; + +export const fixOptions = (options: ISourceOptions): ISourceOptions => { + return options; +} diff --git a/bundles/slim/src/index.ts b/bundles/slim/src/index.ts index ce1db58cb5e..28695885ff1 100644 --- a/bundles/slim/src/index.ts +++ b/bundles/slim/src/index.ts @@ -1,4 +1,5 @@ import type { Engine } from "tsparticles-engine"; +import { SlimV1Plugin } from "./SlimV1Plugin"; import { loadAngleUpdater } from "tsparticles-updater-angle"; import { loadBaseMover } from "tsparticles-move-base"; import { loadCircleShape } from "tsparticles-shape-circle"; @@ -29,6 +30,8 @@ import { loadStrokeColorUpdater } from "tsparticles-updater-stroke-color"; import { loadTextShape } from "tsparticles-shape-text"; export async function loadSlim(engine: Engine): Promise { + await engine.addPlugin(new SlimV1Plugin()); + await loadBaseMover(engine); await loadParallaxMover(engine);