@tsparticles/shape-cards 4.0.0-beta.9 → 4.0.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.
Files changed (73) hide show
  1. package/browser/browser.js +5 -0
  2. package/browser/cards/index.js +3 -5
  3. package/browser/cards/index.lazy.js +9 -0
  4. package/browser/clubs/index.js +3 -5
  5. package/browser/clubs/index.lazy.js +9 -0
  6. package/browser/diamonds/index.js +3 -5
  7. package/browser/diamonds/index.lazy.js +9 -0
  8. package/browser/hearts/index.js +3 -5
  9. package/browser/hearts/index.lazy.js +9 -0
  10. package/browser/index.js +7 -13
  11. package/browser/index.lazy.js +13 -0
  12. package/browser/spades/index.js +3 -5
  13. package/browser/spades/index.lazy.js +9 -0
  14. package/browser/suits.js +11 -19
  15. package/browser/suits.lazy.js +15 -0
  16. package/browser/utils.js +2 -12
  17. package/cjs/browser.js +5 -0
  18. package/cjs/cards/index.js +3 -5
  19. package/cjs/cards/index.lazy.js +9 -0
  20. package/cjs/clubs/index.js +3 -5
  21. package/cjs/clubs/index.lazy.js +9 -0
  22. package/cjs/diamonds/index.js +3 -5
  23. package/cjs/diamonds/index.lazy.js +9 -0
  24. package/cjs/hearts/index.js +3 -5
  25. package/cjs/hearts/index.lazy.js +9 -0
  26. package/cjs/index.js +7 -13
  27. package/cjs/index.lazy.js +13 -0
  28. package/cjs/spades/index.js +3 -5
  29. package/cjs/spades/index.lazy.js +9 -0
  30. package/cjs/suits.js +11 -19
  31. package/cjs/suits.lazy.js +15 -0
  32. package/cjs/utils.js +2 -12
  33. package/esm/browser.js +5 -0
  34. package/esm/cards/index.js +3 -5
  35. package/esm/cards/index.lazy.js +9 -0
  36. package/esm/clubs/index.js +3 -5
  37. package/esm/clubs/index.lazy.js +9 -0
  38. package/esm/diamonds/index.js +3 -5
  39. package/esm/diamonds/index.lazy.js +9 -0
  40. package/esm/hearts/index.js +3 -5
  41. package/esm/hearts/index.lazy.js +9 -0
  42. package/esm/index.js +7 -13
  43. package/esm/index.lazy.js +13 -0
  44. package/esm/spades/index.js +3 -5
  45. package/esm/spades/index.lazy.js +9 -0
  46. package/esm/suits.js +11 -19
  47. package/esm/suits.lazy.js +15 -0
  48. package/esm/utils.js +2 -12
  49. package/package.json +52 -3
  50. package/report.html +4949 -94
  51. package/tsparticles.shape.cards.js +371 -369
  52. package/tsparticles.shape.cards.min.js +1 -2
  53. package/types/browser.d.ts +1 -0
  54. package/types/cards/index.lazy.d.ts +2 -0
  55. package/types/clubs/index.lazy.d.ts +2 -0
  56. package/types/diamonds/index.lazy.d.ts +2 -0
  57. package/types/hearts/index.lazy.d.ts +2 -0
  58. package/types/index.d.ts +0 -2
  59. package/types/index.lazy.d.ts +2 -0
  60. package/types/spades/index.lazy.d.ts +2 -0
  61. package/types/suits.d.ts +0 -4
  62. package/types/suits.lazy.d.ts +2 -0
  63. package/types/utils.d.ts +1 -2
  64. package/192.min.js +0 -1
  65. package/558.min.js +0 -1
  66. package/676.min.js +0 -1
  67. package/712.min.js +0 -1
  68. package/855.min.js +0 -1
  69. package/dist_browser_cards_CardDrawer_js.js +0 -60
  70. package/dist_browser_clubs_ClubDrawer_js.js +0 -50
  71. package/dist_browser_diamonds_DiamondDrawer_js.js +0 -50
  72. package/dist_browser_hearts_HeartDrawer_js.js +0 -50
  73. package/dist_browser_spades_SpadeDrawer_js.js +0 -50
@@ -1,9 +1,7 @@
1
+ import { SpadeDrawer } from "./SpadeDrawer.js";
1
2
  export async function loadSpadesSuitShape(engine) {
2
- engine.checkVersion("4.0.0-beta.9");
3
+ engine.checkVersion("4.0.0");
3
4
  await engine.pluginManager.register(e => {
4
- e.pluginManager.addShape(["spade", "spades"], async () => {
5
- const { SpadeDrawer } = await import("./SpadeDrawer.js");
6
- return new SpadeDrawer();
7
- });
5
+ e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
8
6
  });
9
7
  }
@@ -0,0 +1,9 @@
1
+ export async function loadSpadesSuitShape(engine) {
2
+ engine.checkVersion("4.0.0");
3
+ await engine.pluginManager.register(e => {
4
+ e.pluginManager.addShape(["spade", "spades"], async () => {
5
+ const { SpadeDrawer } = await import("./SpadeDrawer.js");
6
+ return new SpadeDrawer();
7
+ });
8
+ });
9
+ }
package/esm/suits.js CHANGED
@@ -1,21 +1,13 @@
1
+ import { loadClubsSuitShape } from "./clubs/index.js";
2
+ import { loadDiamondsSuitShape } from "./diamonds/index.js";
3
+ import { loadHeartsSuitShape } from "./hearts/index.js";
4
+ import { loadSpadesSuitShape } from "./spades/index.js";
1
5
  export async function loadCardSuitsShape(engine) {
2
- engine.checkVersion("4.0.0-beta.9");
3
- await engine.pluginManager.register(async (e) => {
4
- const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape },] = await Promise.all([
5
- import("./clubs/index.js"),
6
- import("./diamonds/index.js"),
7
- import("./hearts/index.js"),
8
- import("./spades/index.js"),
9
- ]);
10
- await Promise.all([
11
- loadClubsSuitShape(e),
12
- loadDiamondsSuitShape(e),
13
- loadHeartsSuitShape(e),
14
- loadSpadesSuitShape(e),
15
- ]);
16
- });
6
+ engine.checkVersion("4.0.0");
7
+ await Promise.all([
8
+ loadClubsSuitShape(engine),
9
+ loadDiamondsSuitShape(engine),
10
+ loadHeartsSuitShape(engine),
11
+ loadSpadesSuitShape(engine),
12
+ ]);
17
13
  }
18
- export * from "./clubs/index.js";
19
- export * from "./diamonds/index.js";
20
- export * from "./hearts/index.js";
21
- export * from "./spades/index.js";
@@ -0,0 +1,15 @@
1
+ export async function loadCardSuitsShape(engine) {
2
+ engine.checkVersion("4.0.0");
3
+ const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape }] = await Promise.all([
4
+ import("./clubs/index.lazy.js"),
5
+ import("./diamonds/index.lazy.js"),
6
+ import("./hearts/index.lazy.js"),
7
+ import("./spades/index.lazy.js"),
8
+ ]);
9
+ await Promise.all([
10
+ loadClubsSuitShape(engine),
11
+ loadDiamondsSuitShape(engine),
12
+ loadHeartsSuitShape(engine),
13
+ loadSpadesSuitShape(engine),
14
+ ]);
15
+ }
package/esm/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { double, doublePI, getStyleFromRgb, half, originPoint, safeDocument, triple, } from "@tsparticles/engine";
1
+ import { double, doublePI, getStyleFromRgb, half, originPoint, triple } from "@tsparticles/engine";
2
2
  import { SuitType } from "./SuitType.js";
3
3
  import { drawPath } from "@tsparticles/path-utils";
4
4
  import { paths } from "./paths.js";
@@ -11,17 +11,7 @@ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSetti
11
11
  const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
12
12
  let cachedData = cardsCache.get(cacheKey);
13
13
  if (!cachedData) {
14
- let cacheCanvas, cacheCtx;
15
- if (typeof OffscreenCanvas === "undefined") {
16
- cacheCanvas = safeDocument().createElement("canvas");
17
- cacheCanvas.width = cardWidth;
18
- cacheCanvas.height = cardHeight;
19
- cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
20
- }
21
- else {
22
- cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight);
23
- cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
24
- }
14
+ const cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight), cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
25
15
  if (cacheCtx) {
26
16
  cacheCtx.translate(halfWidth, halfHeight);
27
17
  drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-cards",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0",
4
4
  "description": "tsParticles cards shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -96,6 +96,13 @@
96
96
  "require": "./cjs/index.js",
97
97
  "default": "./esm/index.js"
98
98
  },
99
+ "./lazy": {
100
+ "types": "./types/index.lazy.d.ts",
101
+ "browser": "./browser/index.lazy.js",
102
+ "import": "./esm/index.lazy.js",
103
+ "require": "./cjs/index.lazy.js",
104
+ "default": "./esm/index.lazy.js"
105
+ },
99
106
  "./cards": {
100
107
  "types": "./types/cards/index.d.ts",
101
108
  "browser": "./browser/cards/index.js",
@@ -103,6 +110,13 @@
103
110
  "require": "./cjs/cards/index.js",
104
111
  "default": "./esm/cards/index.js"
105
112
  },
113
+ "./cards/lazy": {
114
+ "types": "./types/cards/index.lazy.d.ts",
115
+ "browser": "./browser/cards/index.lazy.js",
116
+ "import": "./esm/cards/index.lazy.js",
117
+ "require": "./cjs/cards/index.lazy.js",
118
+ "default": "./esm/cards/index.lazy.js"
119
+ },
106
120
  "./clubs": {
107
121
  "types": "./types/clubs/index.d.ts",
108
122
  "browser": "./browser/clubs/index.js",
@@ -110,6 +124,13 @@
110
124
  "require": "./cjs/clubs/index.js",
111
125
  "default": "./esm/clubs/index.js"
112
126
  },
127
+ "./clubs/lazy": {
128
+ "types": "./types/clubs/index.lazy.d.ts",
129
+ "browser": "./browser/clubs/index.lazy.js",
130
+ "import": "./esm/clubs/index.lazy.js",
131
+ "require": "./cjs/clubs/index.lazy.js",
132
+ "default": "./esm/clubs/index.lazy.js"
133
+ },
113
134
  "./diamons": {
114
135
  "types": "./types/diamons/index.d.ts",
115
136
  "browser": "./browser/diamons/index.js",
@@ -117,6 +138,13 @@
117
138
  "require": "./cjs/diamons/index.js",
118
139
  "default": "./esm/diamons/index.js"
119
140
  },
141
+ "./diamons/lazy": {
142
+ "types": "./types/diamons/index.lazy.d.ts",
143
+ "browser": "./browser/diamons/index.lazy.js",
144
+ "import": "./esm/diamons/index.lazy.js",
145
+ "require": "./cjs/diamons/index.lazy.js",
146
+ "default": "./esm/diamons/index.lazy.js"
147
+ },
120
148
  "./hearts": {
121
149
  "types": "./types/hearts/index.d.ts",
122
150
  "browser": "./browser/hearts/index.js",
@@ -124,6 +152,13 @@
124
152
  "require": "./cjs/hearts/index.js",
125
153
  "default": "./esm/hearts/index.js"
126
154
  },
155
+ "./hearts/lazy": {
156
+ "types": "./types/hearts/index.lazy.d.ts",
157
+ "browser": "./browser/hearts/index.lazy.js",
158
+ "import": "./esm/hearts/index.lazy.js",
159
+ "require": "./cjs/hearts/index.lazy.js",
160
+ "default": "./esm/hearts/index.lazy.js"
161
+ },
127
162
  "./spades": {
128
163
  "types": "./types/spades/index.d.ts",
129
164
  "browser": "./browser/spades/index.js",
@@ -131,6 +166,13 @@
131
166
  "require": "./cjs/spades/index.js",
132
167
  "default": "./esm/spades/index.js"
133
168
  },
169
+ "./spades/lazy": {
170
+ "types": "./types/spades/index.lazy.d.ts",
171
+ "browser": "./browser/spades/index.lazy.js",
172
+ "import": "./esm/spades/index.lazy.js",
173
+ "require": "./cjs/spades/index.lazy.js",
174
+ "default": "./esm/spades/index.lazy.js"
175
+ },
134
176
  "./suits": {
135
177
  "types": "./types/suits.d.ts",
136
178
  "browser": "./browser/suits.js",
@@ -138,11 +180,18 @@
138
180
  "require": "./cjs/suits.js",
139
181
  "default": "./esm/suits.js"
140
182
  },
183
+ "./suits/lazy": {
184
+ "types": "./types/suits.lazy.d.ts",
185
+ "browser": "./browser/suits.lazy.js",
186
+ "import": "./esm/suits.lazy.js",
187
+ "require": "./cjs/suits.lazy.js",
188
+ "default": "./esm/suits.lazy.js"
189
+ },
141
190
  "./package.json": "./package.json"
142
191
  },
143
192
  "peerDependencies": {
144
- "@tsparticles/engine": "4.0.0-beta.9",
145
- "@tsparticles/path-utils": "4.0.0-beta.9"
193
+ "@tsparticles/engine": "4.0.0",
194
+ "@tsparticles/path-utils": "4.0.0"
146
195
  },
147
196
  "publishConfig": {
148
197
  "access": "public"