@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
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![npmjs](https://badge.fury.io/js/@tsparticles/plugin-sounds.svg)](https://www.npmjs.com/package/@tsparticles/plugin-sounds)
7
7
  [![npmjs](https://img.shields.io/npm/dt/@tsparticles/plugin-sounds)](https://www.npmjs.com/package/@tsparticles/plugin-sounds) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
8
 
9
- [tsParticles](https://github.com/matteobruni/tsparticles) plugin for particles sounds effect.
9
+ [tsParticles](https://github.com/tsparticles/tsparticles) plugin for particles sounds effect.
10
10
 
11
11
  ## How to use it
12
12
 
@@ -1,6 +1,6 @@
1
- import { SoundsEvent } from "./SoundsEvent";
2
- import { SoundsIcons } from "./SoundsIcons";
3
- import { SoundsVolume } from "./SoundsVolume";
1
+ import { SoundsEvent } from "./SoundsEvent.js";
2
+ import { SoundsIcons } from "./SoundsIcons.js";
3
+ import { SoundsVolume } from "./SoundsVolume.js";
4
4
  export class Sounds {
5
5
  constructor() {
6
6
  this.enable = false;
@@ -1,7 +1,7 @@
1
1
  import { isArray, isFunction, isString, } from "@tsparticles/engine";
2
- import { SoundsAudio } from "./SoundsAudio";
3
- import { SoundsMelody } from "./SoundsMelody";
4
- import { SoundsNote } from "./SoundsNote";
2
+ import { SoundsAudio } from "./SoundsAudio.js";
3
+ import { SoundsMelody } from "./SoundsMelody.js";
4
+ import { SoundsNote } from "./SoundsNote.js";
5
5
  export class SoundsEvent {
6
6
  constructor() {
7
7
  this.event = [];
@@ -1,4 +1,4 @@
1
- import { SoundsIcon } from "./SoundsIcon";
1
+ import { SoundsIcon } from "./SoundsIcon.js";
2
2
  export class SoundsIcons {
3
3
  constructor() {
4
4
  this.mute = new SoundsIcon();
@@ -1,4 +1,4 @@
1
- import { SoundsNote } from "./SoundsNote";
1
+ import { SoundsNote } from "./SoundsNote.js";
2
2
  export class SoundsMelody {
3
3
  constructor() {
4
4
  this.loop = false;
@@ -1,5 +1,5 @@
1
1
  import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
- import { getNoteFrequency } from "./utils";
2
+ import { getNoteFrequency } from "./utils.js";
3
3
  function initImage(data) {
4
4
  const img = document.createElement("img"), { clickCb, container, display, iconOptions, margin, options, pos, rightOffsets } = data, { width, path, svg } = iconOptions;
5
5
  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);
package/browser/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Sounds } from "./Options/Classes/Sounds";
2
- import { SoundsInstance } from "./SoundsInstance";
1
+ import { Sounds } from "./Options/Classes/Sounds.js";
2
+ import { SoundsInstance } from "./SoundsInstance.js";
3
3
  class SoundsPlugin {
4
4
  constructor(engine) {
5
5
  this.id = "sounds";
@@ -0,0 +1 @@
1
+ { "type": "module" }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Sounds = void 0;
4
- const SoundsEvent_1 = require("./SoundsEvent");
5
- const SoundsIcons_1 = require("./SoundsIcons");
6
- const SoundsVolume_1 = require("./SoundsVolume");
4
+ const SoundsEvent_js_1 = require("./SoundsEvent.js");
5
+ const SoundsIcons_js_1 = require("./SoundsIcons.js");
6
+ const SoundsVolume_js_1 = require("./SoundsVolume.js");
7
7
  class Sounds {
8
8
  constructor() {
9
9
  this.enable = false;
10
10
  this.events = [];
11
- this.icons = new SoundsIcons_1.SoundsIcons();
12
- this.volume = new SoundsVolume_1.SoundsVolume();
11
+ this.icons = new SoundsIcons_js_1.SoundsIcons();
12
+ this.volume = new SoundsVolume_js_1.SoundsVolume();
13
13
  }
14
14
  load(data) {
15
15
  if (!data) {
@@ -20,7 +20,7 @@ class Sounds {
20
20
  }
21
21
  if (data.events !== undefined) {
22
22
  this.events = data.events.map((t) => {
23
- const event = new SoundsEvent_1.SoundsEvent();
23
+ const event = new SoundsEvent_js_1.SoundsEvent();
24
24
  event.load(t);
25
25
  return event;
26
26
  });
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SoundsEvent = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const SoundsAudio_1 = require("./SoundsAudio");
6
- const SoundsMelody_1 = require("./SoundsMelody");
7
- const SoundsNote_1 = require("./SoundsNote");
5
+ const SoundsAudio_js_1 = require("./SoundsAudio.js");
6
+ const SoundsMelody_js_1 = require("./SoundsMelody.js");
7
+ const SoundsNote_js_1 = require("./SoundsNote.js");
8
8
  class SoundsEvent {
9
9
  constructor() {
10
10
  this.event = [];
@@ -20,26 +20,26 @@ class SoundsEvent {
20
20
  if (data.audio !== undefined) {
21
21
  if ((0, engine_1.isArray)(data.audio)) {
22
22
  this.audio = data.audio.map((s) => {
23
- const tmp = new SoundsAudio_1.SoundsAudio();
23
+ const tmp = new SoundsAudio_js_1.SoundsAudio();
24
24
  tmp.load(s);
25
25
  return tmp;
26
26
  });
27
27
  }
28
28
  else {
29
- this.audio = new SoundsAudio_1.SoundsAudio();
29
+ this.audio = new SoundsAudio_js_1.SoundsAudio();
30
30
  this.audio.load(data.audio);
31
31
  }
32
32
  }
33
33
  if (data.notes !== undefined) {
34
34
  this.notes = data.notes.map((t) => {
35
- const tmp = new SoundsNote_1.SoundsNote();
35
+ const tmp = new SoundsNote_js_1.SoundsNote();
36
36
  tmp.load(t);
37
37
  return tmp;
38
38
  });
39
39
  }
40
40
  if (data.melodies !== undefined) {
41
41
  this.melodies = data.melodies.map((t) => {
42
- const tmp = new SoundsMelody_1.SoundsMelody();
42
+ const tmp = new SoundsMelody_js_1.SoundsMelody();
43
43
  tmp.load(t);
44
44
  return tmp;
45
45
  });
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SoundsIcons = void 0;
4
- const SoundsIcon_1 = require("./SoundsIcon");
4
+ const SoundsIcon_js_1 = require("./SoundsIcon.js");
5
5
  class SoundsIcons {
6
6
  constructor() {
7
- this.mute = new SoundsIcon_1.SoundsIcon();
8
- this.unmute = new SoundsIcon_1.SoundsIcon();
9
- this.volumeDown = new SoundsIcon_1.SoundsIcon();
10
- this.volumeUp = new SoundsIcon_1.SoundsIcon();
7
+ this.mute = new SoundsIcon_js_1.SoundsIcon();
8
+ this.unmute = new SoundsIcon_js_1.SoundsIcon();
9
+ this.volumeDown = new SoundsIcon_js_1.SoundsIcon();
10
+ this.volumeUp = new SoundsIcon_js_1.SoundsIcon();
11
11
  this.mute.svg = `<?xml version="1.0"?>
12
12
  <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
13
13
  xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SoundsMelody = void 0;
4
- const SoundsNote_1 = require("./SoundsNote");
4
+ const SoundsNote_js_1 = require("./SoundsNote.js");
5
5
  class SoundsMelody {
6
6
  constructor() {
7
7
  this.loop = false;
@@ -24,7 +24,7 @@ class SoundsMelody {
24
24
  }
25
25
  if (data.notes !== undefined) {
26
26
  this.notes = data.notes.map((s) => {
27
- const tmp = new SoundsNote_1.SoundsNote();
27
+ const tmp = new SoundsNote_js_1.SoundsNote();
28
28
  tmp.load(s);
29
29
  return tmp;
30
30
  });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SoundsInstance = void 0;
4
4
  const engine_1 = require("@tsparticles/engine");
5
- const utils_1 = require("./utils");
5
+ const utils_js_1 = require("./utils.js");
6
6
  function initImage(data) {
7
7
  const img = document.createElement("img"), { clickCb, container, display, iconOptions, margin, options, pos, rightOffsets } = data, { width, path, svg } = iconOptions;
8
8
  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);
@@ -174,7 +174,7 @@ class SoundsInstance {
174
174
  }
175
175
  const value = (0, engine_1.itemFromSingleOrMultiple)(note.value, valueIdx, true);
176
176
  try {
177
- const freq = (0, utils_1.getNoteFrequency)(value);
177
+ const freq = (0, utils_js_1.getNoteFrequency)(value);
178
178
  if (!(0, engine_1.isNumber)(freq)) {
179
179
  return;
180
180
  }
package/cjs/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadSoundsPlugin = void 0;
4
- const Sounds_1 = require("./Options/Classes/Sounds");
5
- const SoundsInstance_1 = require("./SoundsInstance");
4
+ const Sounds_js_1 = require("./Options/Classes/Sounds.js");
5
+ const SoundsInstance_js_1 = require("./SoundsInstance.js");
6
6
  class SoundsPlugin {
7
7
  constructor(engine) {
8
8
  this.id = "sounds";
9
9
  this._engine = engine;
10
10
  }
11
11
  getPlugin(container) {
12
- return new SoundsInstance_1.SoundsInstance(container, this._engine);
12
+ return new SoundsInstance_js_1.SoundsInstance(container, this._engine);
13
13
  }
14
14
  loadOptions(options, source) {
15
15
  if (!this.needsPlugin(options) && !this.needsPlugin(source)) {
@@ -17,7 +17,7 @@ class SoundsPlugin {
17
17
  }
18
18
  let soundsOptions = options.sounds;
19
19
  if (soundsOptions?.load === undefined) {
20
- options.sounds = soundsOptions = new Sounds_1.Sounds();
20
+ options.sounds = soundsOptions = new Sounds_js_1.Sounds();
21
21
  }
22
22
  soundsOptions.load(source?.sounds);
23
23
  }
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
@@ -1,6 +1,6 @@
1
- import { SoundsEvent } from "./SoundsEvent";
2
- import { SoundsIcons } from "./SoundsIcons";
3
- import { SoundsVolume } from "./SoundsVolume";
1
+ import { SoundsEvent } from "./SoundsEvent.js";
2
+ import { SoundsIcons } from "./SoundsIcons.js";
3
+ import { SoundsVolume } from "./SoundsVolume.js";
4
4
  export class Sounds {
5
5
  constructor() {
6
6
  this.enable = false;
@@ -1,7 +1,7 @@
1
1
  import { isArray, isFunction, isString, } from "@tsparticles/engine";
2
- import { SoundsAudio } from "./SoundsAudio";
3
- import { SoundsMelody } from "./SoundsMelody";
4
- import { SoundsNote } from "./SoundsNote";
2
+ import { SoundsAudio } from "./SoundsAudio.js";
3
+ import { SoundsMelody } from "./SoundsMelody.js";
4
+ import { SoundsNote } from "./SoundsNote.js";
5
5
  export class SoundsEvent {
6
6
  constructor() {
7
7
  this.event = [];
@@ -1,4 +1,4 @@
1
- import { SoundsIcon } from "./SoundsIcon";
1
+ import { SoundsIcon } from "./SoundsIcon.js";
2
2
  export class SoundsIcons {
3
3
  constructor() {
4
4
  this.mute = new SoundsIcon();
@@ -1,4 +1,4 @@
1
- import { SoundsNote } from "./SoundsNote";
1
+ import { SoundsNote } from "./SoundsNote.js";
2
2
  export class SoundsMelody {
3
3
  constructor() {
4
4
  this.loop = false;
@@ -1,5 +1,5 @@
1
1
  import { clamp, executeOnSingleOrMultiple, getLogger, isArray, isNumber, itemFromArray, itemFromSingleOrMultiple, } from "@tsparticles/engine";
2
- import { getNoteFrequency } from "./utils";
2
+ import { getNoteFrequency } from "./utils.js";
3
3
  function initImage(data) {
4
4
  const img = document.createElement("img"), { clickCb, container, display, iconOptions, margin, options, pos, rightOffsets } = data, { width, path, svg } = iconOptions;
5
5
  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);
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Sounds } from "./Options/Classes/Sounds";
2
- import { SoundsInstance } from "./SoundsInstance";
1
+ import { Sounds } from "./Options/Classes/Sounds.js";
2
+ import { SoundsInstance } from "./SoundsInstance.js";
3
3
  class SoundsPlugin {
4
4
  constructor(engine) {
5
5
  this.id = "sounds";
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tsparticles/plugin-sounds",
3
- "version": "3.0.0-beta.0",
3
+ "version": "3.0.0-beta.2",
4
4
  "description": "tsParticles sounds plugin",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/matteobruni/tsparticles.git",
8
+ "url": "git+https://github.com/tsparticles/tsparticles.git",
9
9
  "directory": "plugins/sounds"
10
10
  },
11
11
  "keywords": [
@@ -65,16 +65,28 @@
65
65
  "author": "Matteo Bruni <matteo.bruni@me.com>",
66
66
  "license": "MIT",
67
67
  "bugs": {
68
- "url": "https://github.com/matteobruni/tsparticles/issues"
68
+ "url": "https://github.com/tsparticles/tsparticles/issues"
69
69
  },
70
- "main": "cjs/index.js",
70
+ "sideEffects": false,
71
71
  "jsdelivr": "tsparticles.plugin.sounds.min.js",
72
72
  "unpkg": "tsparticles.plugin.sounds.min.js",
73
+ "browser": "browser/index.js",
74
+ "main": "cjs/index.js",
73
75
  "module": "esm/index.js",
74
76
  "types": "types/index.d.ts",
75
- "sideEffects": false,
77
+ "exports": {
78
+ ".": {
79
+ "types": "./types/index.d.ts",
80
+ "browser": "./browser/index.js",
81
+ "import": "./esm/index.js",
82
+ "require": "./cjs/index.js",
83
+ "umd": "./umd/index.js",
84
+ "default": "./cjs/index.js"
85
+ },
86
+ "./package.json": "./package.json"
87
+ },
76
88
  "dependencies": {
77
- "@tsparticles/engine": "^3.0.0-beta.0"
89
+ "@tsparticles/engine": "^3.0.0-beta.2"
78
90
  },
79
91
  "publishConfig": {
80
92
  "access": "public"