@tsparticles/vue2 3.0.0 → 4.0.0-beta.15

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.
package/README.md CHANGED
@@ -24,10 +24,10 @@ import Particles from "@tsparticles/vue2";
24
24
  import { loadSlim } from "@tsparticles/slim"; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.
25
25
 
26
26
  Vue.use(Particles, {
27
- init: async engine => {
28
- // await loadFull(engine);
29
- await loadSlim(engine);
30
- },
27
+ init: async engine => {
28
+ // await loadFull(engine);
29
+ await loadSlim(engine);
30
+ },
31
31
  });
32
32
  ```
33
33
 
@@ -35,15 +35,15 @@ Vue.use(Particles, {
35
35
 
36
36
  ```html
37
37
  <template>
38
- <div id="app">
39
- <vue-particles id="tsparticles" :particlesLoaded="particlesLoaded" url="http://foo.bar/particles.json" />
38
+ <div id="app">
39
+ <vue-particles id="tsparticles" :particlesLoaded="particlesLoaded" url="http://foo.bar/particles.json" />
40
40
 
41
- <!-- or -->
41
+ <!-- or -->
42
42
 
43
- <vue-particles
44
- id="tsparticles"
45
- :particlesLoaded="particlesLoaded"
46
- :options="{
43
+ <vue-particles
44
+ id="tsparticles"
45
+ :particlesLoaded="particlesLoaded"
46
+ :options="{
47
47
  background: {
48
48
  color: {
49
49
  value: '#0d47a1'
@@ -60,7 +60,6 @@ Vue.use(Particles, {
60
60
  enable: true,
61
61
  mode: 'repulse'
62
62
  },
63
- resize: true
64
63
  },
65
64
  modes: {
66
65
  bubble: {
@@ -92,7 +91,7 @@ Vue.use(Particles, {
92
91
  move: {
93
92
  direction: 'none',
94
93
  enable: true,
95
- outMode: 'bounce',
94
+ outModes: 'bounce',
96
95
  random: false,
97
96
  speed: 6,
98
97
  straight: false
@@ -100,7 +99,6 @@ Vue.use(Particles, {
100
99
  number: {
101
100
  density: {
102
101
  enable: true,
103
- area: 800
104
102
  },
105
103
  value: 80
106
104
  },
@@ -116,14 +114,14 @@ Vue.use(Particles, {
116
114
  },
117
115
  detectRetina: true
118
116
  }"
119
- />
120
- </div>
117
+ />
118
+ </div>
121
119
  </template>
122
120
  ```
123
121
 
124
122
  ```javascript
125
123
  const particlesLoaded = async container => {
126
- console.log("Particles container loaded", container);
124
+ console.log("Particles container loaded", container);
127
125
  };
128
126
  ```
129
127
 
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,6 @@
1
+ import { tsParticles } from '@tsparticles/engine';
2
+ export type ParticlesPluginRegistrar = (engine: typeof tsParticles) => Promise<void> | void;
3
+ export declare function ensureParticlesInitialization(init?: ParticlesPluginRegistrar): Promise<void>;
4
+ export declare function waitForParticlesInitialization(): Promise<void>;
5
+ export declare function isParticlesInitialized(): boolean;
6
+ //# sourceMappingURL=event-bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../../../src/Particles/event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,OAAO,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAM5F,wBAAgB,6BAA6B,CAAC,IAAI,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B5F;AAED,wBAAgB,8BAA8B,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9D;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
@@ -0,0 +1,11 @@
1
+ import { ParticlesPluginRegistrar } from './event-bus';
2
+ export interface IParticlesPluginOptions {
3
+ init?: ParticlesPluginRegistrar;
4
+ }
5
+ declare const VueParticles: {
6
+ install: (vue: {
7
+ component: (name: string, component: unknown) => void;
8
+ }, options?: IParticlesPluginOptions) => void;
9
+ };
10
+ export default VueParticles;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Particles/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE3F,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,wBAAwB,CAAC;CACjC;AAED,QAAA,MAAM,YAAY;mBACD;QAAE,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,YAAY,uBAAuB;CAM5G,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { Container, ISourceOptions } from '@tsparticles/engine';
2
+ import { default as Vue } from 'vue';
3
+ export type IParticlesProps = ISourceOptions;
4
+ export default class Particles extends Vue {
5
+ readonly id: string;
6
+ readonly options?: IParticlesProps;
7
+ readonly url?: string;
8
+ readonly particlesLoaded?: (container: Container) => void;
9
+ container?: Container;
10
+ mounted(): void;
11
+ beforeDestroy(): void;
12
+ __VLS_template: () => {
13
+ attrs: Partial<{}>;
14
+ slots: {};
15
+ refs: {};
16
+ rootEl: HTMLDivElement;
17
+ };
18
+ }
19
+ //# sourceMappingURL=vue-particles.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-particles.vue.d.ts","sourceRoot":"","sources":["../../../src/Particles/vue-particles.vue"],"names":[],"mappings":"AAGA;AAiEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAe,MAAM,qBAAqB,CAAC;AACvF,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC;AAiC7C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,GAAG;IACd,QAAQ,CAAC,EAAE,EAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAElE,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,IAAI,IAAI;IAMf,aAAa,IAAI,IAAI;IAGvB,cAAc;eAoBA,OAAO,IAA6B;;;;MAMhD;CACD"}
@@ -0,0 +1,295 @@
1
+ import v from "vue";
2
+ import { tsParticles as P } from "@tsparticles/engine";
3
+ /**
4
+ * vue-class-component v7.2.6
5
+ * (c) 2015-present Evan You
6
+ * @license MIT
7
+ */
8
+ function l(e) {
9
+ return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? l = function(t) {
10
+ return typeof t;
11
+ } : l = function(t) {
12
+ return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
13
+ }, l(e);
14
+ }
15
+ function R(e, t, r) {
16
+ return t in e ? Object.defineProperty(e, t, {
17
+ value: r,
18
+ enumerable: !0,
19
+ configurable: !0,
20
+ writable: !0
21
+ }) : e[t] = r, e;
22
+ }
23
+ function S(e) {
24
+ return A(e) || D(e) || E();
25
+ }
26
+ function A(e) {
27
+ if (Array.isArray(e)) {
28
+ for (var t = 0, r = new Array(e.length); t < e.length; t++) r[t] = e[t];
29
+ return r;
30
+ }
31
+ }
32
+ function D(e) {
33
+ if (Symbol.iterator in Object(e) || Object.prototype.toString.call(e) === "[object Arguments]") return Array.from(e);
34
+ }
35
+ function E() {
36
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
37
+ }
38
+ function I() {
39
+ return typeof Reflect < "u" && Reflect.defineMetadata && Reflect.getOwnMetadataKeys;
40
+ }
41
+ function x(e, t) {
42
+ _(e, t), Object.getOwnPropertyNames(t.prototype).forEach(function(r) {
43
+ _(e.prototype, t.prototype, r);
44
+ }), Object.getOwnPropertyNames(t).forEach(function(r) {
45
+ _(e, t, r);
46
+ });
47
+ }
48
+ function _(e, t, r) {
49
+ var n = r ? Reflect.getOwnMetadataKeys(t, r) : Reflect.getOwnMetadataKeys(t);
50
+ n.forEach(function(o) {
51
+ var a = r ? Reflect.getOwnMetadata(o, t, r) : Reflect.getOwnMetadata(o, t);
52
+ r ? Reflect.defineMetadata(o, a, e, r) : Reflect.defineMetadata(o, a, e);
53
+ });
54
+ }
55
+ var N = {
56
+ __proto__: []
57
+ }, V = N instanceof Array;
58
+ function z(e) {
59
+ return function(t, r, n) {
60
+ var o = typeof t == "function" ? t : t.constructor;
61
+ o.__decorators__ || (o.__decorators__ = []), typeof n != "number" && (n = void 0), o.__decorators__.push(function(a) {
62
+ return e(a, r, n);
63
+ });
64
+ };
65
+ }
66
+ function F(e) {
67
+ var t = l(e);
68
+ return e == null || t !== "object" && t !== "function";
69
+ }
70
+ function w(e) {
71
+ typeof console < "u" && console.warn("[vue-class-component] " + e);
72
+ }
73
+ function T(e, t) {
74
+ var r = t.prototype._init;
75
+ t.prototype._init = function() {
76
+ var a = this, s = Object.getOwnPropertyNames(e);
77
+ if (e.$options.props)
78
+ for (var c in e.$options.props)
79
+ e.hasOwnProperty(c) || s.push(c);
80
+ s.forEach(function(i) {
81
+ Object.defineProperty(a, i, {
82
+ get: function() {
83
+ return e[i];
84
+ },
85
+ set: function(j) {
86
+ e[i] = j;
87
+ },
88
+ configurable: !0
89
+ });
90
+ });
91
+ };
92
+ var n = new t();
93
+ t.prototype._init = r;
94
+ var o = {};
95
+ return Object.keys(n).forEach(function(a) {
96
+ n[a] !== void 0 && (o[a] = n[a]);
97
+ }), process.env.NODE_ENV !== "production" && !(t.prototype instanceof v) && Object.keys(o).length > 0 && w("Component class must inherit Vue or its descendant class when class property is used."), o;
98
+ }
99
+ var b = [
100
+ "data",
101
+ "beforeCreate",
102
+ "created",
103
+ "beforeMount",
104
+ "mounted",
105
+ "beforeDestroy",
106
+ "destroyed",
107
+ "beforeUpdate",
108
+ "updated",
109
+ "activated",
110
+ "deactivated",
111
+ "render",
112
+ "errorCaptured",
113
+ "serverPrefetch"
114
+ // 2.6
115
+ ];
116
+ function m(e) {
117
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
118
+ t.name = t.name || e._componentTag || e.name;
119
+ var r = e.prototype;
120
+ Object.getOwnPropertyNames(r).forEach(function(c) {
121
+ if (c !== "constructor") {
122
+ if (b.indexOf(c) > -1) {
123
+ t[c] = r[c];
124
+ return;
125
+ }
126
+ var i = Object.getOwnPropertyDescriptor(r, c);
127
+ i.value !== void 0 ? typeof i.value == "function" ? (t.methods || (t.methods = {}))[c] = i.value : (t.mixins || (t.mixins = [])).push({
128
+ data: function() {
129
+ return R({}, c, i.value);
130
+ }
131
+ }) : (i.get || i.set) && ((t.computed || (t.computed = {}))[c] = {
132
+ get: i.get,
133
+ set: i.set
134
+ });
135
+ }
136
+ }), (t.mixins || (t.mixins = [])).push({
137
+ data: function() {
138
+ return T(this, e);
139
+ }
140
+ });
141
+ var n = e.__decorators__;
142
+ n && (n.forEach(function(c) {
143
+ return c(t);
144
+ }), delete e.__decorators__);
145
+ var o = Object.getPrototypeOf(e.prototype), a = o instanceof v ? o.constructor : v, s = a.extend(t);
146
+ return L(s, e, a), I() && x(s, e), s;
147
+ }
148
+ var H = [
149
+ // Unique id
150
+ "cid",
151
+ // Super Vue constructor
152
+ "super",
153
+ // Component options that will be used by the component
154
+ "options",
155
+ "superOptions",
156
+ "extendOptions",
157
+ "sealedOptions",
158
+ // Private assets
159
+ "component",
160
+ "directive",
161
+ "filter"
162
+ ], $ = {
163
+ prototype: !0,
164
+ arguments: !0,
165
+ callee: !0,
166
+ caller: !0
167
+ };
168
+ function L(e, t, r) {
169
+ Object.getOwnPropertyNames(t).forEach(function(n) {
170
+ if (!$[n]) {
171
+ var o = Object.getOwnPropertyDescriptor(e, n);
172
+ if (!(o && !o.configurable)) {
173
+ var a = Object.getOwnPropertyDescriptor(t, n);
174
+ if (!V) {
175
+ if (n === "cid")
176
+ return;
177
+ var s = Object.getOwnPropertyDescriptor(r, n);
178
+ if (!F(a.value) && s && s.value === a.value)
179
+ return;
180
+ }
181
+ process.env.NODE_ENV !== "production" && H.indexOf(n) >= 0 && w("Static property name '".concat(n, "' declared on class '").concat(t.name, "' ") + "conflicts with reserved property name of Vue internal. It may cause unexpected behavior of the component. Consider renaming the property."), Object.defineProperty(e, n, a);
182
+ }
183
+ }
184
+ });
185
+ }
186
+ function M(e) {
187
+ return typeof e == "function" ? m(e) : function(t) {
188
+ return m(t, e);
189
+ };
190
+ }
191
+ M.registerHooks = function(t) {
192
+ b.push.apply(b, S(t));
193
+ };
194
+ var q = typeof Reflect < "u" && typeof Reflect.getMetadata < "u";
195
+ function U(e, t, r) {
196
+ if (q && !Array.isArray(e) && typeof e != "function" && !e.hasOwnProperty("type") && typeof e.type > "u") {
197
+ var n = Reflect.getMetadata("design:type", t, r);
198
+ n !== Object && (e.type = n);
199
+ }
200
+ }
201
+ function y(e) {
202
+ return e === void 0 && (e = {}), function(t, r) {
203
+ U(e, t, r), z(function(n, o) {
204
+ (n.props || (n.props = {}))[o] = e;
205
+ })(t, r);
206
+ };
207
+ }
208
+ let p = !1, f, h;
209
+ function W(e) {
210
+ if (p)
211
+ return Promise.resolve();
212
+ if (f && h !== e)
213
+ throw new Error("@tsparticles/vue2 init callback must be stable across the app lifecycle.");
214
+ return f || (h = e, f = Promise.resolve(e == null ? void 0 : e(P)).then(() => {
215
+ p = !0;
216
+ }).catch((t) => {
217
+ throw f = void 0, h = void 0, p = !1, t;
218
+ }), f);
219
+ }
220
+ function B() {
221
+ return f ?? Promise.resolve();
222
+ }
223
+ function G() {
224
+ return p;
225
+ }
226
+ var J = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, d = (e, t, r, n) => {
227
+ for (var o = n > 1 ? void 0 : n ? Q(t, r) : t, a = e.length - 1, s; a >= 0; a--)
228
+ (s = e[a]) && (o = (n ? s(t, r, o) : s(o)) || o);
229
+ return n && o && J(t, r, o), o;
230
+ };
231
+ async function X(e) {
232
+ if (!e.id)
233
+ throw new Error("Prop 'id' is required!");
234
+ if (await B(), !G())
235
+ throw new Error(
236
+ "@tsparticles/vue2 plugin initialization must be completed before rendering <VueParticles /> components."
237
+ );
238
+ const t = (n) => {
239
+ e.container = n, e.container && e.particlesLoaded && e.particlesLoaded(e.container);
240
+ }, r = await P.load({
241
+ id: e.id,
242
+ options: e.options ?? {},
243
+ url: e.url
244
+ });
245
+ t(r);
246
+ }
247
+ let u = class extends v {
248
+ mounted() {
249
+ this.$nextTick(() => {
250
+ X(this);
251
+ });
252
+ }
253
+ beforeDestroy() {
254
+ var e;
255
+ (e = this.container) == null || e.destroy();
256
+ }
257
+ };
258
+ d([
259
+ y({ required: !0 })
260
+ ], u.prototype, "id", 2);
261
+ d([
262
+ y()
263
+ ], u.prototype, "options", 2);
264
+ d([
265
+ y()
266
+ ], u.prototype, "url", 2);
267
+ d([
268
+ y()
269
+ ], u.prototype, "particlesLoaded", 2);
270
+ u = d([
271
+ M
272
+ ], u);
273
+ function Y(e, t, r, n, o, a, s, c) {
274
+ var i = typeof e == "function" ? e.options : e;
275
+ return t && (i.render = t, i.staticRenderFns = r, i._compiled = !0), {
276
+ exports: e,
277
+ options: i
278
+ };
279
+ }
280
+ var Z = function() {
281
+ var t = this, r = t._self._c;
282
+ return t._self._setupProxy, r("div", { attrs: { id: t.id } });
283
+ }, C = [], K = /* @__PURE__ */ Y(
284
+ u,
285
+ Z,
286
+ C
287
+ );
288
+ const O = K.exports, te = {
289
+ install: (e, t) => {
290
+ e.component("VueParticles", O), e.component("VueParticles", O), W(t == null ? void 0 : t.init);
291
+ }
292
+ };
293
+ export {
294
+ te as default
295
+ };
@@ -0,0 +1,5 @@
1
+ (function(f,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue"),require("@tsparticles/engine")):typeof define=="function"&&define.amd?define(["vue","@tsparticles/engine"],l):(f=typeof globalThis<"u"?globalThis:f||self,f["@tsparticles/vue2"]=l(f.Vue,f.tsParticles))})(this,(function(f,l){"use strict";/**
2
+ * vue-class-component v7.2.6
3
+ * (c) 2015-present Evan You
4
+ * @license MIT
5
+ */function v(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?v=function(t){return typeof t}:v=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(e)}function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R(e){return S(e)||A(e)||D()}function S(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}function A(e){if(Symbol.iterator in Object(e)||Object.prototype.toString.call(e)==="[object Arguments]")return Array.from(e)}function D(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function E(){return typeof Reflect<"u"&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function I(e,t){h(e,t),Object.getOwnPropertyNames(t.prototype).forEach(function(r){h(e.prototype,t.prototype,r)}),Object.getOwnPropertyNames(t).forEach(function(r){h(e,t,r)})}function h(e,t,r){var n=r?Reflect.getOwnMetadataKeys(t,r):Reflect.getOwnMetadataKeys(t);n.forEach(function(o){var i=r?Reflect.getOwnMetadata(o,t,r):Reflect.getOwnMetadata(o,t);r?Reflect.defineMetadata(o,i,e,r):Reflect.defineMetadata(o,i,e)})}var x={__proto__:[]},N=x instanceof Array;function T(e){return function(t,r,n){var o=typeof t=="function"?t:t.constructor;o.__decorators__||(o.__decorators__=[]),typeof n!="number"&&(n=void 0),o.__decorators__.push(function(i){return e(i,r,n)})}}function V(e){var t=v(e);return e==null||t!=="object"&&t!=="function"}function P(e){typeof console<"u"&&console.warn("[vue-class-component] "+e)}function z(e,t){var r=t.prototype._init;t.prototype._init=function(){var i=this,a=Object.getOwnPropertyNames(e);if(e.$options.props)for(var c in e.$options.props)e.hasOwnProperty(c)||a.push(c);a.forEach(function(s){Object.defineProperty(i,s,{get:function(){return e[s]},set:function(K){e[s]=K},configurable:!0})})};var n=new t;t.prototype._init=r;var o={};return Object.keys(n).forEach(function(i){n[i]!==void 0&&(o[i]=n[i])}),process.env.NODE_ENV!=="production"&&!(t.prototype instanceof f)&&Object.keys(o).length>0&&P("Component class must inherit Vue or its descendant class when class property is used."),o}var b=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function O(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t.name=t.name||e._componentTag||e.name;var r=e.prototype;Object.getOwnPropertyNames(r).forEach(function(c){if(c!=="constructor"){if(b.indexOf(c)>-1){t[c]=r[c];return}var s=Object.getOwnPropertyDescriptor(r,c);s.value!==void 0?typeof s.value=="function"?(t.methods||(t.methods={}))[c]=s.value:(t.mixins||(t.mixins=[])).push({data:function(){return j({},c,s.value)}}):(s.get||s.set)&&((t.computed||(t.computed={}))[c]={get:s.get,set:s.set})}}),(t.mixins||(t.mixins=[])).push({data:function(){return z(this,e)}});var n=e.__decorators__;n&&(n.forEach(function(c){return c(t)}),delete e.__decorators__);var o=Object.getPrototypeOf(e.prototype),i=o instanceof f?o.constructor:f,a=i.extend(t);return H(a,e,i),E()&&I(a,e),a}var F=["cid","super","options","superOptions","extendOptions","sealedOptions","component","directive","filter"],q={prototype:!0,arguments:!0,callee:!0,caller:!0};function H(e,t,r){Object.getOwnPropertyNames(t).forEach(function(n){if(!q[n]){var o=Object.getOwnPropertyDescriptor(e,n);if(!(o&&!o.configurable)){var i=Object.getOwnPropertyDescriptor(t,n);if(!N){if(n==="cid")return;var a=Object.getOwnPropertyDescriptor(r,n);if(!V(i.value)&&a&&a.value===i.value)return}process.env.NODE_ENV!=="production"&&F.indexOf(n)>=0&&P("Static property name '".concat(n,"' declared on class '").concat(t.name,"' ")+"conflicts with reserved property name of Vue internal. It may cause unexpected behavior of the component. Consider renaming the property."),Object.defineProperty(e,n,i)}}})}function m(e){return typeof e=="function"?O(e):function(t){return O(t,e)}}m.registerHooks=function(t){b.push.apply(b,R(t))};var $=typeof Reflect<"u"&&typeof Reflect.getMetadata<"u";function L(e,t,r){if($&&!Array.isArray(e)&&typeof e!="function"&&!e.hasOwnProperty("type")&&typeof e.type>"u"){var n=Reflect.getMetadata("design:type",t,r);n!==Object&&(e.type=n)}}function y(e){return e===void 0&&(e={}),function(t,r){L(e,t,r),T(function(n,o){(n.props||(n.props={}))[o]=e})(t,r)}}let _=!1,u,g;function U(e){if(_)return Promise.resolve();if(u&&g!==e)throw new Error("@tsparticles/vue2 init callback must be stable across the app lifecycle.");return u||(g=e,u=Promise.resolve(e==null?void 0:e(l.tsParticles)).then(()=>{_=!0}).catch(t=>{throw u=void 0,g=void 0,_=!1,t}),u)}function W(){return u??Promise.resolve()}function B(){return _}var G=Object.defineProperty,J=Object.getOwnPropertyDescriptor,p=(e,t,r,n)=>{for(var o=n>1?void 0:n?J(t,r):t,i=e.length-1,a;i>=0;i--)(a=e[i])&&(o=(n?a(t,r,o):a(o))||o);return n&&o&&G(t,r,o),o};async function Q(e){if(!e.id)throw new Error("Prop 'id' is required!");if(await W(),!B())throw new Error("@tsparticles/vue2 plugin initialization must be completed before rendering <VueParticles /> components.");const t=n=>{e.container=n,e.container&&e.particlesLoaded&&e.particlesLoaded(e.container)},r=await l.tsParticles.load({id:e.id,options:e.options??{},url:e.url});t(r)}let d=class extends f{mounted(){this.$nextTick(()=>{Q(this)})}beforeDestroy(){var e;(e=this.container)==null||e.destroy()}};p([y({required:!0})],d.prototype,"id",2),p([y()],d.prototype,"options",2),p([y()],d.prototype,"url",2),p([y()],d.prototype,"particlesLoaded",2),d=p([m],d);function X(e,t,r,n,o,i,a,c){var s=typeof e=="function"?e.options:e;return t&&(s.render=t,s.staticRenderFns=r,s._compiled=!0),{exports:e,options:s}}var Y=function(){var t=this,r=t._self._c;return t._self._setupProxy,r("div",{attrs:{id:t.id}})},Z=[],C=X(d,Y,Z);const w=C.exports;return{install:(e,t)=>{e.component("VueParticles",w),e.component("VueParticles",w),U(t==null?void 0:t.init)}}}));
package/package.json CHANGED
@@ -1,11 +1,26 @@
1
1
  {
2
2
  "name": "@tsparticles/vue2",
3
- "version": "3.0.0",
3
+ "version": "4.0.0-beta.15",
4
+ "main": "dist/vue2-particles.umd.js",
5
+ "module": "dist/vue2-particles.es.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/vue2-particles.es.js",
11
+ "require": "./dist/vue2-particles.umd.js",
12
+ "default": "./dist/vue2-particles.umd.js"
13
+ }
14
+ },
4
15
  "description": "Official tsParticles Vue.js 2.x Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for Web Components, React, Vue.js 3.x, Angular, Svelte, jQuery, Preact, Riot.js, Solid.js, Inferno.",
5
16
  "scripts": {
6
17
  "clean": "rm -rf dist/*",
7
- "build": "npm run clean && pnpm run prettify:src && pnpm run prettify:readme && rollup -c",
8
- "build:ci": "npm run clean && pnpm run prettify:ci:src && pnpm run prettify:ci:readme && rollup -c",
18
+ "dev": "vite",
19
+ "build": "pnpm run clean && pnpm run prettify:src && pnpm run prettify:readme && vite build",
20
+ "build:ci": "pnpm run clean && pnpm run prettify:ci:src && pnpm run prettify:ci:readme && vite build",
21
+ "preview": "vite preview --port 5050",
22
+ "typecheck": "vue-tsc --noEmit",
23
+ "lint": "eslint . --fix",
9
24
  "prettify:ci:src": "prettier --check ./src/*",
10
25
  "prettify:ci:readme": "prettier --check ./README.md",
11
26
  "prettify:src": "prettier --write ./src/*",
@@ -65,19 +80,18 @@
65
80
  "fireworksjs",
66
81
  "canvas-confetti"
67
82
  ],
68
- "main": "dist/vue2-particles.js",
69
- "module": "dist/vue2-particles.js",
70
- "unpkg": "dist/vue2-particles.min.js",
71
- "jsdelivr": "dist/vue2-particles.min.js",
83
+ "unpkg": "dist/vue2-particles.umd.js",
84
+ "jsdelivr": "dist/vue2-particles.umd.js",
72
85
  "repository": {
73
- "url": "https://github.com/tsparticles/vue2",
86
+ "url": "https://github.com/tsparticles/tsparticles.git",
74
87
  "type": "git",
75
- "directory": "components/vue2"
88
+ "directory": "wrappers/vue2"
76
89
  },
77
90
  "author": "Matteo Bruni <matteo.bruni@me.com>",
78
91
  "license": "MIT",
79
92
  "files": [
80
- "dist"
93
+ "dist",
94
+ "README.md"
81
95
  ],
82
96
  "bugs": {
83
97
  "url": "https://github.com/tsparticles/vue2/issues"
@@ -99,41 +113,33 @@
99
113
  ],
100
114
  "prettier": "@tsparticles/prettier-config",
101
115
  "peerDependencies": {
102
- "vue": "<3"
116
+ "vue": "^2.7.0"
103
117
  },
104
118
  "publishConfig": {
105
119
  "access": "public"
106
120
  },
107
121
  "dependencies": {
108
- "@tsparticles/engine": "^3.0.2",
109
- "vue-class-component": "^7.2.6",
110
- "vue-property-decorator": "^9.1.2"
122
+ "@tsparticles/engine": "^4.0.0-beta.15"
111
123
  },
112
124
  "devDependencies": {
113
- "@babel/core": "^7.22.19",
114
- "@babel/plugin-proposal-class-properties": "^7.18.6",
115
- "@babel/plugin-proposal-decorators": "^7.22.15",
116
- "@rollup/plugin-node-resolve": "^15.2.1",
117
- "@rollup/plugin-replace": "^5.0.2",
118
- "@tsparticles/prettier-config": "^1.12.0",
119
- "@vue/cli-plugin-babel": "~5.0.8",
120
- "@vue/cli-plugin-typescript": "~5.0.8",
121
- "@vue/cli-service": "~5.0.8",
122
- "is-svg": "^5.0.0",
123
- "postcss": "^8.4.29",
124
- "prettier": "^3.0.3",
125
- "pug": "^3.0.2",
126
- "rollup": "^2.79.1",
127
- "rollup-plugin-terser": "^7.0.2",
128
- "rollup-plugin-typescript": "^1.0.1",
129
- "rollup-plugin-typescript2": "^0.35.0",
130
- "rollup-plugin-vue": "^5.1.9",
131
- "ssri": "^10.0.5",
132
- "tslib": "^2.6.2",
133
- "typescript": "^5.2.2",
134
- "vue": "^2.7.14",
135
- "vue-loader": "^15.10.2",
136
- "vue-template-compiler": "^2.7.14"
125
+ "@eslint/js": "^10.0.1",
126
+ "@tsparticles/prettier-config": "^4.0.0-beta.15",
127
+ "@types/node": "^25.6.0",
128
+ "@typescript-eslint/parser": "^8.58.1",
129
+ "@vitejs/plugin-vue2": "^2.3.4",
130
+ "eslint": "^10.2.0",
131
+ "eslint-plugin-vue": "^10.8.0",
132
+ "globals": "^17.5.0",
133
+ "prettier": "^3.8.2",
134
+ "typescript": "^6.0.2",
135
+ "vite": "^6.4.1",
136
+ "vite-plugin-dts": "^4.5.4",
137
+ "vue": "^2.7.16",
138
+ "vue-class-component": "^7.2.6",
139
+ "vue-eslint-parser": "^10.4.0",
140
+ "vue-property-decorator": "^9.1.2",
141
+ "vue-template-compiler": "^2.7.16",
142
+ "vue-tsc": "^3.2.6"
137
143
  },
138
- "gitHead": "4329892fd535c7e35dc3123ca60d8d936f630776"
144
+ "gitHead": "1dfc9e1e6e39eb5c9a6e0495130ca9eac515d707"
139
145
  }
@@ -1,230 +0,0 @@
1
- import { Prop, Component } from 'vue-property-decorator';
2
- import { tsParticles } from '@tsparticles/engine';
3
- import Vue from 'vue';
4
-
5
- /******************************************************************************
6
- Copyright (c) Microsoft Corporation.
7
-
8
- Permission to use, copy, modify, and/or distribute this software for any
9
- purpose with or without fee is hereby granted.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
- PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */
19
-
20
- function __decorate(decorators, target, key, desc) {
21
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
23
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
24
- return c > 3 && r && Object.defineProperty(target, key, r), r;
25
- }
26
-
27
- function __awaiter(thisArg, _arguments, P, generator) {
28
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
29
- return new (P || (P = Promise))(function (resolve, reject) {
30
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
31
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
32
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
- step((generator = generator.apply(thisArg, _arguments || [])).next());
34
- });
35
- }
36
-
37
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
38
- var e = new Error(message);
39
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
40
- };
41
-
42
- const eventBus = new Vue();
43
-
44
- function particlesInit(component) {
45
- var _a;
46
- return __awaiter(this, void 0, void 0, function* () {
47
- if (!component.id) {
48
- throw new Error("Prop 'id' is required!");
49
- }
50
- const cb = (container) => {
51
- component.container = container;
52
- if (component.container && component.particlesLoaded) {
53
- component.particlesLoaded(component.container);
54
- }
55
- };
56
- const container = yield tsParticles.load({
57
- id: component.id,
58
- options: (_a = component.options) !== null && _a !== void 0 ? _a : {},
59
- url: component.url,
60
- });
61
- cb(container);
62
- });
63
- }
64
- let Particles = class Particles extends Vue {
65
- constructor() {
66
- super(...arguments);
67
- this.initHandler = () => __awaiter(this, void 0, void 0, function* () {
68
- yield particlesInit(this);
69
- });
70
- }
71
- created() {
72
- eventBus.$on("particles-init", this.initHandler);
73
- }
74
- mounted() {
75
- this.$nextTick(() => {
76
- particlesInit(this);
77
- });
78
- }
79
- beforeDestroy() {
80
- var _a;
81
- (_a = this.container) === null || _a === void 0 ? void 0 : _a.destroy();
82
- eventBus.$off("particles-init", this.initHandler);
83
- }
84
- };
85
- __decorate([
86
- Prop({ required: true })
87
- ], Particles.prototype, "id", void 0);
88
- __decorate([
89
- Prop()
90
- ], Particles.prototype, "options", void 0);
91
- __decorate([
92
- Prop()
93
- ], Particles.prototype, "url", void 0);
94
- __decorate([
95
- Prop()
96
- ], Particles.prototype, "particlesLoaded", void 0);
97
- Particles = __decorate([
98
- Component
99
- ], Particles);
100
- var script = Particles;
101
-
102
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
103
- if (typeof shadowMode !== 'boolean') {
104
- createInjectorSSR = createInjector;
105
- createInjector = shadowMode;
106
- shadowMode = false;
107
- }
108
- // Vue.extend constructor export interop.
109
- const options = typeof script === 'function' ? script.options : script;
110
- // render functions
111
- if (template && template.render) {
112
- options.render = template.render;
113
- options.staticRenderFns = template.staticRenderFns;
114
- options._compiled = true;
115
- // functional template
116
- if (isFunctionalTemplate) {
117
- options.functional = true;
118
- }
119
- }
120
- // scopedId
121
- if (scopeId) {
122
- options._scopeId = scopeId;
123
- }
124
- let hook;
125
- if (moduleIdentifier) {
126
- // server build
127
- hook = function (context) {
128
- // 2.3 injection
129
- context =
130
- context || // cached call
131
- (this.$vnode && this.$vnode.ssrContext) || // stateful
132
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
133
- // 2.2 with runInNewContext: true
134
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
135
- context = __VUE_SSR_CONTEXT__;
136
- }
137
- // inject component styles
138
- if (style) {
139
- style.call(this, createInjectorSSR(context));
140
- }
141
- // register component module identifier for async chunk inference
142
- if (context && context._registeredComponents) {
143
- context._registeredComponents.add(moduleIdentifier);
144
- }
145
- };
146
- // used by ssr in case component is cached and beforeCreate
147
- // never gets called
148
- options._ssrRegister = hook;
149
- }
150
- else if (style) {
151
- hook = shadowMode
152
- ? function (context) {
153
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
154
- }
155
- : function (context) {
156
- style.call(this, createInjector(context));
157
- };
158
- }
159
- if (hook) {
160
- if (options.functional) {
161
- // register for functional component in vue file
162
- const originalRender = options.render;
163
- options.render = function renderWithStyleInjection(h, context) {
164
- hook.call(context);
165
- return originalRender(h, context);
166
- };
167
- }
168
- else {
169
- // inject component registration as beforeCreate hook
170
- const existing = options.beforeCreate;
171
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
172
- }
173
- }
174
- return script;
175
- }
176
-
177
- /* script */
178
- const __vue_script__ = script;
179
-
180
- /* template */
181
- var __vue_render__ = function () {
182
- var _vm = this;
183
- var _h = _vm.$createElement;
184
- var _c = _vm._self._c || _h;
185
- return _c("div", { attrs: { id: _vm.id } })
186
- };
187
- var __vue_staticRenderFns__ = [];
188
- __vue_render__._withStripped = true;
189
-
190
- /* style */
191
- const __vue_inject_styles__ = undefined;
192
- /* scoped */
193
- const __vue_scope_id__ = undefined;
194
- /* module identifier */
195
- const __vue_module_identifier__ = undefined;
196
- /* functional template */
197
- const __vue_is_functional_template__ = false;
198
- /* style inject */
199
-
200
- /* style inject SSR */
201
-
202
- /* style inject shadow dom */
203
-
204
-
205
-
206
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
207
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
208
- __vue_inject_styles__,
209
- __vue_script__,
210
- __vue_scope_id__,
211
- __vue_is_functional_template__,
212
- __vue_module_identifier__,
213
- false,
214
- undefined,
215
- undefined,
216
- undefined
217
- );
218
-
219
- const VueParticles = {
220
- install: (vue, options) => {
221
- vue.component("vue-particles", __vue_component__);
222
- if (options && options.init) {
223
- options.init(tsParticles).then(() => {
224
- eventBus.$emit("particles-init");
225
- });
226
- }
227
- },
228
- };
229
-
230
- export { __vue_component__ as ParticlesComponent, VueParticles as default };
@@ -1 +0,0 @@
1
- import{Prop as e,Component as t}from"vue-property-decorator";import{tsParticles as n}from"@tsparticles/engine";import o from"vue";function i(e,t,n,o){var i,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(s=(r<3?i(s):r>3?i(t,n,s):i(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}function r(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function d(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,d)}c((o=o.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const s=new o;function d(e){var t;return r(this,void 0,void 0,(function*(){if(!e.id)throw new Error("Prop 'id' is required!");(t=>{e.container=t,e.container&&e.particlesLoaded&&e.particlesLoaded(e.container)})(yield n.load({id:e.id,options:null!==(t=e.options)&&void 0!==t?t:{},url:e.url}))}))}let c=class extends o{constructor(){super(...arguments),this.initHandler=()=>r(this,void 0,void 0,(function*(){yield d(this)}))}created(){s.$on("particles-init",this.initHandler)}mounted(){this.$nextTick((()=>{d(this)}))}beforeDestroy(){var e;null===(e=this.container)||void 0===e||e.destroy(),s.$off("particles-init",this.initHandler)}};function a(e,t,n,o,i,r,s,d,c,a){"boolean"!=typeof s&&(c=d,d=s,s=!1);const l="function"==typeof n?n.options:n;let p;if(e&&e.render&&(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),o&&(l._scopeId=o),r?(p=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,c(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},l._ssrRegister=p):t&&(p=s?function(e){t.call(this,a(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,d(e))}),p)if(l.functional){const e=l.render;l.render=function(t,n){return p.call(n),e(t,n)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,p):[p]}return n}i([e({required:!0})],c.prototype,"id",void 0),i([e()],c.prototype,"options",void 0),i([e()],c.prototype,"url",void 0),i([e()],c.prototype,"particlesLoaded",void 0),c=i([t],c);const l=c;var p=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{attrs:{id:e.id}})};p._withStripped=!0;const f=a({render:p,staticRenderFns:[]},undefined,l,undefined,false,undefined,!1,void 0,void 0,void 0),u={install:(e,t)=>{e.component("vue-particles",f),t&&t.init&&t.init(n).then((()=>{s.$emit("particles-init")}))}};export{f as ParticlesComponent,u as default};