@tsparticles/plugin-sounds 4.0.0-beta.0 → 4.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 (41) hide show
  1. package/4.min.js +1 -0
  2. package/{30.min.js → 414.min.js} +2 -2
  3. package/browser/SoundsPlugin.js +1 -0
  4. package/browser/SoundsPluginInstance.js +2 -2
  5. package/browser/index.js +4 -3
  6. package/cjs/SoundsPlugin.js +1 -0
  7. package/cjs/SoundsPluginInstance.js +2 -2
  8. package/cjs/index.js +4 -3
  9. package/dist_browser_SoundsPluginInstance_js.js +2 -2
  10. package/dist_browser_SoundsPlugin_js.js +2 -2
  11. package/esm/SoundsPlugin.js +1 -0
  12. package/esm/SoundsPluginInstance.js +2 -2
  13. package/esm/index.js +4 -3
  14. package/package.json +4 -5
  15. package/report.html +84 -29
  16. package/tsparticles.plugin.sounds.js +2 -2
  17. package/tsparticles.plugin.sounds.min.js +2 -2
  18. package/915.min.js +0 -1
  19. package/umd/Options/Classes/Sounds.js +0 -54
  20. package/umd/Options/Classes/SoundsAudio.js +0 -39
  21. package/umd/Options/Classes/SoundsEvent.js +0 -75
  22. package/umd/Options/Classes/SoundsIcon.js +0 -44
  23. package/umd/Options/Classes/SoundsIcons.js +0 -78
  24. package/umd/Options/Classes/SoundsMelody.js +0 -48
  25. package/umd/Options/Classes/SoundsNote.js +0 -34
  26. package/umd/Options/Classes/SoundsVolume.js +0 -49
  27. package/umd/Options/Interfaces/ISounds.js +0 -12
  28. package/umd/Options/Interfaces/ISoundsAudio.js +0 -12
  29. package/umd/Options/Interfaces/ISoundsEvent.js +0 -12
  30. package/umd/Options/Interfaces/ISoundsIcon.js +0 -12
  31. package/umd/Options/Interfaces/ISoundsIcons.js +0 -12
  32. package/umd/Options/Interfaces/ISoundsMelody.js +0 -12
  33. package/umd/Options/Interfaces/ISoundsNote.js +0 -12
  34. package/umd/Options/Interfaces/ISoundsVolume.js +0 -12
  35. package/umd/SoundsPlugin.js +0 -86
  36. package/umd/SoundsPluginInstance.js +0 -451
  37. package/umd/constants.js +0 -14
  38. package/umd/enums.js +0 -23
  39. package/umd/index.js +0 -54
  40. package/umd/types.js +0 -12
  41. package/umd/utils.js +0 -48
@@ -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
- * v4.0.0-beta.0
7
+ * v4.0.0-beta.2
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -44,7 +44,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
44
44
  \*******************************/
45
45
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
46
 
47
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadSoundsPlugin: () => (/* binding */ loadSoundsPlugin)\n/* harmony export */ });\nasync function loadSoundsPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.0\");\n await engine.register(async (e)=>{\n const { SoundsPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_SoundsPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./SoundsPlugin.js */ \"./dist/browser/SoundsPlugin.js\"));\n e.addPlugin(new SoundsPlugin(engine));\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/index.js?\n}");
47
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadSoundsPlugin: () => (/* binding */ loadSoundsPlugin)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nasync function loadSoundsPlugin(engine) {\n engine.checkVersion(\"4.0.0-beta.2\");\n await engine.pluginManager.register(async (e)=>{\n const { SoundsPlugin } = await __webpack_require__.e(/*! import() */ \"dist_browser_SoundsPlugin_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./SoundsPlugin.js */ \"./dist/browser/SoundsPlugin.js\"));\n e.pluginManager.addPlugin(new SoundsPlugin(e));\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/plugin-sounds/./dist/browser/index.js?\n}");
48
48
 
49
49
  /***/ }
50
50
 
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var n,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/plugin-sounds:"+r){n=l;break}}n||(i=!0,(n=document.createElement("script")).charset="utf-8",a.nc&&n.setAttribute("nonce",a.nc),n.setAttribute("data-webpack","@tsparticles/plugin-sounds:"+r),n.src=e),s[e]=[t];var p=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=p.bind(null,n.onerror),n.onload=p.bind(null,n.onload),i&&document.head.appendChild(n)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(u=a.g.location+"");var s,u,c=a.g.document;if(!u&&c&&(c.currentScript&&"SCRIPT"===c.currentScript.tagName.toUpperCase()&&(u=c.currentScript.src),!u)){var l=c.getElementsByTagName("script");if(l.length)for(var p=l.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=l[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");a.p=u=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={848:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var i=a.p+a.u(e),s=Error();a.l(i,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
2
- (`+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[i,s,u]=r,c=0;if(i.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);u&&u(a)}for(e&&e(r);c<i.length;c++)n=i[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_plugin_sounds=this.webpackChunk_tsparticles_plugin_sounds||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.0"),await e.register(async t=>{let{SoundsPlugin:r}=await a.e(30).then(a.bind(a,30));t.addPlugin(new r(e))})}return a.r(d),a.d(d,{loadSoundsPlugin:()=>f}),d})());
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,n={303(t){t.exports=e}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.m=n,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>""+e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var n,i,u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var p=u[l];if(p.getAttribute("src")==e||p.getAttribute("data-webpack")=="@tsparticles/plugin-sounds:"+r){n=p;break}}n||(i=!0,(n=document.createElement("script")).charset="utf-8",a.nc&&n.setAttribute("nonce",a.nc),n.setAttribute("data-webpack","@tsparticles/plugin-sounds:"+r),n.src=e),s[e]=[t];var c=(t,r)=>{n.onerror=n.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],n.parentNode&&n.parentNode.removeChild(n),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(c.bind(null,void 0,{type:"timeout",target:n}),12e4);n.onerror=c.bind(null,n.onerror),n.onload=c.bind(null,n.onload),i&&document.head.appendChild(n)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(u=a.g.location+"");var s,u,l=a.g.document;if(!u&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(u=l.currentScript.src),!u)){var p=l.getElementsByTagName("script");if(p.length)for(var c=p.length-1;c>-1&&(!u||!/^http(s?):/.test(u));)u=p[c--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");a.p=u=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={848:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise((r,n)=>o=t[e]=[r,n]);r.push(o[2]=n);var i=a.p+a.u(e),s=Error();a.l(i,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
2
+ (`+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[i,s,u]=r,l=0;if(i.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);u&&u(a)}for(e&&e(r);l<i.length;l++)n=i[l],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_plugin_sounds=this.webpackChunk_tsparticles_plugin_sounds||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.2"),await e.pluginManager.register(async e=>{let{SoundsPlugin:t}=await a.e(414).then(a.bind(a,414));e.pluginManager.addPlugin(new t(e))})}return a.r(d),a.d(d,{loadSoundsPlugin:()=>f}),a(303),d})());
package/915.min.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunk_tsparticles_plugin_sounds=this.webpackChunk_tsparticles_plugin_sounds||[]).push([[915],{915(t,e,i){i.d(e,{SoundsPluginInstance:()=>m});var n,s,a,o,u=i(303);(n=a||(a={})).mute="soundsMuted",n.unmute="soundsUnmuted",(s=o||(o={})).Block="block",s.None="none";var l=i(519),r=i(967);function c(t){var e,i,n,s,a,o,l,r;let c=(0,u.safeDocument)().createElement("img"),{clickCb:d,container:m,display:h,iconOptions:_,margin:p,options:g,pos:f,rightOffsets:v}=t,{width:y,path:w,style:O,svg:S}=_;return e=c,i=f.top+p,n=f.right-(p*(v.length+1)+y+v.reduce((t,e)=>t+e,0)),s=h,a=g.fullScreen.zIndex+1,o=y,l=p,r=O,e.style.userSelect="none",e.style.position="absolute",e.style.top=`${(i+l).toString()}px`,e.style.left=`${(n-l-o).toString()}px`,e.style.display=s,e.style.zIndex=(a+1).toString(),e.style.cssText+=r,c.src=w??(S?`data:image/svg+xml;base64,${btoa(S)}`:""),(m.canvas.element?.parentNode??(0,u.safeDocument)().body).append(c),c.addEventListener("click",()=>{d()}),c}function d(t){t&&t.remove()}class m{_audioMap;_audioSources;_container;_engine;_gain;_muteImg;_unmuteImg;_volume;_volumeDownImg;_volumeUpImg;constructor(t,e){this._container=t,this._engine=e,this._volume=0,this._audioSources=[],this._audioMap=new Map}async init(){let t=this._container.actualOptions.sounds;if(!t?.enable)return;if(t.autoPlay&&(0,l.E3)()){let t=()=>{removeEventListener(r.m,t),removeEventListener(r.s,t),(0,l.XK)(),this.unmute()},e={capture:!0,once:!0};addEventListener(r.m,t,e),addEventListener(r.s,t,e)}this._volume=t.volume.value;let e=t.events;for(let t of(this._audioMap=new Map,e)){if(!t.audio)continue;let e=(0,u.executeOnSingleOrMultiple)(t.audio,async t=>{let e=await fetch(t.source);if(!e.ok)return;let i=await e.arrayBuffer(),n=this._getAudioContext(),s=await n.decodeAudioData(i);this._audioMap.set(t.source,s)});e instanceof Promise?await e:await Promise.allSettled(e)}}async mute(){this._container.muted||await this.toggleMute()}async start(){let t=this._container,e=t.actualOptions,i=e.sounds;if(!i?.enable||!t.canvas.element)return;t.muted=!0;let n=t.canvas.element,s={top:n.offsetTop,right:n.offsetLeft+n.offsetWidth},{mute:a,unmute:u,volumeDown:r,volumeUp:d}=i.icons,m=async()=>{await this.toggleMute()},h=i.icons.enable?o.Block:o.None;this._muteImg=c({container:t,options:e,pos:s,display:h,iconOptions:a,margin:10,rightOffsets:[r.width,d.width],clickCb:m}),this._unmuteImg=c({container:t,options:e,pos:s,display:o.None,iconOptions:u,margin:10,rightOffsets:[r.width,d.width],clickCb:m}),this._volumeDownImg=c({container:t,options:e,pos:s,display:h,iconOptions:r,margin:10,rightOffsets:[d.width],clickCb:async()=>{await this.volumeDown()}}),this._volumeUpImg=c({container:t,options:e,pos:s,display:h,iconOptions:d,margin:10,rightOffsets:[],clickCb:async()=>{await this.volumeUp()}}),!(0,l.E3)()&&i.autoPlay&&await this.unmute()}stop(){this._container.muted=!0,(async()=>{await this._mute(),d(this._muteImg),d(this._unmuteImg),d(this._volumeDownImg),d(this._volumeUpImg)})()}async toggleMute(){let t=this._container;t.muted=!t.muted,this._updateMuteIcons(),await this._updateMuteStatus()}async unmute(){this._container.muted&&await this.toggleMute()}async volumeDown(){let t=this._container,e=t.actualOptions.sounds;e?.enable&&(t.muted&&(this._volume=0),this._volume-=e.volume.step,await this._updateVolume())}async volumeUp(){let t=this._container.actualOptions.sounds;t?.enable&&(this._volume+=t.volume.step,await this._updateVolume())}_addBuffer=t=>{let e=t.createBufferSource();return this._audioSources.push(e),e};_addOscillator=t=>{let e=t.createOscillator();return this._audioSources.push(e),e};_getAudioContext(){let t=this._container;return t.audioContext??=new AudioContext,t.audioContext}_initEvents=()=>{let t=this._container,e=t.actualOptions.sounds;if(e?.enable&&t.canvas.element)for(let t of e.events){let e=i=>{i&&(async()=>{let n=t.filter&&!t.filter(i);if(this._container===i.container){if(this._container.muted||this._container.destroyed)return(0,u.executeOnSingleOrMultiple)(t.event,t=>{this._engine.removeEventListener(t,e)});if(!n){if(t.audio){let e=(0,u.itemFromSingleOrMultiple)(t.audio);if(!e)return;this._playBuffer(e)}else if(t.melodies){let e=(0,u.itemFromArray)(t.melodies);if(!e)return;e.melodies.length?await Promise.allSettled(e.melodies.map(t=>this._playNote(t.notes,0,e.loop))):await this._playNote(e.notes,0,e.loop)}else if(t.notes){let e=(0,u.itemFromArray)(t.notes);if(!e)return;await this._playNote([e],0,!1)}}}})()};(0,u.executeOnSingleOrMultiple)(t.event,t=>{this._engine.addEventListener(t,e)})}};_mute=async()=>{let t=this._container,e=this._getAudioContext();for(let t of this._audioSources)this._removeAudioSource(t);this._gain&&this._gain.disconnect(),await e.close(),t.audioContext=void 0,this._engine.dispatchEvent(a.mute,{container:this._container})};_playBuffer=t=>{let e=this._audioMap.get(t.source);if(!e)return;let i=this._container.audioContext;if(!i)return;let n=this._addBuffer(i);n.loop=t.loop,n.buffer=e,n.connect(this._gain??i.destination),n.start()};_playFrequency=async(t,e)=>{if(!this._gain||this._container.muted)return;let i=this._getAudioContext(),n=this._addOscillator(i);return n.connect(this._gain),n.type="sine",n.frequency.value=t,n.start(),new Promise(t=>{setTimeout(()=>{this._removeAudioSource(n),t()},e)})};_playMuteSound=()=>{if(this._container.muted)return;let t=this._getAudioContext(),e=t.createGain();e.connect(t.destination),e.gain.value=0;let i=t.createOscillator();i.connect(e),i.type="sine",i.frequency.value=1,i.start(),setTimeout(()=>{i.stop(),i.disconnect(),e.disconnect()})};_playNote=async(t,e,i)=>{if(this._container.muted)return;let n=t[e];if(!n)return;let s=n.value,a=(0,u.executeOnSingleOrMultiple)(s,async(i,n)=>this._playNoteValue(t,e,n));await ((0,u.isArray)(a)?Promise.allSettled(a):a);let o=e+1;i&&o>=t.length&&(o%=t.length),await this._playNote(t,o,i)};_playNoteValue=async(t,e,i)=>{let n=t[e];if(!n)return;let s=(0,u.itemFromSingleOrMultiple)(n.value,i,!0);if(s)try{let t=(0,l.jE)(s);if(!(0,u.isNumber)(t))return;await this._playFrequency(t,n.duration)}catch(t){(0,u.getLogger)().error(t)}};_removeAudioSource=t=>{t.stop(),t.disconnect(),this._audioSources.splice(this._audioSources.indexOf(t),1)};_unmute=()=>{let t=this._container.actualOptions.sounds;if(!t)return;let e=this._getAudioContext(),i=e.createGain();i.connect(e.destination),i.gain.value=t.volume.value/u.percentDenominator,this._gain=i,this._initEvents(),this._engine.dispatchEvent(a.unmute,{container:this._container})};_updateMuteIcons=()=>{let t=this._container,e=t.actualOptions.sounds;if(!e?.enable||!e.icons.enable)return;let i=this._muteImg,n=this._unmuteImg;i&&(i.style.display=t.muted?"block":"none"),n&&(n.style.display=t.muted?"none":"block")};_updateMuteStatus=async()=>{let t=this._container,e=this._getAudioContext();t.muted?(await e.suspend(),await this._mute()):(await e.resume(),this._unmute(),this._playMuteSound())};_updateVolume=async()=>{let t=this._container,e=t.actualOptions.sounds;if(!e?.enable)return;(0,u.clamp)(this._volume,e.volume.min,e.volume.max);let i=!1;this._volume<=0&&!t.muted?(this._volume=0,t.muted=!0,i=!0):this._volume>0&&t.muted&&(t.muted=!1,i=!0),i&&(this._updateMuteIcons(),await this._updateMuteStatus()),this._gain?.gain&&(this._gain.gain.value=this._volume/u.percentDenominator)}}}}]);
@@ -1,54 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./SoundsEvent.js", "./SoundsIcons.js", "./SoundsVolume.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Sounds = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const SoundsEvent_js_1 = require("./SoundsEvent.js");
15
- const SoundsIcons_js_1 = require("./SoundsIcons.js");
16
- const SoundsVolume_js_1 = require("./SoundsVolume.js");
17
- class Sounds {
18
- autoPlay;
19
- enable;
20
- events;
21
- icons;
22
- volume;
23
- constructor() {
24
- this.autoPlay = true;
25
- this.enable = false;
26
- this.events = [];
27
- this.icons = new SoundsIcons_js_1.SoundsIcons();
28
- this.volume = new SoundsVolume_js_1.SoundsVolume();
29
- }
30
- load(data) {
31
- if ((0, engine_1.isNull)(data)) {
32
- return;
33
- }
34
- if (data.autoPlay !== undefined) {
35
- this.autoPlay = data.autoPlay;
36
- }
37
- if (data.enable !== undefined) {
38
- this.enable = data.enable;
39
- }
40
- if (data.events !== undefined) {
41
- this.events = data.events.map(t => {
42
- const event = new SoundsEvent_js_1.SoundsEvent();
43
- event.load(t);
44
- return event;
45
- });
46
- }
47
- this.icons.load(data.icons);
48
- if (data.volume !== undefined) {
49
- this.volume.load(data.volume);
50
- }
51
- }
52
- }
53
- exports.Sounds = Sounds;
54
- });
@@ -1,39 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsAudio = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class SoundsAudio {
15
- loop;
16
- source;
17
- constructor() {
18
- this.loop = false;
19
- this.source = "";
20
- }
21
- load(data) {
22
- if ((0, engine_1.isNull)(data)) {
23
- return;
24
- }
25
- if ((0, engine_1.isObject)(data)) {
26
- if (data.loop !== undefined) {
27
- this.loop = data.loop;
28
- }
29
- if (data.source !== undefined) {
30
- this.source = data.source;
31
- }
32
- }
33
- else {
34
- this.source = data;
35
- }
36
- }
37
- }
38
- exports.SoundsAudio = SoundsAudio;
39
- });
@@ -1,75 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./SoundsAudio.js", "./SoundsMelody.js", "./SoundsNote.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsEvent = void 0;
13
- const engine_1 = require("@tsparticles/engine");
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
- class SoundsEvent {
18
- audio;
19
- event;
20
- filter;
21
- melodies;
22
- notes;
23
- constructor() {
24
- this.event = [];
25
- this.notes = [];
26
- }
27
- load(data) {
28
- if ((0, engine_1.isNull)(data)) {
29
- return;
30
- }
31
- if (data.event !== undefined) {
32
- this.event = data.event;
33
- }
34
- if (data.audio !== undefined) {
35
- if ((0, engine_1.isArray)(data.audio)) {
36
- this.audio = data.audio.map(s => {
37
- const tmp = new SoundsAudio_js_1.SoundsAudio();
38
- tmp.load(s);
39
- return tmp;
40
- });
41
- }
42
- else {
43
- this.audio = new SoundsAudio_js_1.SoundsAudio();
44
- this.audio.load(data.audio);
45
- }
46
- }
47
- if (data.notes !== undefined) {
48
- this.notes = data.notes.map(t => {
49
- const tmp = new SoundsNote_js_1.SoundsNote();
50
- tmp.load(t);
51
- return tmp;
52
- });
53
- }
54
- if (data.melodies !== undefined) {
55
- this.melodies = data.melodies.map(t => {
56
- const tmp = new SoundsMelody_js_1.SoundsMelody();
57
- tmp.load(t);
58
- return tmp;
59
- });
60
- }
61
- if (data.filter) {
62
- if ((0, engine_1.isString)(data.filter)) {
63
- const filterFunc = globalThis[data.filter];
64
- if ((0, engine_1.isFunction)(filterFunc)) {
65
- this.filter = filterFunc;
66
- }
67
- }
68
- else {
69
- this.filter = data.filter;
70
- }
71
- }
72
- }
73
- }
74
- exports.SoundsEvent = SoundsEvent;
75
- });
@@ -1,44 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsIcon = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class SoundsIcon {
15
- height;
16
- path;
17
- style;
18
- svg;
19
- width;
20
- constructor() {
21
- this.width = 24;
22
- this.height = 24;
23
- this.style = "";
24
- }
25
- load(data) {
26
- if ((0, engine_1.isNull)(data)) {
27
- return;
28
- }
29
- if (data.path !== undefined) {
30
- this.path = data.path;
31
- }
32
- if (data.svg !== undefined) {
33
- this.svg = data.svg;
34
- }
35
- if (data.width !== undefined) {
36
- this.width = data.width;
37
- }
38
- if (data.height !== undefined) {
39
- this.height = data.height;
40
- }
41
- }
42
- }
43
- exports.SoundsIcon = SoundsIcon;
44
- });
@@ -1,78 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./SoundsIcon.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsIcons = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const SoundsIcon_js_1 = require("./SoundsIcon.js");
15
- class SoundsIcons {
16
- enable;
17
- mute;
18
- unmute;
19
- volumeDown;
20
- volumeUp;
21
- constructor() {
22
- this.mute = new SoundsIcon_js_1.SoundsIcon();
23
- this.unmute = new SoundsIcon_js_1.SoundsIcon();
24
- this.volumeDown = new SoundsIcon_js_1.SoundsIcon();
25
- this.volumeUp = new SoundsIcon_js_1.SoundsIcon();
26
- this.enable = false;
27
- this.mute.svg = `<?xml version="1.0"?>
28
- <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
29
- xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
30
- xmlns:xlink="http://www.w3.org/1999/xlink">
31
- <g id="Layer_1">
32
- <path fill="#fff" d="M19.707,5.293c-0.391-0.391-1.023-0.391-1.414,0l-1.551,1.551c-0.345-0.688-0.987-1.02-1.604-1.02c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.237,0.754,2.302,1.826,2.76l-1.533,1.533c-0.391,0.391-0.391,1.023,0,1.414C5.488,19.902,5.744,20,6,20s0.512-0.098,0.707-0.293l2.527-2.527c0.697,0.174,1.416,0.455,1.875,0.762l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V9.414l2.707-2.707C20.098,6.316,20.098,5.684,19.707,5.293z M14.891,7.941c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8v1.293l-2,2V9.202L14.891,7.941z M7,12c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v2.439l-2.83,2.83C8.757,15.046,8.356,15,8,15c-0.552,0-1-0.448-1-1V12z M10.301,15.406L12,13.707v2.439C11.519,15.859,10.925,15.604,10.301,15.406z M14.994,18.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798v-4.091l2-2V18C15,18.046,14.998,18.086,14.994,18.12z"/>
33
- </g>
34
- </svg>`;
35
- this.unmute.svg = `<?xml version="1.0"?>
36
- <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
37
- xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
38
- xmlns:xlink="http://www.w3.org/1999/xlink">
39
- <g id="Layer_1">
40
- <path fill="#fff" d="M17.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C12.357,8.561,10.904,9,10,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C18.035,20.176,19,19.495,19,18V8C19,6.505,18.035,5.824,17.138,5.824z M14,16.146C12.907,15.495,11.211,15,10,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146V16.146z M17,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L15,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C16.998,7.914,17,7.954,17,8V18z"/>
41
- </g>
42
- </svg>`;
43
- this.volumeDown.svg = `<?xml version="1.0"?>
44
- <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
45
- xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
46
- xmlns:xlink="http://www.w3.org/1999/xlink">
47
- <g id="Layer_1">
48
- <path fill="#fff" d="M15.138,5.824c-0.449,0-0.905,0.152-1.356,0.453l-2.672,1.781C10.357,8.561,8.904,9,8,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C16.035,20.176,17,19.495,17,18V8C17,6.505,16.035,5.824,15.138,5.824z M8,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C10.907,15.495,9.211,15,8,15z M15,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L13,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C14.998,7.914,15,7.954,15,8V18z"/>
49
- <path fill="#fff" d="M18.292,10.294c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C18.488,15.902,18.744,16,19,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708s-0.398-1.984-1.123-2.707C19.317,9.903,18.683,9.901,18.292,10.294z"/>
50
- </g>
51
- </svg>`;
52
- this.volumeUp.svg = `<?xml version="1.0"?>
53
- <svg baseProfile="tiny" height="24px" version="1.2" viewBox="0 0 24 24" width="24px"
54
- xml:space="preserve" xmlns="http://www.w3.org/2000/svg"
55
- xmlns:xlink="http://www.w3.org/1999/xlink">
56
- <g id="Layer_1">
57
- <path fill="#fff" d="M16.706,10.292c-0.389-0.389-1.023-0.391-1.414,0.002c-0.39,0.391-0.39,1.023,0.002,1.414c0.345,0.345,0.535,0.803,0.535,1.291c0,0.489-0.19,0.948-0.536,1.294c-0.391,0.39-0.391,1.023,0,1.414C15.488,15.902,15.744,16,16,16s0.512-0.098,0.707-0.293c0.724-0.723,1.122-1.685,1.122-2.708S17.431,11.015,16.706,10.292z"/>
58
- <path fill="#fff" d="M18.706,8.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c0.879,0.877,1.363,2.044,1.364,3.287c0.001,1.246-0.484,2.417-1.365,3.298c-0.391,0.391-0.391,1.023,0,1.414C17.488,17.902,17.744,18,18,18s0.512-0.098,0.707-0.293c1.259-1.259,1.952-2.933,1.951-4.713C20.657,11.217,19.964,9.547,18.706,8.292z"/>
59
- <path fill="#fff" d="M20.706,6.292c-0.391-0.389-1.023-0.39-1.414,0.002c-0.39,0.391-0.39,1.024,0.002,1.414c1.412,1.409,2.191,3.285,2.192,5.284c0.002,2.002-0.777,3.885-2.193,5.301c-0.391,0.391-0.391,1.023,0,1.414C19.488,19.902,19.744,20,20,20s0.512-0.098,0.707-0.293c1.794-1.794,2.781-4.18,2.779-6.717C23.485,10.457,22.497,8.078,20.706,6.292z"/>
60
- <path fill="#fff" d="M12.138,5.824c-0.449,0-0.905,0.152-1.356,0.453L8.109,8.059C7.357,8.561,5.904,9,5,9c-1.654,0-3,1.346-3,3v2c0,1.654,1.346,3,3,3c0.904,0,2.357,0.439,3.109,0.941l2.672,1.781c0.451,0.301,0.907,0.453,1.356,0.453C13.035,20.176,14,19.495,14,18V8C14,6.505,13.035,5.824,12.138,5.824z M5,15c-0.552,0-1-0.448-1-1v-2c0-0.552,0.448-1,1-1c1.211,0,2.907-0.495,4-1.146v6.293C7.907,15.495,6.211,15,5,15z M12,18c0,0.046-0.002,0.086-0.006,0.12c-0.03-0.016-0.065-0.036-0.104-0.062L10,16.798V9.202l1.891-1.261c0.038-0.025,0.073-0.046,0.104-0.062C11.998,7.914,12,7.954,12,8V18z"/>
61
- </g>
62
- </svg>`;
63
- }
64
- load(data) {
65
- if ((0, engine_1.isNull)(data)) {
66
- return;
67
- }
68
- if (data.enable !== undefined) {
69
- this.enable = data.enable;
70
- }
71
- this.mute.load(data.mute);
72
- this.unmute.load(data.unmute);
73
- this.volumeDown.load(data.volumeDown);
74
- this.volumeUp.load(data.volumeUp);
75
- }
76
- }
77
- exports.SoundsIcons = SoundsIcons;
78
- });
@@ -1,48 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine", "./SoundsNote.js"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsMelody = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- const SoundsNote_js_1 = require("./SoundsNote.js");
15
- class SoundsMelody {
16
- loop;
17
- melodies;
18
- notes;
19
- constructor() {
20
- this.loop = false;
21
- this.melodies = [];
22
- this.notes = [];
23
- }
24
- load(data) {
25
- if ((0, engine_1.isNull)(data)) {
26
- return;
27
- }
28
- if (data.loop !== undefined) {
29
- this.loop = data.loop;
30
- }
31
- if (data.melodies !== undefined) {
32
- this.melodies = data.melodies.map(s => {
33
- const tmp = new SoundsMelody();
34
- tmp.load(s);
35
- return tmp;
36
- });
37
- }
38
- if (data.notes !== undefined) {
39
- this.notes = data.notes.map(s => {
40
- const tmp = new SoundsNote_js_1.SoundsNote();
41
- tmp.load(s);
42
- return tmp;
43
- });
44
- }
45
- }
46
- }
47
- exports.SoundsMelody = SoundsMelody;
48
- });
@@ -1,34 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsNote = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class SoundsNote {
15
- duration;
16
- value;
17
- constructor() {
18
- this.duration = 500;
19
- this.value = [];
20
- }
21
- load(data) {
22
- if ((0, engine_1.isNull)(data)) {
23
- return;
24
- }
25
- if (data.duration !== undefined) {
26
- this.duration = data.duration;
27
- }
28
- if (data.value !== undefined) {
29
- this.value = data.value;
30
- }
31
- }
32
- }
33
- exports.SoundsNote = SoundsNote;
34
- });
@@ -1,49 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "@tsparticles/engine"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SoundsVolume = void 0;
13
- const engine_1 = require("@tsparticles/engine");
14
- class SoundsVolume {
15
- max;
16
- min;
17
- step;
18
- value;
19
- constructor() {
20
- this.value = 100;
21
- this.max = 100;
22
- this.min = 0;
23
- this.step = 10;
24
- }
25
- load(data) {
26
- if ((0, engine_1.isNull)(data)) {
27
- return;
28
- }
29
- if ((0, engine_1.isObject)(data)) {
30
- if (data.max !== undefined) {
31
- this.max = data.max;
32
- }
33
- if (data.min !== undefined) {
34
- this.min = data.min;
35
- }
36
- if (data.step !== undefined) {
37
- this.step = data.step;
38
- }
39
- if (data.value !== undefined) {
40
- this.value = data.value;
41
- }
42
- }
43
- else {
44
- this.value = data;
45
- }
46
- }
47
- }
48
- exports.SoundsVolume = SoundsVolume;
49
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });