@tsparticles/svelte 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 +78 -119
- package/README.md +0 -206
- /package/{dist/Particles.svelte → Particles.svelte} +0 -0
- /package/{dist/Particles.svelte.d.ts → Particles.svelte.d.ts} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/utils.d.ts → utils.d.ts} +0 -0
- /package/{dist/utils.js → utils.js} +0 -0
package/package.json
CHANGED
|
@@ -1,121 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"svelte": "./dist/index.js"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"files": [
|
|
84
|
-
"dist",
|
|
85
|
-
"!dist/**/*.test.*",
|
|
86
|
-
"!dist/**/*.spec.*"
|
|
87
|
-
],
|
|
88
|
-
"publishConfig": {
|
|
89
|
-
"access": "public"
|
|
90
|
-
},
|
|
91
|
-
"peerDependencies": {
|
|
92
|
-
"svelte": "^4.2.17"
|
|
93
|
-
},
|
|
94
|
-
"dependencies": {
|
|
95
|
-
"@tsparticles/engine": "^4.0.5"
|
|
96
|
-
},
|
|
97
|
-
"devDependencies": {
|
|
98
|
-
"@sveltejs/adapter-auto": "^7.0.1",
|
|
99
|
-
"@sveltejs/kit": "^2.57.1",
|
|
100
|
-
"@sveltejs/package": "^2.5.7",
|
|
101
|
-
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
102
|
-
"@types/eslint": "^9.6.1",
|
|
103
|
-
"@typescript-eslint/eslint-plugin": "^8.58.2",
|
|
104
|
-
"@typescript-eslint/parser": "^8.58.2",
|
|
105
|
-
"eslint": "^10.2.0",
|
|
106
|
-
"eslint-config-prettier": "^10.1.8",
|
|
107
|
-
"eslint-plugin-svelte": "^3.17.0",
|
|
108
|
-
"prettier": "^3.8.2",
|
|
109
|
-
"prettier-plugin-svelte": "^3.5.1",
|
|
110
|
-
"publint": "^0.3.18",
|
|
111
|
-
"svelte": "^5.55.3",
|
|
112
|
-
"svelte-check": "^4.4.6",
|
|
113
|
-
"tslib": "^2.8.1",
|
|
114
|
-
"typescript": "^6.0.2",
|
|
115
|
-
"vite": "^8.0.8"
|
|
116
|
-
},
|
|
117
|
-
"svelte": "./dist/index.js",
|
|
118
|
-
"types": "./dist/index.d.ts",
|
|
119
|
-
"type": "module",
|
|
120
|
-
"gitHead": "4d8b281f8097386714300e39b0004b903f9df87b"
|
|
2
|
+
"name": "@tsparticles/svelte",
|
|
3
|
+
"version": "4.1.1",
|
|
4
|
+
"description": "Official tsParticles Svelte 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 and 3.x), Angular, jQuery, Preact, Riot.js, Solid.js, Inferno.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
|
8
|
+
"directory": "wrappers/svelte"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"front-end",
|
|
12
|
+
"frontend",
|
|
13
|
+
"tsparticles",
|
|
14
|
+
"particles.js",
|
|
15
|
+
"particlesjs",
|
|
16
|
+
"particles",
|
|
17
|
+
"particle",
|
|
18
|
+
"canvas",
|
|
19
|
+
"jsparticles",
|
|
20
|
+
"xparticles",
|
|
21
|
+
"particles-js",
|
|
22
|
+
"particles-bg",
|
|
23
|
+
"particles-bg-vue",
|
|
24
|
+
"particles-ts",
|
|
25
|
+
"particles.ts",
|
|
26
|
+
"react-particles-js",
|
|
27
|
+
"react-particles.js",
|
|
28
|
+
"react-particles",
|
|
29
|
+
"react",
|
|
30
|
+
"reactjs",
|
|
31
|
+
"vue-particles",
|
|
32
|
+
"ngx-particles",
|
|
33
|
+
"angular-particles",
|
|
34
|
+
"particleground",
|
|
35
|
+
"vue",
|
|
36
|
+
"vuejs",
|
|
37
|
+
"preact",
|
|
38
|
+
"preactjs",
|
|
39
|
+
"jquery",
|
|
40
|
+
"angularjs",
|
|
41
|
+
"angular",
|
|
42
|
+
"typescript",
|
|
43
|
+
"javascript",
|
|
44
|
+
"animation",
|
|
45
|
+
"web",
|
|
46
|
+
"html5",
|
|
47
|
+
"web-design",
|
|
48
|
+
"webdesign",
|
|
49
|
+
"css",
|
|
50
|
+
"html",
|
|
51
|
+
"css3",
|
|
52
|
+
"animated",
|
|
53
|
+
"background",
|
|
54
|
+
"confetti",
|
|
55
|
+
"canvas",
|
|
56
|
+
"fireworks",
|
|
57
|
+
"fireworks-js",
|
|
58
|
+
"confetti-js",
|
|
59
|
+
"confettijs",
|
|
60
|
+
"fireworksjs",
|
|
61
|
+
"canvas-confetti"
|
|
62
|
+
],
|
|
63
|
+
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"type": "module",
|
|
66
|
+
"types": "/index.d.ts",
|
|
67
|
+
"exports": {
|
|
68
|
+
".": {
|
|
69
|
+
"types": "./index.d.ts",
|
|
70
|
+
"svelte": "./index.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"svelte": "^4.2.17",
|
|
75
|
+
"@tsparticles/engine": "4.1.1"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public"
|
|
79
|
+
}
|
|
121
80
|
}
|
package/README.md
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
[](https://particles.js.org)
|
|
2
|
-
|
|
3
|
-
# @tsparticles/svelte
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@tsparticles/svelte) [](https://www.npmjs.com/package/@tsparticles/svelte) [](https://github.com/sponsors/matteobruni)
|
|
6
|
-
|
|
7
|
-
Official [tsParticles](https://github.com/matteobruni/tsparticles) SvelteJS component
|
|
8
|
-
|
|
9
|
-
[](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [](https://discord.gg/hACwv45Hme) [](https://t.me/tsparticles)
|
|
10
|
-
|
|
11
|
-
[](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
|
|
16
|
-
npm install @tsparticles/svelte
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
or
|
|
20
|
-
|
|
21
|
-
```shell
|
|
22
|
-
yarn add @tsparticles/svelte
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<script>
|
|
29
|
-
import Particles, { particlesInit } from '@tsparticles/svelte';
|
|
30
|
-
//import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
|
|
31
|
-
import { loadSlim } from '@tsparticles/slim'; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.
|
|
32
|
-
|
|
33
|
-
let particlesUrl = 'http://foo.bar/particles.json'; // placeholder, replace it with a real url
|
|
34
|
-
|
|
35
|
-
let particlesConfig = {
|
|
36
|
-
particles: {
|
|
37
|
-
color: {
|
|
38
|
-
value: '#000'
|
|
39
|
-
},
|
|
40
|
-
links: {
|
|
41
|
-
enable: true,
|
|
42
|
-
color: '#000'
|
|
43
|
-
},
|
|
44
|
-
move: {
|
|
45
|
-
enable: true
|
|
46
|
-
},
|
|
47
|
-
number: {
|
|
48
|
-
value: 100
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
let onParticlesLoaded = (event) => {
|
|
54
|
-
const particlesContainer = event.detail.particles;
|
|
55
|
-
|
|
56
|
-
// you can use particlesContainer to call all the Container class
|
|
57
|
-
// (from the core library) methods like play, pause, refresh, start, stop
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
void particlesInit(async (engine) => {
|
|
61
|
-
// call this once per app
|
|
62
|
-
// you can use main to customize the tsParticles instance adding presets or custom shapes
|
|
63
|
-
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
|
|
64
|
-
// starting from v2 you can add only the features you need reducing the bundle size
|
|
65
|
-
//await loadFull(engine);
|
|
66
|
-
await loadSlim(engine);
|
|
67
|
-
});
|
|
68
|
-
</script>
|
|
69
|
-
|
|
70
|
-
<Particles
|
|
71
|
-
id="tsparticles"
|
|
72
|
-
class="put your classes here"
|
|
73
|
-
style=""
|
|
74
|
-
options="{particlesConfig}"
|
|
75
|
-
on:particlesLoaded="{onParticlesLoaded}"
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
|
-
<!-- or -->
|
|
79
|
-
|
|
80
|
-
<Particles
|
|
81
|
-
id="tsparticles"
|
|
82
|
-
class="put your classes here"
|
|
83
|
-
style=""
|
|
84
|
-
url="{particlesUrl}"
|
|
85
|
-
on:particlesLoaded="{onParticlesLoaded}"
|
|
86
|
-
/>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### SSR
|
|
90
|
-
|
|
91
|
-
The particles component isn't built for SSR, so you have to force the component to be called client side
|
|
92
|
-
with `async import`.
|
|
93
|
-
|
|
94
|
-
You can see a sample below:
|
|
95
|
-
|
|
96
|
-
```html
|
|
97
|
-
<script>
|
|
98
|
-
import { particlesInit } from '@tsparticles/svelte';
|
|
99
|
-
import { onMount } from 'svelte';
|
|
100
|
-
//import { loadFull } from "tsparticles"; // if you are going to use `loadFull`, install the "tsparticles" package too.
|
|
101
|
-
import { loadSlim } from '@tsparticles/slim'; // if you are going to use `loadSlim`, install the "@tsparticles/slim" package too.
|
|
102
|
-
|
|
103
|
-
let ParticlesComponent;
|
|
104
|
-
|
|
105
|
-
onMount(async () => {
|
|
106
|
-
const module = await import('@tsparticles/svelte');
|
|
107
|
-
|
|
108
|
-
ParticlesComponent = module.default;
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
let particlesUrl = 'http://foo.bar/particles.json'; // placeholder, replace it with a real url
|
|
112
|
-
|
|
113
|
-
let particlesConfig = {
|
|
114
|
-
particles: {
|
|
115
|
-
color: {
|
|
116
|
-
value: '#000'
|
|
117
|
-
},
|
|
118
|
-
links: {
|
|
119
|
-
enable: true,
|
|
120
|
-
color: '#000'
|
|
121
|
-
},
|
|
122
|
-
move: {
|
|
123
|
-
enable: true
|
|
124
|
-
},
|
|
125
|
-
number: {
|
|
126
|
-
value: 100
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
let onParticlesLoaded = (event) => {
|
|
132
|
-
const particlesContainer = event.detail.particles;
|
|
133
|
-
|
|
134
|
-
// you can use particlesContainer to call all the Container class
|
|
135
|
-
// (from the core library) methods like play, pause, refresh, start, stop
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
void particlesInit(async (engine) => {
|
|
139
|
-
// call this once per app
|
|
140
|
-
// you can use main to customize the tsParticles instance adding presets or custom shapes
|
|
141
|
-
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
|
|
142
|
-
// starting from v2 you can add only the features you need reducing the bundle size
|
|
143
|
-
//await loadFull(main);
|
|
144
|
-
await loadSlim(engine);
|
|
145
|
-
});
|
|
146
|
-
</script>
|
|
147
|
-
|
|
148
|
-
<svelte:component
|
|
149
|
-
this="{ParticlesComponent}"
|
|
150
|
-
id="tsparticles"
|
|
151
|
-
class="put your classes here"
|
|
152
|
-
style=""
|
|
153
|
-
options="{particlesConfig}"
|
|
154
|
-
on:particlesLoaded="{onParticlesLoaded}"
|
|
155
|
-
/>
|
|
156
|
-
|
|
157
|
-
<!-- or -->
|
|
158
|
-
|
|
159
|
-
<svelte:component
|
|
160
|
-
this="{ParticlesComponent}"
|
|
161
|
-
id="tsparticles"
|
|
162
|
-
class="put your classes here"
|
|
163
|
-
style=""
|
|
164
|
-
url="{particlesUrl}"
|
|
165
|
-
on:particlesLoaded="{onParticlesLoaded}"
|
|
166
|
-
/>
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### TypeScript errors
|
|
170
|
-
|
|
171
|
-
A user reported me a TypeScript error (#3963), and that's because this Svelte component is built using TypeScript.
|
|
172
|
-
|
|
173
|
-
If someone is experiencing the same error, please follow these steps:
|
|
174
|
-
|
|
175
|
-
- install these packages: `typescript`, `svelte-preprocess`.
|
|
176
|
-
- add a `tsconfig.json` file to your project, following this sample: <https://github.com/ivanhofer/sveltekit-typescript-showcase#configure-typescript> (see this for example: <https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/main/tsconfig.json>)
|
|
177
|
-
- import `svelte-preprocess` in your svelte configuration file, like this: `import preprocess from 'svelte-preprocess'` (see this for example: <https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/c824e45338ffc1a9c907c63d00a6a0af4884a0e9/svelte.config.js#L2>)
|
|
178
|
-
- use the `preprocess` function in your svelte configuration file, like this: `preprocess: preprocess(),` (see this for example: <https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/c824e45338ffc1a9c907c63d00a6a0af4884a0e9/svelte.config.js#L9>)
|
|
179
|
-
|
|
180
|
-
After that, everything should work as expected.
|
|
181
|
-
|
|
182
|
-
### SvelteKit
|
|
183
|
-
|
|
184
|
-
If you have issues with SvelteKit, like you _Cannot use import statement outside a module_, change your `vite.config.ts` file like this:
|
|
185
|
-
|
|
186
|
-
```ts
|
|
187
|
-
import { sveltekit } from '@sveltejs/kit/vite';
|
|
188
|
-
import { defineConfig } from 'vite';
|
|
189
|
-
|
|
190
|
-
export default defineConfig({
|
|
191
|
-
plugins: [sveltekit()],
|
|
192
|
-
ssr: {
|
|
193
|
-
noExternal: ['tsparticles', '@tsparticles/slim', '@tsparticles/engine', '@tsparticles/svelte'] // add all tsparticles libraries here, they're not made for SSR, they're client only
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Demos
|
|
199
|
-
|
|
200
|
-
The demo website is [here](https://particles.js.org)
|
|
201
|
-
|
|
202
|
-
<https://particles.js.org>
|
|
203
|
-
|
|
204
|
-
There's also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage)
|
|
205
|
-
|
|
206
|
-
<https://codepen.io/collection/DPOage>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|