@tsparticles/basic 3.0.0-beta.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/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,167 @@
1
+ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)
2
+
3
+ # tsParticles Basic Bundle
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/basic/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/basic) [![npmjs](https://badge.fury.io/js/@tsparticles/basic.svg)](https://www.npmjs.com/package/@tsparticles/basic) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/basic)](https://www.npmjs.com/package/@tsparticles/basic) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ [tsParticles](https://github.com/matteobruni/tsparticles) basic bundle loads the minimum features to a `@tsparticles/engine` instance for having dots moving in the canvas.
8
+
9
+ **Included Packages**
10
+
11
+ - [@tsparticles/engine](https://github.com/matteobruni/tsparticles/tree/main/engine)
12
+ - [@tsparticles/move-base](https://github.com/matteobruni/tsparticles/tree/main/move/base)
13
+ - [@tsparticles/shape-circle](https://github.com/matteobruni/tsparticles/tree/main/shapes/circle)
14
+ - [@tsparticles/updater-color](https://github.com/matteobruni/tsparticles/tree/main/updaters/color)
15
+ - [@tsparticles/updater-opacity](https://github.com/matteobruni/tsparticles/tree/main/updaters/opacity)
16
+ - [@tsparticles/updater-out-modes](https://github.com/matteobruni/tsparticles/tree/main/updaters/outModes)
17
+ - [@tsparticles/updater-size](https://github.com/matteobruni/tsparticles/tree/main/updaters/size)
18
+
19
+ ## How to use it
20
+
21
+ ### CDN / Vanilla JS / jQuery
22
+
23
+ The CDN/Vanilla version JS has two different files:
24
+
25
+ - One is a bundle file with all the scripts included in a single file
26
+ - One is a file including just the `loadBasic` function to load the tsParticles basic preset, all dependencies must be
27
+ included manually
28
+
29
+ #### Bundle
30
+
31
+ Including the `tsparticles.basic.bundle.min.js` file will work exactly like `v1`, you can start using the `tsParticles`
32
+ instance in the same way.
33
+
34
+ This is the easiest usage, since it's a single file with the some of the `v1` features.
35
+
36
+ All new features will be added as external packages, this bundle is recommended for migrating from `v1` easily.
37
+
38
+ #### Not Bundle
39
+
40
+ This installation requires more work since all dependencies must be included in the page. Some lines above are all
41
+ specified in the **Included Packages** section.
42
+
43
+ ### Usage
44
+
45
+ Once the scripts are loaded you can set up `tsParticles` like this:
46
+
47
+ ```javascript
48
+ (async () => {
49
+ await loadBasic(tsParticles); // not needed if using the bundle script, required for any other installation
50
+
51
+ await tsParticles.load({
52
+ id: "tsparticles",
53
+ options: {
54
+ /* options */
55
+ },
56
+ });
57
+ })();
58
+ ```
59
+
60
+ ### React.js / Preact / Inferno
61
+
62
+ _The syntax for `React.js`, `Preact` and `Inferno` is the same_.
63
+
64
+ This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
65
+
66
+ _Class Components_
67
+
68
+ ```typescript jsx
69
+ import React from "react";
70
+ import Particles from "react-particles";
71
+ import type { Engine } from "@tsparticles/engine";
72
+ import { loadBasic } from "@tsparticles/basic";
73
+
74
+ export class ParticlesContainer extends PureComponent<unknown> {
75
+ // this customizes the component tsParticles installation
76
+ async customInit(engine: Engine) {
77
+ // this adds the bundle to tsParticles
78
+ await loadBasic(engine);
79
+ }
80
+
81
+ render() {
82
+ const options = {
83
+ /* custom options */
84
+ };
85
+
86
+ return <Particles options={options} init={this.customInit} />;
87
+ }
88
+ }
89
+ ```
90
+
91
+ _Hooks / Functional Components_
92
+
93
+ ```typescript jsx
94
+ import React, { useCallback } from "react";
95
+ import Particles from "react-particles";
96
+ import type { Engine } from "@tsparticles/engine";
97
+ import { loadBasic } from "@tsparticles/basic";
98
+
99
+ export function ParticlesContainer(props: unknown) {
100
+ // this customizes the component tsParticles installation
101
+ const customInit = useCallback(async (engine: Engine) => {
102
+ // this adds the bundle to tsParticles
103
+ await loadBasic(engine);
104
+ });
105
+
106
+ const options = {
107
+ /* custom options */
108
+ };
109
+
110
+ return <Particles options={options} init={this.customInit} />;
111
+ }
112
+ ```
113
+
114
+ ### Vue (2.x and 3.x)
115
+
116
+ _The syntax for `Vue.js 2.x` and `3.x` is the same_
117
+
118
+ ```vue
119
+ <Particles id="tsparticles" :particlesInit="particlesInit" :options="options" />
120
+ ```
121
+
122
+ ```js
123
+ const options = {
124
+ /* custom options */
125
+ };
126
+
127
+ async function particlesInit(engine: Engine) {
128
+ await loadBasic(engine);
129
+ }
130
+ ```
131
+
132
+ ### Angular
133
+
134
+ ```html
135
+ <ng-particles [id]="id" [options]="options" [particlesInit]="particlesInit"></ng-particles>
136
+ ```
137
+
138
+ ```ts
139
+ const options = {
140
+ /* custom options */
141
+ };
142
+
143
+ async function particlesInit(engine: Engine): void {
144
+ await loadBasic(engine);
145
+ }
146
+ ```
147
+
148
+ ### Svelte
149
+
150
+ ```sveltehtml
151
+
152
+ <Particles
153
+ id="tsparticles"
154
+ options={options}
155
+ particlesInit="{particlesInit}"
156
+ />
157
+ ```
158
+
159
+ ```js
160
+ let options = {
161
+ /* custom options */
162
+ };
163
+
164
+ let particlesInit = async (engine) => {
165
+ await loadBasic(engine);
166
+ };
167
+ ```
@@ -0,0 +1,5 @@
1
+ import { loadBasic } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ loadBasic(tsParticles);
4
+ export { loadBasic };
5
+ export * from "@tsparticles/engine";
@@ -0,0 +1,15 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
5
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
6
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
7
+ export async function loadBasic(engine, refresh = true) {
8
+ await loadBaseMover(engine, false);
9
+ await loadCircleShape(engine, false);
10
+ await loadColorUpdater(engine, false);
11
+ await loadOpacityUpdater(engine, false);
12
+ await loadOutModesUpdater(engine, false);
13
+ await loadSizeUpdater(engine, false);
14
+ await engine.refresh(refresh);
15
+ }
package/cjs/bundle.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.loadBasic = void 0;
18
+ const _1 = require(".");
19
+ Object.defineProperty(exports, "loadBasic", { enumerable: true, get: function () { return _1.loadBasic; } });
20
+ const engine_1 = require("@tsparticles/engine");
21
+ (0, _1.loadBasic)(engine_1.tsParticles);
22
+ __exportStar(require("@tsparticles/engine"), exports);
package/cjs/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadBasic = void 0;
4
+ const move_base_1 = require("@tsparticles/move-base");
5
+ const shape_circle_1 = require("@tsparticles/shape-circle");
6
+ const updater_color_1 = require("@tsparticles/updater-color");
7
+ const updater_opacity_1 = require("@tsparticles/updater-opacity");
8
+ const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
9
+ const updater_size_1 = require("@tsparticles/updater-size");
10
+ async function loadBasic(engine, refresh = true) {
11
+ await (0, move_base_1.loadBaseMover)(engine, false);
12
+ await (0, shape_circle_1.loadCircleShape)(engine, false);
13
+ await (0, updater_color_1.loadColorUpdater)(engine, false);
14
+ await (0, updater_opacity_1.loadOpacityUpdater)(engine, false);
15
+ await (0, updater_out_modes_1.loadOutModesUpdater)(engine, false);
16
+ await (0, updater_size_1.loadSizeUpdater)(engine, false);
17
+ await engine.refresh(refresh);
18
+ }
19
+ exports.loadBasic = loadBasic;
package/esm/bundle.js ADDED
@@ -0,0 +1,5 @@
1
+ import { loadBasic } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ loadBasic(tsParticles);
4
+ export { loadBasic };
5
+ export * from "@tsparticles/engine";
package/esm/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
5
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
6
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
7
+ export async function loadBasic(engine, refresh = true) {
8
+ await loadBaseMover(engine, false);
9
+ await loadCircleShape(engine, false);
10
+ await loadColorUpdater(engine, false);
11
+ await loadOpacityUpdater(engine, false);
12
+ await loadOutModesUpdater(engine, false);
13
+ await loadSizeUpdater(engine, false);
14
+ await engine.refresh(refresh);
15
+ }
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@tsparticles/basic",
3
+ "version": "3.0.0-beta.0",
4
+ "description": "Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
5
+ "homepage": "https://particles.js.org",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/matteobruni/tsparticles.git",
9
+ "directory": "bundles/basic"
10
+ },
11
+ "keywords": [
12
+ "front-end",
13
+ "frontend",
14
+ "tsparticles",
15
+ "particles.js",
16
+ "particlesjs",
17
+ "particles",
18
+ "particle",
19
+ "canvas",
20
+ "jsparticles",
21
+ "xparticles",
22
+ "particles-js",
23
+ "particles-bg",
24
+ "particles-bg-vue",
25
+ "particles-ts",
26
+ "particles.ts",
27
+ "react-particles-js",
28
+ "react-particles.js",
29
+ "react-particles",
30
+ "react",
31
+ "reactjs",
32
+ "vue-particles",
33
+ "ngx-particles",
34
+ "angular-particles",
35
+ "particleground",
36
+ "vue",
37
+ "vuejs",
38
+ "preact",
39
+ "preactjs",
40
+ "jquery",
41
+ "angularjs",
42
+ "angular",
43
+ "typescript",
44
+ "javascript",
45
+ "animation",
46
+ "web",
47
+ "html5",
48
+ "web-design",
49
+ "webdesign",
50
+ "css",
51
+ "html",
52
+ "css3",
53
+ "animated",
54
+ "background",
55
+ "confetti",
56
+ "canvas",
57
+ "fireworks",
58
+ "fireworks-js",
59
+ "confetti-js",
60
+ "confettijs",
61
+ "fireworksjs",
62
+ "canvas-confetti"
63
+ ],
64
+ "author": "Matteo Bruni <matteo.bruni@me.com>",
65
+ "license": "MIT",
66
+ "bugs": {
67
+ "url": "https://github.com/matteobruni/tsparticles/issues"
68
+ },
69
+ "funding": [
70
+ {
71
+ "type": "github",
72
+ "url": "https://github.com/sponsors/matteobruni"
73
+ },
74
+ {
75
+ "type": "github",
76
+ "url": "https://github.com/sponsors/tsparticles"
77
+ },
78
+ {
79
+ "type": "buymeacoffee",
80
+ "url": "https://www.buymeacoffee.com/matteobruni"
81
+ }
82
+ ],
83
+ "main": "cjs/index.js",
84
+ "module": "esm/index.js",
85
+ "jsdelivr": "tsparticles.basic.bundle.min.js",
86
+ "unpkg": "tsparticles.basic.bundle.min.js",
87
+ "types": "types/index.d.ts",
88
+ "sideEffects": false,
89
+ "dependencies": {
90
+ "@tsparticles/engine": "^3.0.0-beta.0",
91
+ "@tsparticles/move-base": "^3.0.0-beta.0",
92
+ "@tsparticles/shape-circle": "^3.0.0-beta.0",
93
+ "@tsparticles/updater-color": "^3.0.0-beta.0",
94
+ "@tsparticles/updater-opacity": "^3.0.0-beta.0",
95
+ "@tsparticles/updater-out-modes": "^3.0.0-beta.0",
96
+ "@tsparticles/updater-size": "^3.0.0-beta.0"
97
+ },
98
+ "publishConfig": {
99
+ "access": "public"
100
+ }
101
+ }