@tsparticles/vue3 4.0.5 → 4.1.1
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/package.json +21 -61
- package/{dist/particles.umd.js → particles.umd.js} +1 -1
- package/{dist/src → src}/components/vue-particles.vue.d.ts +3 -2
- package/README.md +0 -73
- /package/{dist/particles.es.js → particles.es.js} +0 -0
- /package/{dist/src → src}/components/index.d.ts +0 -0
- /package/{dist/src → src}/components/particles-provider.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/vue3",
|
|
3
|
-
"version": "4.
|
|
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
|
-
},
|
|
3
|
+
"version": "4.1.1",
|
|
13
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
|
+
"homepage": "https://particles.js.org",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"directory": "wrappers/vue3"
|
|
10
|
+
},
|
|
14
11
|
"keywords": [
|
|
15
12
|
"front-end",
|
|
16
13
|
"frontend",
|
|
@@ -64,33 +61,12 @@
|
|
|
64
61
|
"fireworksjs",
|
|
65
62
|
"canvas-confetti"
|
|
66
63
|
],
|
|
67
|
-
"scripts": {
|
|
68
|
-
"dev": "vite",
|
|
69
|
-
"build": "pnpm run prettify:src && pnpm run prettify:readme && vue-tsc --noEmit && vite build",
|
|
70
|
-
"build:ci": "pnpm run prettify:ci:src && pnpm run prettify:ci:readme && vue-tsc --noEmit && vite build",
|
|
71
|
-
"prettify:ci:src": "prettier --check ./src/*",
|
|
72
|
-
"prettify:ci:readme": "prettier --check ./README.md",
|
|
73
|
-
"prettify:src": "prettier --write ./src/*",
|
|
74
|
-
"prettify:readme": "prettier --write ./README.md",
|
|
75
|
-
"preview": "vite preview --port 5050",
|
|
76
|
-
"typecheck": "vue-tsc --noEmit",
|
|
77
|
-
"lint": "eslint . --fix"
|
|
78
|
-
},
|
|
79
|
-
"files": [
|
|
80
|
-
"dist",
|
|
81
|
-
"README.md"
|
|
82
|
-
],
|
|
83
|
-
"repository": {
|
|
84
|
-
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
85
|
-
"type": "git",
|
|
86
|
-
"directory": "wrappers/vue3"
|
|
87
|
-
},
|
|
88
64
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
89
65
|
"license": "MIT",
|
|
90
66
|
"bugs": {
|
|
91
67
|
"url": "https://github.com/tsparticles/vue3/issues"
|
|
92
68
|
},
|
|
93
|
-
"
|
|
69
|
+
"type": "module",
|
|
94
70
|
"funding": [
|
|
95
71
|
{
|
|
96
72
|
"type": "github",
|
|
@@ -106,35 +82,19 @@
|
|
|
106
82
|
}
|
|
107
83
|
],
|
|
108
84
|
"prettier": "@tsparticles/prettier-config",
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
|
|
85
|
+
"types": "index.d.ts",
|
|
86
|
+
"module": "particles.es.js",
|
|
87
|
+
"main": "particles.es.js",
|
|
88
|
+
"exports": {
|
|
89
|
+
".": {
|
|
90
|
+
"types": "./index.d.ts",
|
|
91
|
+
"default": "./particles.es.js"
|
|
92
|
+
}
|
|
115
93
|
},
|
|
116
|
-
"
|
|
117
|
-
"@
|
|
118
|
-
"@rushstack/eslint-patch": "^1.16.1",
|
|
119
|
-
"@tsconfig/node18": "^18.2.6",
|
|
120
|
-
"@tsparticles/prettier-config": "^4.0.5",
|
|
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"
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"@tsparticles/engine": "4.1.1"
|
|
137
96
|
},
|
|
138
|
-
"
|
|
139
|
-
|
|
97
|
+
"publishConfig": {
|
|
98
|
+
"access": "public"
|
|
99
|
+
}
|
|
140
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t(require(
|
|
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)}});
|
|
@@ -6,9 +6,10 @@ type __VLS_Props = {
|
|
|
6
6
|
url?: string;
|
|
7
7
|
theme?: string;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
9
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
10
10
|
particlesLoaded: (container?: Container | undefined) => any;
|
|
11
11
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
12
|
onParticlesLoaded?: ((container?: Container | undefined) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
13
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
14
15
|
export default _default;
|
package/README.md
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
[](https://particles.js.org)
|
|
2
|
-
|
|
3
|
-
# @tsparticles/vue3
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@tsparticles/vue3)
|
|
6
|
-
[](https://www.npmjs.com/package/@tsparticles/vue3)
|
|
7
|
-
|
|
8
|
-
Official Vue 3 component wrapper for [tsParticles](https://github.com/matteobruni/tsparticles).
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
pnpm add @tsparticles/vue3 @tsparticles/engine
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Usage
|
|
17
|
-
|
|
18
|
-
Register the plugin once in your app and provide your own async `init` function.
|
|
19
|
-
|
|
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";
|
|
25
|
-
|
|
26
|
-
async function registerParticles(engine: Engine): Promise<void> {
|
|
27
|
-
const [{ loadSlim }] = await Promise.all([import("@tsparticles/slim")]);
|
|
28
|
-
|
|
29
|
-
await loadSlim(engine);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const app = createApp(App);
|
|
33
|
-
|
|
34
|
-
app.use(Particles, {
|
|
35
|
-
init: registerParticles,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
app.mount("#app");
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Then use the component anywhere in the app:
|
|
42
|
-
|
|
43
|
-
```vue
|
|
44
|
-
<template>
|
|
45
|
-
<vue-particles id="tsparticles" :options="options" @particles-loaded="particlesLoaded" />
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<script setup lang="ts">
|
|
49
|
-
import type { Container, ISourceOptions } from "@tsparticles/engine";
|
|
50
|
-
|
|
51
|
-
const options: ISourceOptions = {
|
|
52
|
-
particles: {
|
|
53
|
-
number: { value: 80 },
|
|
54
|
-
links: { enable: true },
|
|
55
|
-
move: { enable: true },
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
function particlesLoaded(container?: Container): void {
|
|
60
|
-
console.log("Particles loaded", container);
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## How init works
|
|
66
|
-
|
|
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.).
|
|
70
|
-
|
|
71
|
-
## Nuxt support
|
|
72
|
-
|
|
73
|
-
For Nuxt projects use [`@tsparticles/nuxt3`](../nuxt3/README.md) or [`@tsparticles/nuxt4`](../nuxt4/README.md), which wrap this package in a Nuxt module.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|