@tsparticles/plugin-sounds 3.0.0-beta.0 → 3.0.0-beta.2

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 (46) hide show
  1. package/README.md +1 -1
  2. package/browser/Options/Classes/Sounds.js +3 -3
  3. package/browser/Options/Classes/SoundsEvent.js +3 -3
  4. package/browser/Options/Classes/SoundsIcons.js +1 -1
  5. package/browser/Options/Classes/SoundsMelody.js +1 -1
  6. package/browser/SoundsInstance.js +1 -1
  7. package/browser/index.js +2 -2
  8. package/browser/package.json +1 -0
  9. package/cjs/Options/Classes/Sounds.js +6 -6
  10. package/cjs/Options/Classes/SoundsEvent.js +7 -7
  11. package/cjs/Options/Classes/SoundsIcons.js +5 -5
  12. package/cjs/Options/Classes/SoundsMelody.js +2 -2
  13. package/cjs/SoundsInstance.js +2 -2
  14. package/cjs/index.js +4 -4
  15. package/cjs/package.json +1 -0
  16. package/esm/Options/Classes/Sounds.js +3 -3
  17. package/esm/Options/Classes/SoundsEvent.js +3 -3
  18. package/esm/Options/Classes/SoundsIcons.js +1 -1
  19. package/esm/Options/Classes/SoundsMelody.js +1 -1
  20. package/esm/SoundsInstance.js +1 -1
  21. package/esm/index.js +2 -2
  22. package/esm/package.json +1 -0
  23. package/package.json +18 -6
  24. package/report.html +23 -5
  25. package/tsparticles.plugin.sounds.js +1 -1
  26. package/tsparticles.plugin.sounds.min.js.LICENSE.txt +1 -1
  27. package/types/Options/Classes/Sounds.d.ts +4 -4
  28. package/types/Options/Classes/SoundsAudio.d.ts +1 -1
  29. package/types/Options/Classes/SoundsEvent.d.ts +5 -5
  30. package/types/Options/Classes/SoundsIcon.d.ts +1 -1
  31. package/types/Options/Classes/SoundsIcons.d.ts +2 -2
  32. package/types/Options/Classes/SoundsMelody.d.ts +2 -2
  33. package/types/Options/Classes/SoundsNote.d.ts +1 -1
  34. package/types/Options/Classes/SoundsVolume.d.ts +1 -1
  35. package/types/Options/Interfaces/ISounds.d.ts +3 -3
  36. package/types/Options/Interfaces/ISoundsEvent.d.ts +4 -4
  37. package/types/Options/Interfaces/ISoundsIcons.d.ts +1 -1
  38. package/types/Options/Interfaces/ISoundsMelody.d.ts +1 -1
  39. package/types/SoundsInstance.d.ts +1 -1
  40. package/types/types.d.ts +4 -4
  41. package/umd/Options/Classes/Sounds.js +7 -7
  42. package/umd/Options/Classes/SoundsEvent.js +8 -8
  43. package/umd/Options/Classes/SoundsIcons.js +6 -6
  44. package/umd/Options/Classes/SoundsMelody.js +3 -3
  45. package/umd/SoundsInstance.js +3 -3
  46. package/umd/index.js +5 -5
@@ -4,7 +4,7 @@
4
4
  * Demo / Generator : https://particles.js.org/
5
5
  * GitHub : https://www.github.com/matteobruni/tsparticles
6
6
  * How to use? : Check the GitHub README
7
- * v3.0.0-beta.0
7
+ * v3.0.0-beta.2
8
8
  */
9
9
  (function webpackUniversalModuleDefinition(root, factory) {
10
10
  if(typeof exports === 'object' && typeof module === 'object')
@@ -1 +1 @@
1
- /*! tsParticles Sounds Plugin v3.0.0-beta.0 by Matteo Bruni */
1
+ /*! tsParticles Sounds Plugin v3.0.0-beta.2 by Matteo Bruni */
@@ -1,8 +1,8 @@
1
1
  import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
- import type { ISounds } from "../Interfaces/ISounds";
3
- import { SoundsEvent } from "./SoundsEvent";
4
- import { SoundsIcons } from "./SoundsIcons";
5
- import { SoundsVolume } from "./SoundsVolume";
2
+ import type { ISounds } from "../Interfaces/ISounds.js";
3
+ import { SoundsEvent } from "./SoundsEvent.js";
4
+ import { SoundsIcons } from "./SoundsIcons.js";
5
+ import { SoundsVolume } from "./SoundsVolume.js";
6
6
  export declare class Sounds implements ISounds, IOptionLoader<ISounds> {
7
7
  enable: boolean;
8
8
  events: SoundsEvent[];
@@ -1,5 +1,5 @@
1
1
  import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
2
- import type { ISoundsAudio } from "../Interfaces/ISoundsAudio";
2
+ import type { ISoundsAudio } from "../Interfaces/ISoundsAudio.js";
3
3
  export declare class SoundsAudio implements ISoundsAudio, IOptionLoader<ISoundsAudio> {
4
4
  loop: boolean;
5
5
  source: string;
@@ -1,9 +1,9 @@
1
1
  import { type IOptionLoader, type RecursivePartial, type SingleOrMultiple } from "@tsparticles/engine";
2
- import type { FilterFunction } from "../../types";
3
- import type { ISoundsEvent } from "../Interfaces/ISoundsEvent";
4
- import { SoundsAudio } from "./SoundsAudio";
5
- import { SoundsMelody } from "./SoundsMelody";
6
- import { SoundsNote } from "./SoundsNote";
2
+ import type { FilterFunction } from "../../types.js";
3
+ import type { ISoundsEvent } from "../Interfaces/ISoundsEvent.js";
4
+ import { SoundsAudio } from "./SoundsAudio.js";
5
+ import { SoundsMelody } from "./SoundsMelody.js";
6
+ import { SoundsNote } from "./SoundsNote.js";
7
7
  declare global {
8
8
  interface Window {
9
9
  [key: string]: unknown;
@@ -1,5 +1,5 @@
1
1
  import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
- import type { ISoundsIcon } from "../Interfaces/ISoundsIcon";
2
+ import type { ISoundsIcon } from "../Interfaces/ISoundsIcon.js";
3
3
  export declare class SoundsIcon implements ISoundsIcon, IOptionLoader<ISoundsIcon> {
4
4
  height: number;
5
5
  path?: string;
@@ -1,6 +1,6 @@
1
1
  import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
- import type { ISoundsIcons } from "../Interfaces/ISoundsIcons";
3
- import { SoundsIcon } from "./SoundsIcon";
2
+ import type { ISoundsIcons } from "../Interfaces/ISoundsIcons.js";
3
+ import { SoundsIcon } from "./SoundsIcon.js";
4
4
  export declare class SoundsIcons implements ISoundsIcons, IOptionLoader<ISoundsIcons> {
5
5
  mute: SoundsIcon;
6
6
  unmute: SoundsIcon;
@@ -1,6 +1,6 @@
1
1
  import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
2
- import type { ISoundsMelody } from "../Interfaces/ISoundsMelody";
3
- import { SoundsNote } from "./SoundsNote";
2
+ import type { ISoundsMelody } from "../Interfaces/ISoundsMelody.js";
3
+ import { SoundsNote } from "./SoundsNote.js";
4
4
  export declare class SoundsMelody implements ISoundsMelody, IOptionLoader<ISoundsMelody> {
5
5
  loop: boolean;
6
6
  melodies: SoundsMelody[];
@@ -1,5 +1,5 @@
1
1
  import type { IOptionLoader, RecursivePartial, SingleOrMultiple } from "@tsparticles/engine";
2
- import type { ISoundsNote } from "../Interfaces/ISoundsNote";
2
+ import type { ISoundsNote } from "../Interfaces/ISoundsNote.js";
3
3
  export declare class SoundsNote implements ISoundsNote, IOptionLoader<ISoundsNote> {
4
4
  duration: number;
5
5
  value: SingleOrMultiple<string>;
@@ -1,5 +1,5 @@
1
1
  import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
2
- import type { ISoundsVolume } from "../Interfaces/ISoundsVolume";
2
+ import type { ISoundsVolume } from "../Interfaces/ISoundsVolume.js";
3
3
  export declare class SoundsVolume implements ISoundsVolume, IOptionLoader<ISoundsVolume> {
4
4
  max: number;
5
5
  min: number;
@@ -1,6 +1,6 @@
1
- import type { ISoundsEvent } from "./ISoundsEvent";
2
- import type { ISoundsIcons } from "./ISoundsIcons";
3
- import type { ISoundsVolume } from "./ISoundsVolume";
1
+ import type { ISoundsEvent } from "./ISoundsEvent.js";
2
+ import type { ISoundsIcons } from "./ISoundsIcons.js";
3
+ import type { ISoundsVolume } from "./ISoundsVolume.js";
4
4
  export interface ISounds {
5
5
  enable: boolean;
6
6
  events: ISoundsEvent[];
@@ -1,7 +1,7 @@
1
- import type { FilterFunction } from "../../types";
2
- import type { ISoundsAudio } from "./ISoundsAudio";
3
- import type { ISoundsMelody } from "./ISoundsMelody";
4
- import type { ISoundsNote } from "./ISoundsNote";
1
+ import type { FilterFunction } from "../../types.js";
2
+ import type { ISoundsAudio } from "./ISoundsAudio.js";
3
+ import type { ISoundsMelody } from "./ISoundsMelody.js";
4
+ import type { ISoundsNote } from "./ISoundsNote.js";
5
5
  import type { SingleOrMultiple } from "@tsparticles/engine";
6
6
  export interface ISoundsEvent {
7
7
  audio?: SingleOrMultiple<ISoundsAudio | string>;
@@ -1,4 +1,4 @@
1
- import type { ISoundsIcon } from "./ISoundsIcon";
1
+ import type { ISoundsIcon } from "./ISoundsIcon.js";
2
2
  export interface ISoundsIcons {
3
3
  mute: ISoundsIcon;
4
4
  unmute: ISoundsIcon;
@@ -1,4 +1,4 @@
1
- import type { ISoundsNote } from "./ISoundsNote";
1
+ import type { ISoundsNote } from "./ISoundsNote.js";
2
2
  export interface ISoundsMelody {
3
3
  loop: boolean;
4
4
  melodies: ISoundsMelody[];
@@ -1,5 +1,5 @@
1
1
  import { type Engine, type IContainerPlugin } from "@tsparticles/engine";
2
- import type { SoundsContainer } from "./types";
2
+ import type { SoundsContainer } from "./types.js";
3
3
  export declare class SoundsInstance implements IContainerPlugin {
4
4
  private _audioMap;
5
5
  private _audioSources;
package/types/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { Container, CustomEventArgs, IOptions, Options } from "@tsparticles/engine";
2
- import type { ISounds } from "./Options/Interfaces/ISounds";
3
- import type { ImageDisplay } from "./enums";
4
- import type { Sounds } from "./Options/Classes/Sounds";
5
- import type { SoundsIcon } from "./Options/Classes/SoundsIcon";
2
+ import type { ISounds } from "./Options/Interfaces/ISounds.js";
3
+ import type { ImageDisplay } from "./enums.js";
4
+ import type { Sounds } from "./Options/Classes/Sounds.js";
5
+ import type { SoundsIcon } from "./Options/Classes/SoundsIcon.js";
6
6
  export type FilterFunction = (args: CustomEventArgs) => boolean;
7
7
  export type ISoundsOptions = IOptions & {
8
8
  sounds?: ISounds;
@@ -4,21 +4,21 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./SoundsEvent", "./SoundsIcons", "./SoundsVolume"], factory);
7
+ define(["require", "exports", "./SoundsEvent.js", "./SoundsIcons.js", "./SoundsVolume.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Sounds = void 0;
13
- const SoundsEvent_1 = require("./SoundsEvent");
14
- const SoundsIcons_1 = require("./SoundsIcons");
15
- const SoundsVolume_1 = require("./SoundsVolume");
13
+ const SoundsEvent_js_1 = require("./SoundsEvent.js");
14
+ const SoundsIcons_js_1 = require("./SoundsIcons.js");
15
+ const SoundsVolume_js_1 = require("./SoundsVolume.js");
16
16
  class Sounds {
17
17
  constructor() {
18
18
  this.enable = false;
19
19
  this.events = [];
20
- this.icons = new SoundsIcons_1.SoundsIcons();
21
- this.volume = new SoundsVolume_1.SoundsVolume();
20
+ this.icons = new SoundsIcons_js_1.SoundsIcons();
21
+ this.volume = new SoundsVolume_js_1.SoundsVolume();
22
22
  }
23
23
  load(data) {
24
24
  if (!data) {
@@ -29,7 +29,7 @@
29
29
  }
30
30
  if (data.events !== undefined) {
31
31
  this.events = data.events.map((t) => {
32
- const event = new SoundsEvent_1.SoundsEvent();
32
+ const event = new SoundsEvent_js_1.SoundsEvent();
33
33
  event.load(t);
34
34
  return event;
35
35
  });
@@ -4,16 +4,16 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./SoundsAudio", "./SoundsMelody", "./SoundsNote"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./SoundsAudio.js", "./SoundsMelody.js", "./SoundsNote.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SoundsEvent = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
- const SoundsAudio_1 = require("./SoundsAudio");
15
- const SoundsMelody_1 = require("./SoundsMelody");
16
- const SoundsNote_1 = require("./SoundsNote");
14
+ const SoundsAudio_js_1 = require("./SoundsAudio.js");
15
+ const SoundsMelody_js_1 = require("./SoundsMelody.js");
16
+ const SoundsNote_js_1 = require("./SoundsNote.js");
17
17
  class SoundsEvent {
18
18
  constructor() {
19
19
  this.event = [];
@@ -29,26 +29,26 @@
29
29
  if (data.audio !== undefined) {
30
30
  if ((0, engine_1.isArray)(data.audio)) {
31
31
  this.audio = data.audio.map((s) => {
32
- const tmp = new SoundsAudio_1.SoundsAudio();
32
+ const tmp = new SoundsAudio_js_1.SoundsAudio();
33
33
  tmp.load(s);
34
34
  return tmp;
35
35
  });
36
36
  }
37
37
  else {
38
- this.audio = new SoundsAudio_1.SoundsAudio();
38
+ this.audio = new SoundsAudio_js_1.SoundsAudio();
39
39
  this.audio.load(data.audio);
40
40
  }
41
41
  }
42
42
  if (data.notes !== undefined) {
43
43
  this.notes = data.notes.map((t) => {
44
- const tmp = new SoundsNote_1.SoundsNote();
44
+ const tmp = new SoundsNote_js_1.SoundsNote();
45
45
  tmp.load(t);
46
46
  return tmp;
47
47
  });
48
48
  }
49
49
  if (data.melodies !== undefined) {
50
50
  this.melodies = data.melodies.map((t) => {
51
- const tmp = new SoundsMelody_1.SoundsMelody();
51
+ const tmp = new SoundsMelody_js_1.SoundsMelody();
52
52
  tmp.load(t);
53
53
  return tmp;
54
54
  });
@@ -4,19 +4,19 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./SoundsIcon"], factory);
7
+ define(["require", "exports", "./SoundsIcon.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SoundsIcons = void 0;
13
- const SoundsIcon_1 = require("./SoundsIcon");
13
+ const SoundsIcon_js_1 = require("./SoundsIcon.js");
14
14
  class SoundsIcons {
15
15
  constructor() {
16
- this.mute = new SoundsIcon_1.SoundsIcon();
17
- this.unmute = new SoundsIcon_1.SoundsIcon();
18
- this.volumeDown = new SoundsIcon_1.SoundsIcon();
19
- this.volumeUp = new SoundsIcon_1.SoundsIcon();
16
+ this.mute = new SoundsIcon_js_1.SoundsIcon();
17
+ this.unmute = new SoundsIcon_js_1.SoundsIcon();
18
+ this.volumeDown = new SoundsIcon_js_1.SoundsIcon();
19
+ this.volumeUp = new SoundsIcon_js_1.SoundsIcon();
20
20
  this.mute.svg = `<?xml version="1.0"?>
21
21
  <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
22
22
  xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
@@ -4,13 +4,13 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./SoundsNote"], factory);
7
+ define(["require", "exports", "./SoundsNote.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SoundsMelody = void 0;
13
- const SoundsNote_1 = require("./SoundsNote");
13
+ const SoundsNote_js_1 = require("./SoundsNote.js");
14
14
  class SoundsMelody {
15
15
  constructor() {
16
16
  this.loop = false;
@@ -33,7 +33,7 @@
33
33
  }
34
34
  if (data.notes !== undefined) {
35
35
  this.notes = data.notes.map((s) => {
36
- const tmp = new SoundsNote_1.SoundsNote();
36
+ const tmp = new SoundsNote_js_1.SoundsNote();
37
37
  tmp.load(s);
38
38
  return tmp;
39
39
  });
@@ -4,14 +4,14 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./utils"], factory);
7
+ define(["require", "exports", "@tsparticles/engine", "./utils.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SoundsInstance = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
- const utils_1 = require("./utils");
14
+ const utils_js_1 = require("./utils.js");
15
15
  function initImage(data) {
16
16
  const img = document.createElement("img"), { clickCb, container, display, iconOptions, margin, options, pos, rightOffsets } = data, { width, path, svg } = iconOptions;
17
17
  setIconStyle(img, pos.top + margin, pos.right - (margin * (rightOffsets.length + 1) + width + rightOffsets.reduce((a, b) => a + b, 0)), display, options.fullScreen.zIndex + 1, width, margin);
@@ -183,7 +183,7 @@
183
183
  }
184
184
  const value = (0, engine_1.itemFromSingleOrMultiple)(note.value, valueIdx, true);
185
185
  try {
186
- const freq = (0, utils_1.getNoteFrequency)(value);
186
+ const freq = (0, utils_js_1.getNoteFrequency)(value);
187
187
  if (!(0, engine_1.isNumber)(freq)) {
188
188
  return;
189
189
  }
package/umd/index.js CHANGED
@@ -4,21 +4,21 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Options/Classes/Sounds", "./SoundsInstance"], factory);
7
+ define(["require", "exports", "./Options/Classes/Sounds.js", "./SoundsInstance.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.loadSoundsPlugin = void 0;
13
- const Sounds_1 = require("./Options/Classes/Sounds");
14
- const SoundsInstance_1 = require("./SoundsInstance");
13
+ const Sounds_js_1 = require("./Options/Classes/Sounds.js");
14
+ const SoundsInstance_js_1 = require("./SoundsInstance.js");
15
15
  class SoundsPlugin {
16
16
  constructor(engine) {
17
17
  this.id = "sounds";
18
18
  this._engine = engine;
19
19
  }
20
20
  getPlugin(container) {
21
- return new SoundsInstance_1.SoundsInstance(container, this._engine);
21
+ return new SoundsInstance_js_1.SoundsInstance(container, this._engine);
22
22
  }
23
23
  loadOptions(options, source) {
24
24
  if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
@@ -26,7 +26,7 @@
26
26
  }
27
27
  let soundsOptions = options.sounds;
28
28
  if (soundsOptions?.load === undefined) {
29
- options.sounds = soundsOptions = new Sounds_1.Sounds();
29
+ options.sounds = soundsOptions = new Sounds_js_1.Sounds();
30
30
  }
31
31
  soundsOptions.load(source?.sounds);
32
32
  }