@tsparticles/vue3 3.0.0 → 4.0.0-beta.12

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
@@ -2,153 +2,72 @@
2
2
 
3
3
  # @tsparticles/vue3
4
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)
5
+ [![npm](https://img.shields.io/npm/v/@tsparticles/vue3)](https://www.npmjs.com/package/@tsparticles/vue3)
6
+ [![npm](https://img.shields.io/npm/dm/@tsparticles/vue3)](https://www.npmjs.com/package/@tsparticles/vue3)
6
7
 
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>
8
+ Official Vue 3 component wrapper for [tsParticles](https://github.com/matteobruni/tsparticles).
12
9
 
13
10
  ## Installation
14
11
 
15
- ```shell script
16
- yarn add @tsparticles/vue3
12
+ ```bash
13
+ pnpm add @tsparticles/vue3 @tsparticles/engine
17
14
  ```
18
15
 
19
16
  ## Usage
20
17
 
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
- ```
18
+ Register the plugin once in your app and provide your own async `init` function.
33
19
 
34
- ### Demo config
20
+ ```ts
21
+ import { createApp } from "vue";
22
+ import Particles from "@tsparticles/vue3";
23
+ import type { Engine } from "@tsparticles/engine";
24
+ import App from "./App.vue";
35
25
 
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
- ```
26
+ async function registerParticles(engine: Engine): Promise<void> {
27
+ const [{ loadSlim }] = await Promise.all([import("@tsparticles/slim")]);
119
28
 
120
- ```javascript
121
- const particlesLoaded = async container => {
122
- console.log("Particles container loaded", container);
123
- };
124
- ```
29
+ await loadSlim(engine);
30
+ }
125
31
 
126
- ### TypeScript errors
32
+ const app = createApp(App);
127
33
 
128
- If TypeScript returns error while importing/using Particles plugin try adding the following import before the previous
129
- code:
34
+ app.use(Particles, {
35
+ init: registerParticles,
36
+ });
130
37
 
131
- ```typescript
132
- declare module "@tsparticles/vue3";
38
+ app.mount("#app");
133
39
  ```
134
40
 
135
- ## Demos
41
+ Then use the component anywhere in the app:
136
42
 
137
- The demo website is [here](https://particles.js.org)
43
+ ```vue
44
+ <template>
45
+ <vue-particles id="tsparticles" :options="options" @particles-loaded="particlesLoaded" />
46
+ </template>
138
47
 
139
- <https://particles.js.org>
48
+ <script setup lang="ts">
49
+ import type { Container, ISourceOptions } from "@tsparticles/engine";
140
50
 
141
- There's also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage)
51
+ const options: ISourceOptions = {
52
+ particles: {
53
+ number: { value: 80 },
54
+ links: { enable: true },
55
+ move: { enable: true },
56
+ },
57
+ };
142
58
 
143
- <https://codepen.io/collection/DPOage>
59
+ function particlesLoaded(container?: Container): void {
60
+ console.log("Particles loaded", container);
61
+ }
62
+ </script>
63
+ ```
144
64
 
145
- ## Migrating from Vue 2.x to Vue 3.x
65
+ ## How init works
146
66
 
147
- If you are migrating your project from Vue 2.x to 3.x you need to these steps:
67
+ - `init` is called once per Vue app instance.
68
+ - Components wait for `init` completion before loading.
69
+ - You choose what to import inside `init` (`@tsparticles/slim`, `tsparticles`, custom plugins, etc.).
148
70
 
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 */ })`.
71
+ ## Nuxt support
153
72
 
154
- The `<vue-particles />` tag syntax remains the same, so you don't need to do any additional action.
73
+ For Nuxt projects use [`@tsparticles/nuxt3`](../nuxt3/README.md) or [`@tsparticles/nuxt4`](../nuxt4/README.md), which wrap this package in a Nuxt module.
@@ -1,39 +1,65 @@
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
1
+ import { createElementBlock as e, defineComponent as t, inject as n, nextTick as r, onMounted as i, onUnmounted as a, openBlock as o, reactive as s, ref as c, watch as l } from "vue";
2
+ import { tsParticles as u } from "@tsparticles/engine";
3
+ //#region src/components/particles-provider.ts
4
+ var d = Symbol("particles-provider"), f = "__tsparticles_vue3_init_state__";
5
+ function p() {
6
+ let e = globalThis;
7
+ return e[f] ??= { loaded: !1 }, e[f];
8
+ }
9
+ function m() {
10
+ return s({ loaded: !1 });
11
+ }
12
+ function h(e, t, n) {
13
+ let r = p();
14
+ if (r.promise && r.callback !== n && !r.loaded) throw Error("@tsparticles/vue3 init callback must be stable across the app lifecycle.");
15
+ return r.loaded ? (t.loaded = !0, Promise.resolve()) : r.promise ? r.promise.then(() => {
16
+ t.loaded = !0;
17
+ }) : (r.callback = n, r.promise = (async () => {
18
+ n && await n(u), await u.init(), r.loaded = !0, t.loaded = !0;
19
+ })().catch((e) => {
20
+ throw r.promise = void 0, r.callback = void 0, r.loaded = !1, e;
21
+ }), r.promise);
22
+ }
23
+ function g() {
24
+ let e = n(d, void 0);
25
+ if (!e) throw Error("@tsparticles/vue3 plugin is required. Register it with app.use(Particles, { init }).");
26
+ return e;
27
+ }
28
+ //#endregion
29
+ //#region src/components/vue-particles.vue?vue&type=script&setup=true&lang.ts
30
+ var _ = ["id"], v = /* @__PURE__ */ t({
31
+ __name: "vue-particles",
32
+ props: {
33
+ id: {},
34
+ options: {},
35
+ url: {},
36
+ theme: {}
37
+ },
38
+ emits: ["particlesLoaded"],
39
+ setup(t, { emit: n }) {
40
+ let s, d = t, f = n, p = g(), m = c(!1), h = async () => {
41
+ s?.destroy(), s = await u.load({
42
+ id: d.id,
43
+ url: d.url,
44
+ options: d.options
45
+ }), f("particlesLoaded", s);
46
+ };
47
+ return i(() => {
48
+ r(() => {
49
+ if (!d.id) throw Error("Prop 'id' is required!");
50
+ m.value = !0;
51
+ });
52
+ }), a(() => {
53
+ s?.destroy(), s = void 0;
54
+ }), l(() => p.loaded, (e) => {
55
+ e && m.value && h();
56
+ }, { immediate: !0 }), l(() => m.value, (e) => {
57
+ e && p.loaded && h();
58
+ }, { immediate: !0 }), (n, r) => (o(), e("div", { id: t.id }, null, 8, _));
59
+ }
60
+ }), y = (e, t) => {
61
+ let n = m();
62
+ e.provide(d, n), e.component("VueParticles", v), h(e, n, t?.init);
39
63
  };
64
+ //#endregion
65
+ export { y as default };
@@ -1 +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}))))()}});
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){var n=Symbol(`particles-provider`),r=`__tsparticles_vue3_init_state__`;function i(){let e=globalThis;return e[r]??={loaded:!1},e[r]}function a(){return(0,e.reactive)({loaded:!1})}function o(e,n,r){let a=i();if(a.promise&&a.callback!==r&&!a.loaded)throw Error(`@tsparticles/vue3 init callback must be stable across the app lifecycle.`);return a.loaded?(n.loaded=!0,Promise.resolve()):a.promise?a.promise.then(()=>{n.loaded=!0}):(a.callback=r,a.promise=(async()=>{r&&await r(t.tsParticles),await t.tsParticles.init(),a.loaded=!0,n.loaded=!0})().catch(e=>{throw a.promise=void 0,a.callback=void 0,a.loaded=!1,e}),a.promise)}function s(){let t=(0,e.inject)(n,void 0);if(!t)throw Error(`@tsparticles/vue3 plugin is required. Register it with app.use(Particles, { init }).`);return t}var c=[`id`],l=(0,e.defineComponent)({__name:`vue-particles`,props:{id:{},options:{},url:{},theme:{}},emits:[`particlesLoaded`],setup(n,{emit:r}){let i,a=n,o=r,l=s(),u=(0,e.ref)(!1),d=async()=>{i?.destroy(),i=await t.tsParticles.load({id:a.id,url:a.url,options:a.options}),o(`particlesLoaded`,i)};return(0,e.onMounted)(()=>{(0,e.nextTick)(()=>{if(!a.id)throw Error(`Prop 'id' is required!`);u.value=!0})}),(0,e.onUnmounted)(()=>{i?.destroy(),i=void 0}),(0,e.watch)(()=>l.loaded,e=>{e&&u.value&&d()},{immediate:!0}),(0,e.watch)(()=>u.value,e=>{e&&l.loaded&&d()},{immediate:!0}),(t,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{id:n.id},null,8,c))}});return(e,t)=>{let r=a();e.provide(n,r),e.component(`VueParticles`,l),o(e,r,t?.init)}});
@@ -0,0 +1,5 @@
1
+ import { App } from 'vue';
2
+ import { IParticlesProviderOptions } from './particles-provider';
3
+ declare const VueParticles: (app: App, options?: IParticlesProviderOptions) => void;
4
+ export default VueParticles;
5
+ export type { IParticlesProviderContext, IParticlesProviderOptions, ParticlesPluginRegistrar, } from './particles-provider';
@@ -0,0 +1,13 @@
1
+ import { Engine } from '@tsparticles/engine';
2
+ import { App, InjectionKey } from 'vue';
3
+ export type ParticlesPluginRegistrar = (engine: Engine) => Promise<void> | void;
4
+ export interface IParticlesProviderOptions {
5
+ init?: ParticlesPluginRegistrar;
6
+ }
7
+ export interface IParticlesProviderContext {
8
+ loaded: boolean;
9
+ }
10
+ export declare const particlesProviderKey: InjectionKey<IParticlesProviderContext>;
11
+ export declare function createParticlesProviderContext(): IParticlesProviderContext;
12
+ export declare function initParticlesProvider(_app: App, context: IParticlesProviderContext, init?: ParticlesPluginRegistrar): Promise<void>;
13
+ export declare function useParticlesProvider(): IParticlesProviderContext;
@@ -0,0 +1,14 @@
1
+ import { Container, ISourceOptions } from '@tsparticles/engine';
2
+ export type IParticlesProps = ISourceOptions;
3
+ type __VLS_Props = {
4
+ id: string;
5
+ options?: IParticlesProps;
6
+ url?: string;
7
+ theme?: string;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
10
+ particlesLoaded: (container?: Container | undefined) => any;
11
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ onParticlesLoaded?: ((container?: Container | undefined) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
14
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "@tsparticles/vue3",
3
- "version": "3.0.0",
3
+ "version": "4.0.0-beta.12",
4
+ "type": "module",
5
+ "main": "dist/particles.es.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/particles.es.js"
11
+ }
12
+ },
4
13
  "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
14
  "keywords": [
6
15
  "front-end",
@@ -65,12 +74,16 @@
65
74
  "prettify:readme": "prettier --write ./README.md",
66
75
  "preview": "vite preview --port 5050",
67
76
  "typecheck": "vue-tsc --noEmit",
68
- "lint": "echo eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
77
+ "lint": "eslint . --fix"
69
78
  },
79
+ "files": [
80
+ "dist",
81
+ "README.md"
82
+ ],
70
83
  "repository": {
71
- "url": "https://github.com/tsparticles/vue3",
84
+ "url": "https://github.com/tsparticles/tsparticles.git",
72
85
  "type": "git",
73
- "directory": "components/vue3"
86
+ "directory": "wrappers/vue3"
74
87
  },
75
88
  "author": "Matteo Bruni <matteo.bruni@me.com>",
76
89
  "license": "MIT",
@@ -97,31 +110,31 @@
97
110
  "access": "public"
98
111
  },
99
112
  "dependencies": {
100
- "@tsparticles/engine": "^3.0.2",
101
- "vue": "^3.3.13"
113
+ "@tsparticles/engine": "^4.0.0-beta.12",
114
+ "vue": "^3.5.32"
102
115
  },
103
116
  "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"
117
+ "@eslint/js": "^10.0.1",
118
+ "@rushstack/eslint-patch": "^1.16.1",
119
+ "@tsconfig/node18": "^18.2.6",
120
+ "@tsparticles/prettier-config": "^3.4.6",
121
+ "@types/node": "^25.6.0",
122
+ "@typescript-eslint/parser": "^8.58.1",
123
+ "@vitejs/plugin-vue": "^6.0.5",
124
+ "@vitejs/plugin-vue-jsx": "^5.1.5",
125
+ "@vue/eslint-config-prettier": "^10.2.0",
126
+ "@vue/eslint-config-typescript": "^14.7.0",
127
+ "@vue/tsconfig": "^0.9.1",
128
+ "eslint": "^10.2.0",
129
+ "eslint-plugin-vue": "^10.8.0",
130
+ "globals": "^17.5.0",
131
+ "prettier": "^3.8.2",
132
+ "typescript": "^6.0.2",
133
+ "vite": "^8.0.8",
134
+ "vite-plugin-dts": "^4.5.4",
135
+ "vue-eslint-parser": "^10.4.0",
136
+ "vue-tsc": "^3.2.6"
120
137
  },
121
- "main": "dist/particles.umd.js",
122
138
  "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"
139
+ "gitHead": "bdbc95716ce44665fbecfaca8757445e248b562d"
127
140
  }
package/.eslintrc.cjs DELETED
@@ -1,15 +0,0 @@
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 DELETED
@@ -1,183 +0,0 @@
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/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
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;
@@ -1,25 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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;
@@ -1,63 +0,0 @@
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 DELETED
@@ -1,19 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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 DELETED
@@ -1,15 +0,0 @@
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 DELETED
@@ -1,34 +0,0 @@
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
- });