@tsparticles/shape-cards 3.0.0-alpha.1 → 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/README.md +16 -12
- package/browser/CardsSuitsDrawers.js +4 -4
- package/browser/index.js +5 -5
- package/cjs/CardsSuitsDrawers.js +4 -4
- package/cjs/index.js +5 -16
- package/esm/CardsSuitsDrawers.js +4 -4
- package/esm/index.js +5 -5
- package/package.json +10 -5
- package/report.html +4 -4
- package/tsparticles.shape.cards.js +11 -11
- package/tsparticles.shape.cards.min.js +1 -1
- package/tsparticles.shape.cards.min.js.LICENSE.txt +1 -8
- package/types/CardsSuitsDrawers.d.ts +4 -4
- package/types/index.d.ts +1 -1
- package/umd/CardsSuitsDrawers.js +4 -4
- package/umd/index.js +5 -5
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# tsParticles Cards Shape
|
|
4
4
|
|
|
5
|
-
[](https://www.jsdelivr.com/package/npm/@tsparticles/shape-cards)
|
|
6
|
+
[](https://www.npmjs.com/package/@tsparticles/shape-cards)
|
|
7
|
+
[](https://www.npmjs.com/package/@tsparticles/shape-cards) [](https://github.com/sponsors/matteobruni)
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/matteobruni/tsparticles) additional cards shape.
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ Once the scripts are loaded you can set up `tsParticles` and the shape like this
|
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
28
|
(async () => {
|
|
29
|
-
await loadCardsShape();
|
|
29
|
+
await loadCardsShape(tsParticles);
|
|
30
30
|
|
|
31
31
|
await tsParticles.load({
|
|
32
32
|
id: "tsparticles",
|
|
@@ -44,29 +44,33 @@ Once the scripts are loaded you can set up `tsParticles` and the shape like this
|
|
|
44
44
|
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
|
|
45
45
|
|
|
46
46
|
```shell
|
|
47
|
-
$ npm install tsparticles
|
|
47
|
+
$ npm install @tsparticles/shape-cards
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
or
|
|
51
51
|
|
|
52
52
|
```shell
|
|
53
|
-
$ yarn add tsparticles
|
|
53
|
+
$ yarn add @tsparticles/shape-cards
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Then you need to import it in the app, like this:
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
|
-
const { tsParticles } = require("tsparticles
|
|
60
|
-
const { loadCardsShape } = require("tsparticles
|
|
59
|
+
const { tsParticles } = require("@tsparticles/engine");
|
|
60
|
+
const { loadCardsShape } = require("@tsparticles/shape-cards");
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
(async () => {
|
|
63
|
+
await loadCardsShape(tsParticles);
|
|
64
|
+
})();
|
|
63
65
|
```
|
|
64
66
|
|
|
65
67
|
or
|
|
66
68
|
|
|
67
69
|
```javascript
|
|
68
|
-
import { tsParticles } from "tsparticles
|
|
69
|
-
import { loadCardsShape } from "tsparticles
|
|
70
|
+
import { tsParticles } from "@tsparticles/engine";
|
|
71
|
+
import { loadCardsShape } from "@tsparticles/shape-cards";
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
(async () => {
|
|
74
|
+
await loadCardsShape(tsParticles);
|
|
75
|
+
})();
|
|
72
76
|
```
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { drawPath, paths } from "./Utils";
|
|
2
2
|
export class SpadeDrawer {
|
|
3
|
-
draw(context,
|
|
3
|
+
draw(context, _particle, radius) {
|
|
4
4
|
drawPath(context, radius, paths.spade);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export class HeartDrawer {
|
|
8
|
-
draw(context,
|
|
8
|
+
draw(context, _particle, radius) {
|
|
9
9
|
drawPath(context, radius, paths.heart);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export class DiamondDrawer {
|
|
13
|
-
draw(context,
|
|
13
|
+
draw(context, _particle, radius) {
|
|
14
14
|
drawPath(context, radius, paths.diamond);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export class ClubDrawer {
|
|
18
|
-
draw(context,
|
|
18
|
+
draw(context, _particle, radius) {
|
|
19
19
|
drawPath(context, radius, paths.club);
|
|
20
20
|
}
|
|
21
21
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClubDrawer, DiamondDrawer, HeartDrawer, SpadeDrawer } from "./CardsSuitsDrawers";
|
|
2
|
-
export async function loadCardsShape(engine) {
|
|
3
|
-
await engine.addShape(["spade", "spades"], new SpadeDrawer());
|
|
4
|
-
await engine.addShape(["heart", "hearts"], new HeartDrawer());
|
|
5
|
-
await engine.addShape(["diamond", "diamonds"], new DiamondDrawer());
|
|
6
|
-
await engine.addShape(["club", "clubs"], new ClubDrawer());
|
|
2
|
+
export async function loadCardsShape(engine, refresh = true) {
|
|
3
|
+
await engine.addShape(["spade", "spades"], new SpadeDrawer(), refresh);
|
|
4
|
+
await engine.addShape(["heart", "hearts"], new HeartDrawer(), refresh);
|
|
5
|
+
await engine.addShape(["diamond", "diamonds"], new DiamondDrawer(), refresh);
|
|
6
|
+
await engine.addShape(["club", "clubs"], new ClubDrawer(), refresh);
|
|
7
7
|
}
|
package/cjs/CardsSuitsDrawers.js
CHANGED
|
@@ -3,25 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClubDrawer = exports.DiamondDrawer = exports.HeartDrawer = exports.SpadeDrawer = void 0;
|
|
4
4
|
const Utils_1 = require("./Utils");
|
|
5
5
|
class SpadeDrawer {
|
|
6
|
-
draw(context,
|
|
6
|
+
draw(context, _particle, radius) {
|
|
7
7
|
(0, Utils_1.drawPath)(context, radius, Utils_1.paths.spade);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.SpadeDrawer = SpadeDrawer;
|
|
11
11
|
class HeartDrawer {
|
|
12
|
-
draw(context,
|
|
12
|
+
draw(context, _particle, radius) {
|
|
13
13
|
(0, Utils_1.drawPath)(context, radius, Utils_1.paths.heart);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.HeartDrawer = HeartDrawer;
|
|
17
17
|
class DiamondDrawer {
|
|
18
|
-
draw(context,
|
|
18
|
+
draw(context, _particle, radius) {
|
|
19
19
|
(0, Utils_1.drawPath)(context, radius, Utils_1.paths.diamond);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.DiamondDrawer = DiamondDrawer;
|
|
23
23
|
class ClubDrawer {
|
|
24
|
-
draw(context,
|
|
24
|
+
draw(context, _particle, radius) {
|
|
25
25
|
(0, Utils_1.drawPath)(context, radius, Utils_1.paths.club);
|
|
26
26
|
}
|
|
27
27
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.loadCardsShape = void 0;
|
|
13
4
|
const CardsSuitsDrawers_1 = require("./CardsSuitsDrawers");
|
|
14
|
-
function loadCardsShape(engine) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
yield engine.addShape(["club", "clubs"], new CardsSuitsDrawers_1.ClubDrawer());
|
|
20
|
-
});
|
|
5
|
+
async function loadCardsShape(engine, refresh = true) {
|
|
6
|
+
await engine.addShape(["spade", "spades"], new CardsSuitsDrawers_1.SpadeDrawer(), refresh);
|
|
7
|
+
await engine.addShape(["heart", "hearts"], new CardsSuitsDrawers_1.HeartDrawer(), refresh);
|
|
8
|
+
await engine.addShape(["diamond", "diamonds"], new CardsSuitsDrawers_1.DiamondDrawer(), refresh);
|
|
9
|
+
await engine.addShape(["club", "clubs"], new CardsSuitsDrawers_1.ClubDrawer(), refresh);
|
|
21
10
|
}
|
|
22
11
|
exports.loadCardsShape = loadCardsShape;
|
package/esm/CardsSuitsDrawers.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { drawPath, paths } from "./Utils";
|
|
2
2
|
export class SpadeDrawer {
|
|
3
|
-
draw(context,
|
|
3
|
+
draw(context, _particle, radius) {
|
|
4
4
|
drawPath(context, radius, paths.spade);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export class HeartDrawer {
|
|
8
|
-
draw(context,
|
|
8
|
+
draw(context, _particle, radius) {
|
|
9
9
|
drawPath(context, radius, paths.heart);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export class DiamondDrawer {
|
|
13
|
-
draw(context,
|
|
13
|
+
draw(context, _particle, radius) {
|
|
14
14
|
drawPath(context, radius, paths.diamond);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export class ClubDrawer {
|
|
18
|
-
draw(context,
|
|
18
|
+
draw(context, _particle, radius) {
|
|
19
19
|
drawPath(context, radius, paths.club);
|
|
20
20
|
}
|
|
21
21
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClubDrawer, DiamondDrawer, HeartDrawer, SpadeDrawer } from "./CardsSuitsDrawers";
|
|
2
|
-
export async function loadCardsShape(engine) {
|
|
3
|
-
await engine.addShape(["spade", "spades"], new SpadeDrawer());
|
|
4
|
-
await engine.addShape(["heart", "hearts"], new HeartDrawer());
|
|
5
|
-
await engine.addShape(["diamond", "diamonds"], new DiamondDrawer());
|
|
6
|
-
await engine.addShape(["club", "clubs"], new ClubDrawer());
|
|
2
|
+
export async function loadCardsShape(engine, refresh = true) {
|
|
3
|
+
await engine.addShape(["spade", "spades"], new SpadeDrawer(), refresh);
|
|
4
|
+
await engine.addShape(["heart", "hearts"], new HeartDrawer(), refresh);
|
|
5
|
+
await engine.addShape(["diamond", "diamonds"], new DiamondDrawer(), refresh);
|
|
6
|
+
await engine.addShape(["club", "clubs"], new ClubDrawer(), refresh);
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/shape-cards",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles cards shape",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -72,6 +72,10 @@
|
|
|
72
72
|
"type": "github",
|
|
73
73
|
"url": "https://github.com/sponsors/matteobruni"
|
|
74
74
|
},
|
|
75
|
+
{
|
|
76
|
+
"type": "github",
|
|
77
|
+
"url": "https://github.com/sponsors/tsparticles"
|
|
78
|
+
},
|
|
75
79
|
{
|
|
76
80
|
"type": "buymeacoffee",
|
|
77
81
|
"url": "https://www.buymeacoffee.com/matteobruni"
|
|
@@ -82,10 +86,11 @@
|
|
|
82
86
|
"unpkg": "tsparticles.shape.cards.min.js",
|
|
83
87
|
"module": "esm/index.js",
|
|
84
88
|
"types": "types/index.d.ts",
|
|
89
|
+
"sideEffects": false,
|
|
90
|
+
"dependencies": {
|
|
91
|
+
"@tsparticles/engine": "^3.0.0-beta.0"
|
|
92
|
+
},
|
|
85
93
|
"publishConfig": {
|
|
86
94
|
"access": "public"
|
|
87
|
-
},
|
|
88
|
-
"dependencies": {
|
|
89
|
-
"@tsparticles/engine": "^3.0.0-alpha.1"
|
|
90
95
|
}
|
|
91
|
-
}
|
|
96
|
+
}
|