@tsparticles/vue3 3.0.0

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/.eslintrc.cjs ADDED
@@ -0,0 +1,15 @@
1
+ /* eslint-env node */
2
+ require("@rushstack/eslint-patch/modern-module-resolution");
3
+
4
+ module.exports = {
5
+ root: true,
6
+ extends: [
7
+ "plugin:vue/vue3-essential",
8
+ "eslint:recommended",
9
+ "@vue/eslint-config-typescript/recommended",
10
+ "@vue/eslint-config-prettier",
11
+ ],
12
+ env: {
13
+ "vue/setup-compiler-macros": true,
14
+ },
15
+ };
package/CHANGELOG.md ADDED
@@ -0,0 +1,183 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [3.0.0](https://github.com/tsparticles/vue3/compare/v2.12.0...v3.0.0) (2023-12-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * use event syntax for particlesLoaded ([5b4de3a](https://github.com/tsparticles/vue3/commit/5b4de3a411ede58c00517cf72fbab5bd5acfb882))
12
+
13
+
14
+ ### Features
15
+
16
+ * updated for v3 ([c49ca9f](https://github.com/tsparticles/vue3/commit/c49ca9f1aec1f7ddaa0de7806291a5c4c78eb848))
17
+ * updates for v3 ([c62d3d3](https://github.com/tsparticles/vue3/commit/c62d3d30dfcc5307490fb15f2ed132b36036f252))
18
+
19
+
20
+
21
+
22
+
23
+ # [2.12.0](https://github.com/tsparticles/vue3/compare/v2.11.1...v2.12.0) (2023-08-04)
24
+
25
+ **Note:** Version bump only for package vue3-particles
26
+
27
+
28
+
29
+
30
+
31
+ ## [2.11.1](https://github.com/tsparticles/vue3/compare/v2.11.0...v2.11.1) (2023-07-27)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * fixed issue with engine not loading correctly, closes: [#26](https://github.com/tsparticles/vue3/issues/26) ([94e5215](https://github.com/tsparticles/vue3/commit/94e521546b7ed008d7b980e999ca30d0ce3d49db))
37
+
38
+
39
+
40
+
41
+
42
+ # [2.11.0](https://github.com/tsparticles/vue3/compare/v2.10.1...v2.11.0) (2023-07-14)
43
+
44
+ **Note:** Version bump only for package vue3-particles
45
+
46
+
47
+
48
+
49
+
50
+ ## 2.10.1 (2023-06-04)
51
+
52
+
53
+ ### Features
54
+
55
+ * adding vue-particles tag ([8b12d56](https://github.com/tsparticles/vue3/commit/8b12d5654515d52729ea7902f5e16806ddd48422))
56
+
57
+
58
+
59
+
60
+
61
+ ## [2.9.3](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.9.2...vue3-particles@2.9.3) (2023-02-12)
62
+
63
+ **Note:** Version bump only for package vue3-particles
64
+
65
+ ## [2.9.2](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.9.1...vue3-particles@2.9.2) (2023-02-12)
66
+
67
+ **Note:** Version bump only for package vue3-particles
68
+
69
+ ## [2.9.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.9.0...vue3-particles@2.9.1) (2023-02-11)
70
+
71
+ **Note:** Version bump only for package vue3-particles
72
+
73
+ # [2.9.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.8.0...vue3-particles@2.9.0) (2023-02-10)
74
+
75
+ **Note:** Version bump only for package vue3-particles
76
+
77
+ # [2.8.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.7.1...vue3-particles@2.8.0) (2023-01-18)
78
+
79
+ **Note:** Version bump only for package vue3-particles
80
+
81
+ ## [2.7.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.7.0...vue3-particles@2.7.1) (2022-12-25)
82
+
83
+ **Note:** Version bump only for package vue3-particles
84
+
85
+ # [2.7.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.6.0...vue3-particles@2.7.0) (2022-12-23)
86
+
87
+ **Note:** Version bump only for package vue3-particles
88
+
89
+ # [2.6.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.5.3...vue3-particles@2.6.0) (2022-12-06)
90
+
91
+ **Note:** Version bump only for package vue3-particles
92
+
93
+ ## [2.5.3](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.5.2...vue3-particles@2.5.3) (2022-11-07)
94
+
95
+ **Note:** Version bump only for package vue3-particles
96
+
97
+ ## [2.5.2](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.5.1...vue3-particles@2.5.2) (2022-11-07)
98
+
99
+ **Note:** Version bump only for package vue3-particles
100
+
101
+ ## [2.5.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.5.0...vue3-particles@2.5.1) (2022-11-03)
102
+
103
+ **Note:** Version bump only for package vue3-particles
104
+
105
+ # [2.5.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.4.0...vue3-particles@2.5.0) (2022-11-02)
106
+
107
+ **Note:** Version bump only for package vue3-particles
108
+
109
+ # [2.4.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.3.3...vue3-particles@2.4.0) (2022-10-30)
110
+
111
+ **Note:** Version bump only for package vue3-particles
112
+
113
+ ## [2.3.3](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.3.2...vue3-particles@2.3.3) (2022-09-30)
114
+
115
+ **Note:** Version bump only for package vue3-particles
116
+
117
+ ## [2.3.2](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.3.1...vue3-particles@2.3.2) (2022-09-21)
118
+
119
+ **Note:** Version bump only for package vue3-particles
120
+
121
+ ## [2.3.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.3.0...vue3-particles@2.3.1) (2022-09-13)
122
+
123
+ **Note:** Version bump only for package vue3-particles
124
+
125
+ # [2.3.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.2.4...vue3-particles@2.3.0) (2022-09-11)
126
+
127
+ **Note:** Version bump only for package vue3-particles
128
+
129
+ ## [2.2.4](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.2.2...vue3-particles@2.2.4) (2022-08-26)
130
+
131
+ **Note:** Version bump only for package vue3-particles
132
+
133
+ ## [2.2.3](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.2.2...vue3-particles@2.2.3) (2022-08-21)
134
+
135
+ **Note:** Version bump only for package vue3-particles
136
+
137
+ ## [2.2.2](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.2.1...vue3-particles@2.2.2) (2022-08-16)
138
+
139
+ ### Bug Fixes
140
+
141
+ - fixed double mouse events on mobile using pointer events, closes [#4622](https://github.com/matteobruni/tsparticles/issues/4622) ([1019fa4](https://github.com/matteobruni/tsparticles/commit/1019fa431f8a43cbd45d6adeb5adf94433e6e04b))
142
+
143
+ ## [2.2.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.2.0...vue3-particles@2.2.1) (2022-08-12)
144
+
145
+ **Note:** Version bump only for package vue3-particles
146
+
147
+ # [2.2.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.1.4...vue3-particles@2.2.0) (2022-08-11)
148
+
149
+ ### Bug Fixes
150
+
151
+ - **deps:** update capacitor monorepo to v4 ([a63d3a0](https://github.com/matteobruni/tsparticles/commit/a63d3a005ff47dd38ca7924b29267f4796ffebdb))
152
+ - **deps:** update dependency riot to v7 ([116fa3f](https://github.com/matteobruni/tsparticles/commit/116fa3f0808bb8e1e3df767513ebcb82c2f9e0e5))
153
+ - fixed correctly both [#4031](https://github.com/matteobruni/tsparticles/issues/4031) and [#4385](https://github.com/matteobruni/tsparticles/issues/4385) ([6b57b69](https://github.com/matteobruni/tsparticles/commit/6b57b69585f931478118bd466dcdce9bbc90fa79))
154
+
155
+ ## [2.1.4](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.1.3...vue3-particles@2.1.4) (2022-07-28)
156
+
157
+ ### Bug Fixes
158
+
159
+ - fixed issue with destroyed containers, fixes [#4385](https://github.com/matteobruni/tsparticles/issues/4385), fixes [#4413](https://github.com/matteobruni/tsparticles/issues/4413), fixes [#4534](https://github.com/matteobruni/tsparticles/issues/4534) ([4d22425](https://github.com/matteobruni/tsparticles/commit/4d22425210f64b937a5d1b7bf825624b3ed5f2b6)), closes [#4532](https://github.com/matteobruni/tsparticles/issues/4532)
160
+
161
+ ### Features
162
+
163
+ - preparing react-particles and switching alternate packages ([49e749e](https://github.com/matteobruni/tsparticles/commit/49e749e90e076f0cb22eefe0f3399102f5b9fb35))
164
+
165
+ ## [2.1.3](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.1.2...vue3-particles@2.1.3) (2022-07-01)
166
+
167
+ **Note:** Version bump only for package vue3-particles
168
+
169
+ ## [2.1.2](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.1.1...vue3-particles@2.1.2) (2022-07-01)
170
+
171
+ **Note:** Version bump only for package vue3-particles
172
+
173
+ ## [2.1.1](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.1.0...vue3-particles@2.1.1) (2022-07-01)
174
+
175
+ **Note:** Version bump only for package vue3-particles
176
+
177
+ # [2.1.0](https://github.com/matteobruni/tsparticles/compare/vue3-particles@2.0.6...vue3-particles@2.1.0) (2022-06-18)
178
+
179
+ ### Bug Fixes
180
+
181
+ - **deps:** update dependency @capacitor/core to v3.5.0 ([581bb7e](https://github.com/matteobruni/tsparticles/commit/581bb7e2f4f6aceb3535daf9223954a80f2daa81))
182
+ - **deps:** update react monorepo to v18.1.0 ([6b45793](https://github.com/matteobruni/tsparticles/commit/6b457937c41d7681a2135dfcb6ff220e578f22bb))
183
+ - fixed connect links options ([5eb3186](https://github.com/matteobruni/tsparticles/commit/5eb31866b3a9fe1328969c254f2fff0be995b1f5))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Matteo Bruni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # @tsparticles/vue3
4
+
5
+ [![npm](https://img.shields.io/npm/v/@tsparticles/vue3)](https://www.npmjs.com/package/@tsparticles/vue3) [![npm](https://img.shields.io/npm/dm/@tsparticles/vue3)](https://www.npmjs.com/package/@tsparticles/vue3) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ Official [tsParticles](https://github.com/matteobruni/tsparticles) VueJS 3.x component
8
+
9
+ [![Slack](https://particles.js.org/images/slack.png)](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [![Discord](https://particles.js.org/images/discord.png)](https://discord.gg/hACwv45Hme) [![Telegram](https://particles.js.org/images/telegram.png)](https://t.me/tsparticles)
10
+
11
+ [![tsParticles Product Hunt](https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=186113&theme=light)](https://www.producthunt.com/posts/tsparticles?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-tsparticles") <a href="https://www.buymeacoffee.com/matteobruni"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a beer&emoji=🍺&slug=matteobruni&button_colour=5F7FFF&font_colour=ffffff&font_family=Arial&outline_colour=000000&coffee_colour=FFDD00"></a>
12
+
13
+ ## Installation
14
+
15
+ ```shell script
16
+ yarn add @tsparticles/vue3
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```javascript
22
+ import Particles from "@tsparticles/vue3";
23
+ //import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
24
+ import { loadSlim } from "tsparticles-slim"; // if you are going to use `loadSlim`, install the "tsparticles-slim" package too.
25
+
26
+ createApp(App).use(Particles, {
27
+ init: async engine => {
28
+ // await loadFull(engine); // you can load the full tsParticles library from "tsparticles" if you need it
29
+ await loadSlim(engine); // or you can load the slim version from "tsparticles-slim" if don't need Shapes or Animations
30
+ },
31
+ });
32
+ ```
33
+
34
+ ### Demo config
35
+
36
+ ```html
37
+ <template>
38
+ <div id="app">
39
+ <vue-particles id="tsparticles" :particlesLoaded="particlesLoaded" url="http://foo.bar/particles.json" />
40
+
41
+ <vue-particles
42
+ id="tsparticles"
43
+ :particlesLoaded="particlesLoaded"
44
+ :options="{
45
+ background: {
46
+ color: {
47
+ value: '#0d47a1'
48
+ }
49
+ },
50
+ fpsLimit: 120,
51
+ interactivity: {
52
+ events: {
53
+ onClick: {
54
+ enable: true,
55
+ mode: 'push'
56
+ },
57
+ onHover: {
58
+ enable: true,
59
+ mode: 'repulse'
60
+ },
61
+ },
62
+ modes: {
63
+ bubble: {
64
+ distance: 400,
65
+ duration: 2,
66
+ opacity: 0.8,
67
+ size: 40
68
+ },
69
+ push: {
70
+ quantity: 4
71
+ },
72
+ repulse: {
73
+ distance: 200,
74
+ duration: 0.4
75
+ }
76
+ }
77
+ },
78
+ particles: {
79
+ color: {
80
+ value: '#ffffff'
81
+ },
82
+ links: {
83
+ color: '#ffffff',
84
+ distance: 150,
85
+ enable: true,
86
+ opacity: 0.5,
87
+ width: 1
88
+ },
89
+ move: {
90
+ direction: 'none',
91
+ enable: true,
92
+ outModes: 'bounce',
93
+ random: false,
94
+ speed: 6,
95
+ straight: false
96
+ },
97
+ number: {
98
+ density: {
99
+ enable: true,
100
+ },
101
+ value: 80
102
+ },
103
+ opacity: {
104
+ value: 0.5
105
+ },
106
+ shape: {
107
+ type: 'circle'
108
+ },
109
+ size: {
110
+ value: { min: 1, max: 5 }
111
+ }
112
+ },
113
+ detectRetina: true
114
+ }"
115
+ />
116
+ </div>
117
+ </template>
118
+ ```
119
+
120
+ ```javascript
121
+ const particlesLoaded = async container => {
122
+ console.log("Particles container loaded", container);
123
+ };
124
+ ```
125
+
126
+ ### TypeScript errors
127
+
128
+ If TypeScript returns error while importing/using Particles plugin try adding the following import before the previous
129
+ code:
130
+
131
+ ```typescript
132
+ declare module "@tsparticles/vue3";
133
+ ```
134
+
135
+ ## Demos
136
+
137
+ The demo website is [here](https://particles.js.org)
138
+
139
+ <https://particles.js.org>
140
+
141
+ There's also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage)
142
+
143
+ <https://codepen.io/collection/DPOage>
144
+
145
+ ## Migrating from Vue 2.x to Vue 3.x
146
+
147
+ If you are migrating your project from Vue 2.x to 3.x you need to these steps:
148
+
149
+ - Change the dependency from `@tsparticles/vue2` to `@tsparticles/vue3`
150
+ - Update the `node_modules` folder executing `npm install` or `yarn`
151
+ - Change the `use` function from `Vue.use(Particles, { init: /* omissis */ })`
152
+ to `createApp(App).use(Particles, { init: /* omissis */ })`.
153
+
154
+ The `<vue-particles />` tag syntax remains the same, so you don't need to do any additional action.
@@ -0,0 +1,6 @@
1
+ import type { App } from "vue";
2
+ import { type Engine } from "@tsparticles/engine";
3
+ declare const VueParticles: (app: App, options: {
4
+ init: (engine: Engine) => Promise<void>;
5
+ }) => void;
6
+ export default VueParticles;
@@ -0,0 +1,39 @@
1
+ import { defineComponent as l, onMounted as p, nextTick as u, onUnmounted as m, openBlock as f, createElementBlock as v } from "vue";
2
+ import { tsParticles as o } from "@tsparticles/engine";
3
+ const _ = ["id"], w = /* @__PURE__ */ l({
4
+ __name: "vue-particles",
5
+ props: {
6
+ id: {},
7
+ options: {},
8
+ url: {}
9
+ },
10
+ emits: ["particlesLoaded"],
11
+ setup(r, { emit: e }) {
12
+ let t, i;
13
+ const n = r, c = e;
14
+ addEventListener("particlesInit", (s) => {
15
+ i = s.detail, a();
16
+ });
17
+ const a = async () => {
18
+ i || (i = o), t = await i.load({
19
+ id: n.id,
20
+ url: n.url,
21
+ options: n.options
22
+ }), c("particlesLoaded", t);
23
+ };
24
+ return p(() => {
25
+ u(() => {
26
+ if (!n.id)
27
+ throw new Error("Prop 'id' is required!");
28
+ a();
29
+ });
30
+ }), m(() => {
31
+ t && (t.destroy(), t = void 0);
32
+ }), (s, d) => (f(), v("div", { id: s.id }, null, 8, _));
33
+ }
34
+ }), P = (r, e) => {
35
+ r.component("vue-particles", w), (async () => (o.init(), e.init && await e.init(o), dispatchEvent(new CustomEvent("particlesInit", { detail: o }))))();
36
+ };
37
+ export {
38
+ P as default
39
+ };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue"),require("@tsparticles/engine")):typeof define=="function"&&define.amd?define(["vue","@tsparticles/engine"],t):(e=typeof globalThis<"u"?globalThis:e||self,e["@tsparticles/vue3"]=t(e.Vue,e.tsParticles))})(this,function(e,t){"use strict";const a=["id"],l=e.defineComponent({__name:"vue-particles",props:{id:{},options:{},url:{}},emits:["particlesLoaded"],setup(o,{emit:n}){let i,s;const r=o,p=n;addEventListener("particlesInit",c=>{s=c.detail,d()});const d=async()=>{s||(s=t.tsParticles),i=await s.load({id:r.id,url:r.url,options:r.options}),p("particlesLoaded",i)};return e.onMounted(()=>{e.nextTick(()=>{if(!r.id)throw new Error("Prop 'id' is required!");d()})}),e.onUnmounted(()=>{i&&(i.destroy(),i=void 0)}),(c,u)=>(e.openBlock(),e.createElementBlock("div",{id:c.id},null,8,a))}});return(o,n)=>{o.component("vue-particles",l),(async()=>(t.tsParticles.init(),n.init&&await n.init(t.tsParticles),dispatchEvent(new CustomEvent("particlesInit",{detail:t.tsParticles}))))()}});
@@ -0,0 +1,25 @@
1
+ import { type Container, type ISourceOptions } from "@tsparticles/engine";
2
+ export type IParticlesProps = ISourceOptions;
3
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
+ id: string;
5
+ options?: import("@tsparticles/engine").RecursivePartial<import("@tsparticles/engine").IOptions> | undefined;
6
+ url?: string | undefined;
7
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ particlesLoaded: (container?: Container | undefined) => void;
9
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
10
+ id: string;
11
+ options?: import("@tsparticles/engine").RecursivePartial<import("@tsparticles/engine").IOptions> | undefined;
12
+ url?: string | undefined;
13
+ }>>> & {
14
+ onParticlesLoaded?: ((container?: Container | undefined) => any) | undefined;
15
+ }, {}, {}>;
16
+ export default _default;
17
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
+ type __VLS_TypePropsToRuntimeProps<T> = {
19
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
20
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
+ } : {
22
+ type: import('vue').PropType<T[K]>;
23
+ required: true;
24
+ };
25
+ };
package/package.json ADDED
@@ -0,0 +1,127 @@
1
+ {
2
+ "name": "@tsparticles/vue3",
3
+ "version": "3.0.0",
4
+ "description": "Official tsParticles Vue.js 3.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 2.x, Angular, Svelte, jQuery, Preact, Riot.js, Solid.js, Inferno.",
5
+ "keywords": [
6
+ "front-end",
7
+ "frontend",
8
+ "tsparticles",
9
+ "particles.js",
10
+ "particlesjs",
11
+ "particles",
12
+ "particle",
13
+ "canvas",
14
+ "jsparticles",
15
+ "xparticles",
16
+ "particles-js",
17
+ "particles-bg",
18
+ "particles-bg-vue",
19
+ "particles-ts",
20
+ "particles.ts",
21
+ "react-particles-js",
22
+ "react-particles.js",
23
+ "react-particles",
24
+ "react",
25
+ "reactjs",
26
+ "vue-particles",
27
+ "ngx-particles",
28
+ "angular-particles",
29
+ "particleground",
30
+ "vue",
31
+ "vuejs",
32
+ "preact",
33
+ "preactjs",
34
+ "jquery",
35
+ "angularjs",
36
+ "angular",
37
+ "typescript",
38
+ "javascript",
39
+ "animation",
40
+ "web",
41
+ "html5",
42
+ "web-design",
43
+ "webdesign",
44
+ "css",
45
+ "html",
46
+ "css3",
47
+ "animated",
48
+ "background",
49
+ "confetti",
50
+ "canvas",
51
+ "fireworks",
52
+ "fireworks-js",
53
+ "confetti-js",
54
+ "confettijs",
55
+ "fireworksjs",
56
+ "canvas-confetti"
57
+ ],
58
+ "scripts": {
59
+ "dev": "vite",
60
+ "build": "pnpm run prettify:src && pnpm run prettify:readme && vue-tsc --noEmit && vite build",
61
+ "build:ci": "pnpm run prettify:ci:src && pnpm run prettify:ci:readme && vue-tsc --noEmit && vite build",
62
+ "prettify:ci:src": "prettier --check ./src/*",
63
+ "prettify:ci:readme": "prettier --check ./README.md",
64
+ "prettify:src": "prettier --write ./src/*",
65
+ "prettify:readme": "prettier --write ./README.md",
66
+ "preview": "vite preview --port 5050",
67
+ "typecheck": "vue-tsc --noEmit",
68
+ "lint": "echo eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
69
+ },
70
+ "repository": {
71
+ "url": "https://github.com/tsparticles/vue3",
72
+ "type": "git",
73
+ "directory": "components/vue3"
74
+ },
75
+ "author": "Matteo Bruni <matteo.bruni@me.com>",
76
+ "license": "MIT",
77
+ "bugs": {
78
+ "url": "https://github.com/tsparticles/vue3/issues"
79
+ },
80
+ "homepage": "https://particles.js.org",
81
+ "funding": [
82
+ {
83
+ "type": "github",
84
+ "url": "https://github.com/sponsors/matteobruni"
85
+ },
86
+ {
87
+ "type": "github",
88
+ "url": "https://github.com/sponsors/tsparticles"
89
+ },
90
+ {
91
+ "type": "buymeacoffee",
92
+ "url": "https://www.buymeacoffee.com/matteobruni"
93
+ }
94
+ ],
95
+ "prettier": "@tsparticles/prettier-config",
96
+ "publishConfig": {
97
+ "access": "public"
98
+ },
99
+ "dependencies": {
100
+ "@tsparticles/engine": "^3.0.2",
101
+ "vue": "^3.3.13"
102
+ },
103
+ "devDependencies": {
104
+ "@rushstack/eslint-patch": "^1.6.1",
105
+ "@tsconfig/node18": "^18.2.2",
106
+ "@tsparticles/prettier-config": "^2.0.1",
107
+ "@types/node": "^20.10.5",
108
+ "@vitejs/plugin-vue": "^4.5.2",
109
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
110
+ "@vue/eslint-config-prettier": "^8.0.0",
111
+ "@vue/eslint-config-typescript": "^12.0.0",
112
+ "@vue/tsconfig": "^0.4.0",
113
+ "eslint": "^8.56.0",
114
+ "eslint-plugin-vue": "^9.19.2",
115
+ "prettier": "^3.1.1",
116
+ "typescript": "^5.3.3",
117
+ "vite": "^5.0.10",
118
+ "vite-plugin-dts": "^3.6.4",
119
+ "vue-tsc": "^1.8.26"
120
+ },
121
+ "main": "dist/particles.umd.js",
122
+ "module": "dist/particles.es.js",
123
+ "types": "dist/index.d.ts",
124
+ "unpkg": "dist/particles.umd.min.js",
125
+ "jsdelivr": "dist/particles.umd.min.js",
126
+ "gitHead": "b12cb584dde5f3875976eafe87ecb1b7154c14c1"
127
+ }
@@ -0,0 +1,19 @@
1
+ import type { App } from "vue";
2
+ import particles from "./vue-particles.vue";
3
+ import { type Engine, tsParticles } from "@tsparticles/engine";
4
+
5
+ const VueParticles = (app: App, options: { init: (engine: Engine) => Promise<void> }) => {
6
+ app.component("vue-particles", particles);
7
+
8
+ (async () => {
9
+ tsParticles.init();
10
+
11
+ if (options.init) {
12
+ await options.init(tsParticles);
13
+ }
14
+
15
+ dispatchEvent(new CustomEvent("particlesInit", { detail: tsParticles }));
16
+ })();
17
+ };
18
+
19
+ export default VueParticles;
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <div :id="id"></div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { nextTick, onMounted, onUnmounted } from "vue";
7
+ import { type Container, type ISourceOptions, type Engine, tsParticles } from "@tsparticles/engine";
8
+
9
+ export type IParticlesProps = ISourceOptions;
10
+
11
+ let container: Container | undefined, engine: Engine | undefined;
12
+
13
+ const props = defineProps<{
14
+ id: string;
15
+ options?: IParticlesProps;
16
+ url?: string;
17
+ }>();
18
+
19
+ const emit = defineEmits<{
20
+ (e: "particlesLoaded", container?: Container): void;
21
+ }>();
22
+
23
+ addEventListener("particlesInit", (e: Event) => {
24
+ const evt = e as CustomEvent<Engine>;
25
+
26
+ engine = evt.detail;
27
+
28
+ loadParticles();
29
+ });
30
+
31
+ const loadParticles = async () => {
32
+ if (!engine) {
33
+ engine = tsParticles;
34
+ }
35
+
36
+ container = await engine.load({
37
+ id: props.id,
38
+ url: props.url,
39
+ options: props.options,
40
+ });
41
+
42
+ emit("particlesLoaded", container);
43
+ };
44
+
45
+ onMounted(() => {
46
+ nextTick(() => {
47
+ if (!props.id) {
48
+ throw new Error("Prop 'id' is required!");
49
+ }
50
+
51
+ loadParticles();
52
+ });
53
+ });
54
+
55
+ onUnmounted(() => {
56
+ if (!container) {
57
+ return;
58
+ }
59
+
60
+ container.destroy();
61
+ container = undefined;
62
+ });
63
+ </script>
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "extends": [
3
+ "@vue/tsconfig/tsconfig.dom.json"//,
4
+ //"@vue/tsconfig/tsconfig.lib.json"
5
+ ],
6
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
7
+ "compilerOptions": {
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@/*": ["./src/*"]
11
+ }
12
+ },
13
+
14
+ "references": [
15
+ {
16
+ "path": "./tsconfig.vite-config.json"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": [
3
+ "@tsconfig/node18/tsconfig.json",
4
+ "@vue/tsconfig/tsconfig.dom.json"//,
5
+ //"@vue/tsconfig/tsconfig.lib.json"
6
+ ],
7
+ "include": [
8
+ "vite.config.*"
9
+ ],
10
+ "compilerOptions": {
11
+ "composite": true,
12
+ "types": [
13
+ "node"
14
+ ]
15
+ }
16
+ }
package/typedoc.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "includes": "./markdown",
3
+ "entryPoints": [
4
+ "./src/"
5
+ ],
6
+ "entryPointStrategy": "expand",
7
+ "name": "tsParticles Vue 3.x Component",
8
+ "includeVersion": true,
9
+ "hideGenerator": true,
10
+ "out": "./docs",
11
+ "validation": {
12
+ "invalidLink": true,
13
+ "notDocumented": true
14
+ }
15
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { fileURLToPath, URL } from "url";
2
+ import path from "path";
3
+ import { defineConfig } from "vite";
4
+ import vue from "@vitejs/plugin-vue";
5
+ import vueJsx from "@vitejs/plugin-vue-jsx";
6
+ import dts from "vite-plugin-dts";
7
+
8
+ // https://vitejs.dev/config/
9
+ export default defineConfig({
10
+ build: {
11
+ lib: {
12
+ entry: path.resolve(__dirname, "src/components/index.ts"),
13
+ name: "@tsparticles/vue3",
14
+ fileName: format => `particles.${format}.js`,
15
+ },
16
+ rollupOptions: {
17
+ external: [ "vue", "@tsparticles/engine" ],
18
+ output: {
19
+ // Provide global variables to use in the UMD build
20
+ // Add external deps here
21
+ globals: {
22
+ vue: "Vue",
23
+ "@tsparticles/engine": "tsParticles",
24
+ },
25
+ },
26
+ },
27
+ },
28
+ plugins: [ vue(), vueJsx(), dts() ],
29
+ resolve: {
30
+ alias: {
31
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
32
+ },
33
+ },
34
+ });