Skip to content

Commit 20418dd

Browse files
committed
build: set for tsparticles v2
1 parent de4d180 commit 20418dd

File tree

7 files changed

+326
-320
lines changed

7 files changed

+326
-320
lines changed

apps/astro/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tsparticles/astro-demo",
2+
"name": "astro-particles-demo",
33
"type": "module",
44
"version": "2.8.0",
55
"private": true,
@@ -12,9 +12,9 @@
1212
"astro": "astro"
1313
},
1414
"dependencies": {
15-
"@tsparticles/astro": "^2.8.0",
16-
"@tsparticles/engine": "^3.0.0-alpha.1",
15+
"astro-particles": "^2.9.3",
16+
"tsparticles-engine": "^2.9.3",
1717
"astro": "^2.0.1",
18-
"tsparticles": "^3.0.0-alpha.1"
18+
"tsparticles": "^2.9.3"
1919
}
2020
}

apps/astro/src/pages/index.astro

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
import Particles from "@tsparticles/astro"
2+
import Particles from "astro-particles"
33
import Layout from '../layouts/Layout.astro';
44
import Card from '../components/Card.astro';
5-
import type { ISourceOptions } from "@tsparticles/engine";
5+
import type { ISourceOptions } from "tsparticles-engine";
66
77
const options: ISourceOptions = {
88
background: {
@@ -12,6 +12,9 @@ const options: ISourceOptions = {
1212
zIndex: -1
1313
},
1414
particles: {
15+
number: {
16+
value: 100
17+
},
1518
move: {
1619
enable: true
1720
}
@@ -20,7 +23,7 @@ const options: ISourceOptions = {
2023
---
2124

2225
<script>
23-
import { tsParticles } from "@tsparticles/engine";
26+
import { tsParticles } from "tsparticles-engine";
2427
import { loadFull } from "tsparticles";
2528

2629
(async () => {

components/astro/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
22

3-
# @tsparticles/astro
3+
# astro-particles
44

5-
[![npm](https://img.shields.io/npm/v/@tsparticles/astro)](https://www.npmjs.com/package/@tsparticles/astro) [![npm](https://img.shields.io/npm/dm/@tsparticles/astro)](https://www.npmjs.com/package/@tsparticles/astro) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
5+
[![npm](https://img.shields.io/npm/v/astro-particles)](https://www.npmjs.com/package/astro-particles) [![npm](https://img.shields.io/npm/dm/astro-particles)](https://www.npmjs.com/package/astro-particles) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
66

77
Official [tsParticles](https://github.com/matteobruni/tsparticles) Astro component
88

@@ -13,20 +13,20 @@ Official [tsParticles](https://github.com/matteobruni/tsparticles) Astro compone
1313
## Installation
1414

1515
```shell
16-
npm install @tsparticles/astro
16+
npm install astro-particles
1717
```
1818

1919
or
2020

2121
```shell
22-
yarn add @tsparticles/astro
22+
yarn add astro-particles
2323
```
2424

2525
## How to use
2626

2727
```astro
2828
---
29-
import Particles from "@tsparticles/astro"
29+
import Particles from "astro-particles"
3030
import type { ISourceOptions } from "@tsparticles/engine";
3131
3232
const options: ISourceOptions = {
@@ -37,6 +37,9 @@ const options: ISourceOptions = {
3737
zIndex: -1
3838
},
3939
particles: {
40+
number: {
41+
value: 100
42+
},
4043
move: {
4144
enable: true
4245
}

components/astro/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@tsparticles/astro",
3-
"version": "2.8.0",
2+
"name": "astro-particles",
3+
"version": "2.9.3",
44
"description": "Official tsParticles Astro 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, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, React.js, Riot.js, Solid.js, Inferno.",
55
"scripts": {
66
"build": "echo build",
@@ -87,6 +87,6 @@
8787
".": "./index.ts"
8888
},
8989
"dependencies": {
90-
"@tsparticles/engine": "^3.0.0-alpha.1"
90+
"tsparticles-engine": "^2.9.3"
9191
}
9292
}

components/astro/src/Particles.astro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
2-
import type { Container, Engine, ISourceOptions } from "@tsparticles/engine";
2+
import type { Container, Engine, ISourceOptions } from "tsparticles-engine";
33
44
export interface IParticlesProps {
55
id: string;
66
options?: ISourceOptions;
77
url?: string;
88
}
99
10-
const { id, options, url, particlesInit, particlesLoaded } = Astro.props as IParticlesProps;
10+
const { id, options, url } = Astro.props as IParticlesProps;
1111
---
1212
<astro-particles data-id={id} data-options={JSON.stringify(options)} data-url={url}>
1313
<canvas></canvas>
1414
</astro-particles>
1515

1616
<script>
17-
import { tsParticles } from "@tsparticles/engine";
17+
import { tsParticles } from "tsparticles-engine";
1818

1919
class AstroParticles extends HTMLElement {
2020
constructor() {
2121
super();
2222

2323
(async () => {
24-
await tsParticles.load({
25-
id: this.dataset.id,
26-
options: JSON.parse(this.dataset.options),
27-
url: this.dataset.url
28-
});
24+
if (this.dataset.url) {
25+
await tsParticles.loadJSON(this.dataset.id, this.dataset.url);
26+
} else if (this.dataset.options) {
27+
await tsParticles.load(this.dataset.id, JSON.parse(this.dataset.options));
28+
}
2929
})();
3030
}
3131
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@tsparticles/astro-workspace",
2+
"name": "astro-particles-workspace",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {

0 commit comments

Comments
 (0)