@tsparticles/shape-cards 4.3.1 → 4.4.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 (53) hide show
  1. package/browser/cards/CardDrawer.js +1 -1
  2. package/browser/cards/index.js +1 -1
  3. package/browser/cards/index.lazy.js +1 -1
  4. package/browser/clubs/index.js +1 -1
  5. package/browser/clubs/index.lazy.js +1 -1
  6. package/browser/diamonds/index.js +1 -1
  7. package/browser/diamonds/index.lazy.js +1 -1
  8. package/browser/hearts/index.js +1 -1
  9. package/browser/hearts/index.lazy.js +1 -1
  10. package/browser/index.js +1 -1
  11. package/browser/index.lazy.js +1 -1
  12. package/browser/spades/index.js +1 -1
  13. package/browser/spades/index.lazy.js +1 -1
  14. package/browser/suits.js +1 -1
  15. package/browser/suits.lazy.js +1 -1
  16. package/browser/utils.js +13 -11
  17. package/cjs/cards/CardDrawer.js +1 -1
  18. package/cjs/cards/index.js +1 -1
  19. package/cjs/cards/index.lazy.js +1 -1
  20. package/cjs/clubs/index.js +1 -1
  21. package/cjs/clubs/index.lazy.js +1 -1
  22. package/cjs/diamonds/index.js +1 -1
  23. package/cjs/diamonds/index.lazy.js +1 -1
  24. package/cjs/hearts/index.js +1 -1
  25. package/cjs/hearts/index.lazy.js +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.lazy.js +1 -1
  28. package/cjs/spades/index.js +1 -1
  29. package/cjs/spades/index.lazy.js +1 -1
  30. package/cjs/suits.js +1 -1
  31. package/cjs/suits.lazy.js +1 -1
  32. package/cjs/utils.js +13 -11
  33. package/esm/cards/CardDrawer.js +1 -1
  34. package/esm/cards/index.js +1 -1
  35. package/esm/cards/index.lazy.js +1 -1
  36. package/esm/clubs/index.js +1 -1
  37. package/esm/clubs/index.lazy.js +1 -1
  38. package/esm/diamonds/index.js +1 -1
  39. package/esm/diamonds/index.lazy.js +1 -1
  40. package/esm/hearts/index.js +1 -1
  41. package/esm/hearts/index.lazy.js +1 -1
  42. package/esm/index.js +1 -1
  43. package/esm/index.lazy.js +1 -1
  44. package/esm/spades/index.js +1 -1
  45. package/esm/spades/index.lazy.js +1 -1
  46. package/esm/suits.js +1 -1
  47. package/esm/suits.lazy.js +1 -1
  48. package/esm/utils.js +13 -11
  49. package/package.json +3 -3
  50. package/report.html +1 -1
  51. package/tsparticles.shape.cards.js +21 -19
  52. package/tsparticles.shape.cards.min.js +1 -1
  53. package/types/utils.d.ts +2 -1
@@ -12,7 +12,7 @@ export class CardDrawer {
12
12
  }
13
13
  const defaultOpacity = context.globalAlpha, container = this.#container;
14
14
  context.globalAlpha = opacity;
15
- drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings);
15
+ drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings, container.peakNits, container.hdrMode);
16
16
  context.globalAlpha = defaultOpacity;
17
17
  }
18
18
  particleInit(_container, particle) {
@@ -1,6 +1,6 @@
1
1
  import { CardDrawer } from "./CardDrawer.js";
2
2
  export async function loadFullCardsShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["card"], container => Promise.resolve(new CardDrawer(container)));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadFullCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["card"], async (container) => {
5
5
  const { CardDrawer } = await import("./CardDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { ClubDrawer } from "./ClubDrawer.js";
2
2
  export async function loadClubsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadClubsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["club", "clubs"], async () => {
5
5
  const { ClubDrawer } = await import("./ClubDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { DiamondDrawer } from "./DiamondDrawer.js";
2
2
  export async function loadDiamondsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadDiamondsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["diamond", "diamonds"], async () => {
5
5
  const { DiamondDrawer } = await import("./DiamondDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { HeartDrawer } from "./HeartDrawer.js";
2
2
  export async function loadHeartsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadHeartsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["heart", "hearts"], async () => {
5
5
  const { HeartDrawer } = await import("./HeartDrawer.js");
package/browser/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { loadCardSuitsShape } from "./suits.js";
2
2
  import { loadFullCardsShape } from "./cards/index.js";
3
3
  export async function loadCardsShape(engine) {
4
- engine.checkVersion("4.3.1");
4
+ engine.checkVersion("4.4.0");
5
5
  await Promise.all([
6
6
  loadFullCardsShape(engine),
7
7
  loadCardSuitsShape(engine),
@@ -1,5 +1,5 @@
1
1
  export async function loadCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ loadFullCardsShape }, { loadCardSuitsShape }] = await Promise.all([
5
5
  import("./cards/index.lazy.js"),
@@ -1,6 +1,6 @@
1
1
  import { SpadeDrawer } from "./SpadeDrawer.js";
2
2
  export async function loadSpadesSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadSpadesSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["spade", "spades"], async () => {
5
5
  const { SpadeDrawer } = await import("./SpadeDrawer.js");
package/browser/suits.js CHANGED
@@ -3,7 +3,7 @@ import { loadDiamondsSuitShape } from "./diamonds/index.js";
3
3
  import { loadHeartsSuitShape } from "./hearts/index.js";
4
4
  import { loadSpadesSuitShape } from "./spades/index.js";
5
5
  export async function loadCardSuitsShape(engine) {
6
- engine.checkVersion("4.3.1");
6
+ engine.checkVersion("4.4.0");
7
7
  await Promise.all([
8
8
  loadClubsSuitShape(engine),
9
9
  loadDiamondsSuitShape(engine),
@@ -1,5 +1,5 @@
1
1
  export async function loadCardSuitsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape }] = await Promise.all([
4
4
  import("./clubs/index.lazy.js"),
5
5
  import("./diamonds/index.lazy.js"),
package/browser/utils.js CHANGED
@@ -1,20 +1,20 @@
1
- import { double, doublePI, getStyleFromRgb, half, originPoint, 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";
5
5
  const cardWidthRatio = (double * double) / triple, cardHeightRatio = double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = { r: 215, g: 20, b: 20 }, blackSuitColor = { r: 18, g: 18, b: 18 };
6
- export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {
6
+ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings, peakNits, mode) {
7
7
  if (flipped) {
8
8
  drawRoundedCardBack(ctx, radius);
9
9
  }
10
10
  else {
11
- const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
11
+ const cacheKey = getCacheKey(radius, hdr, cardData, peakNits, mode), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
12
12
  let cachedData = cardsCache.get(cacheKey);
13
13
  if (!cachedData) {
14
14
  const cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight), cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
15
15
  if (cacheCtx) {
16
16
  cacheCtx.translate(halfWidth, halfHeight);
17
- drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
17
+ drawRoundedCardFront(cacheCtx, radius, cardData, hdr, peakNits, mode);
18
18
  cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();
19
19
  cardsCache.set(cacheKey, cachedData);
20
20
  }
@@ -23,23 +23,25 @@ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSetti
23
23
  ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);
24
24
  }
25
25
  else {
26
- drawRoundedCardFront(ctx, radius, cardData, hdr);
26
+ drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode);
27
27
  }
28
28
  }
29
29
  }
30
- function getCacheKey(radius, hdr, cardData) {
31
- return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${cardData.suit}-${cardData.value}`;
30
+ function getCacheKey(radius, hdr, cardData, peakNits, mode) {
31
+ return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${peakNits !== undefined ? peakNits.toFixed(fixedCacheKey) : "default"}-${mode ?? "default"}-${cardData.suit}-${cardData.value}`;
32
32
  }
33
33
  function drawRoundedCardBack(ctx, radius) {
34
34
  drawCardBody(ctx, radius);
35
35
  }
36
- function drawRoundedCardFront(ctx, radius, cardData, hdr) {
37
- const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed ? getStyleFromRgb(redSuitColor, hdr) : getStyleFromRgb(blackSuitColor, hdr);
36
+ function drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode) {
37
+ const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed
38
+ ? getStyleFromRgb(redSuitColor, hdr, undefined, peakNits, mode)
39
+ : getStyleFromRgb(blackSuitColor, hdr, undefined, peakNits, mode);
38
40
  ctx.save();
39
41
  drawCardBody(ctx, radius);
40
- ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
42
+ ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr, undefined, peakNits, mode);
41
43
  ctx.fill();
42
- ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
44
+ ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr, undefined, peakNits, mode);
43
45
  ctx.stroke();
44
46
  ctx.fillStyle = color;
45
47
  ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
@@ -12,7 +12,7 @@ export class CardDrawer {
12
12
  }
13
13
  const defaultOpacity = context.globalAlpha, container = this.#container;
14
14
  context.globalAlpha = opacity;
15
- drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings);
15
+ drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings, container.peakNits, container.hdrMode);
16
16
  context.globalAlpha = defaultOpacity;
17
17
  }
18
18
  particleInit(_container, particle) {
@@ -1,6 +1,6 @@
1
1
  import { CardDrawer } from "./CardDrawer.js";
2
2
  export async function loadFullCardsShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["card"], container => Promise.resolve(new CardDrawer(container)));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadFullCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["card"], async (container) => {
5
5
  const { CardDrawer } = await import("./CardDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { ClubDrawer } from "./ClubDrawer.js";
2
2
  export async function loadClubsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadClubsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["club", "clubs"], async () => {
5
5
  const { ClubDrawer } = await import("./ClubDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { DiamondDrawer } from "./DiamondDrawer.js";
2
2
  export async function loadDiamondsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadDiamondsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["diamond", "diamonds"], async () => {
5
5
  const { DiamondDrawer } = await import("./DiamondDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { HeartDrawer } from "./HeartDrawer.js";
2
2
  export async function loadHeartsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadHeartsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["heart", "hearts"], async () => {
5
5
  const { HeartDrawer } = await import("./HeartDrawer.js");
package/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { loadCardSuitsShape } from "./suits.js";
2
2
  import { loadFullCardsShape } from "./cards/index.js";
3
3
  export async function loadCardsShape(engine) {
4
- engine.checkVersion("4.3.1");
4
+ engine.checkVersion("4.4.0");
5
5
  await Promise.all([
6
6
  loadFullCardsShape(engine),
7
7
  loadCardSuitsShape(engine),
package/cjs/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ loadFullCardsShape }, { loadCardSuitsShape }] = await Promise.all([
5
5
  import("./cards/index.lazy.js"),
@@ -1,6 +1,6 @@
1
1
  import { SpadeDrawer } from "./SpadeDrawer.js";
2
2
  export async function loadSpadesSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadSpadesSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["spade", "spades"], async () => {
5
5
  const { SpadeDrawer } = await import("./SpadeDrawer.js");
package/cjs/suits.js CHANGED
@@ -3,7 +3,7 @@ import { loadDiamondsSuitShape } from "./diamonds/index.js";
3
3
  import { loadHeartsSuitShape } from "./hearts/index.js";
4
4
  import { loadSpadesSuitShape } from "./spades/index.js";
5
5
  export async function loadCardSuitsShape(engine) {
6
- engine.checkVersion("4.3.1");
6
+ engine.checkVersion("4.4.0");
7
7
  await Promise.all([
8
8
  loadClubsSuitShape(engine),
9
9
  loadDiamondsSuitShape(engine),
package/cjs/suits.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadCardSuitsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape }] = await Promise.all([
4
4
  import("./clubs/index.lazy.js"),
5
5
  import("./diamonds/index.lazy.js"),
package/cjs/utils.js CHANGED
@@ -1,20 +1,20 @@
1
- import { double, doublePI, getStyleFromRgb, half, originPoint, 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";
5
5
  const cardWidthRatio = (double * double) / triple, cardHeightRatio = double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = { r: 215, g: 20, b: 20 }, blackSuitColor = { r: 18, g: 18, b: 18 };
6
- export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {
6
+ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings, peakNits, mode) {
7
7
  if (flipped) {
8
8
  drawRoundedCardBack(ctx, radius);
9
9
  }
10
10
  else {
11
- const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
11
+ const cacheKey = getCacheKey(radius, hdr, cardData, peakNits, mode), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
12
12
  let cachedData = cardsCache.get(cacheKey);
13
13
  if (!cachedData) {
14
14
  const cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight), cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
15
15
  if (cacheCtx) {
16
16
  cacheCtx.translate(halfWidth, halfHeight);
17
- drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
17
+ drawRoundedCardFront(cacheCtx, radius, cardData, hdr, peakNits, mode);
18
18
  cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();
19
19
  cardsCache.set(cacheKey, cachedData);
20
20
  }
@@ -23,23 +23,25 @@ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSetti
23
23
  ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);
24
24
  }
25
25
  else {
26
- drawRoundedCardFront(ctx, radius, cardData, hdr);
26
+ drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode);
27
27
  }
28
28
  }
29
29
  }
30
- function getCacheKey(radius, hdr, cardData) {
31
- return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${cardData.suit}-${cardData.value}`;
30
+ function getCacheKey(radius, hdr, cardData, peakNits, mode) {
31
+ return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${peakNits !== undefined ? peakNits.toFixed(fixedCacheKey) : "default"}-${mode ?? "default"}-${cardData.suit}-${cardData.value}`;
32
32
  }
33
33
  function drawRoundedCardBack(ctx, radius) {
34
34
  drawCardBody(ctx, radius);
35
35
  }
36
- function drawRoundedCardFront(ctx, radius, cardData, hdr) {
37
- const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed ? getStyleFromRgb(redSuitColor, hdr) : getStyleFromRgb(blackSuitColor, hdr);
36
+ function drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode) {
37
+ const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed
38
+ ? getStyleFromRgb(redSuitColor, hdr, undefined, peakNits, mode)
39
+ : getStyleFromRgb(blackSuitColor, hdr, undefined, peakNits, mode);
38
40
  ctx.save();
39
41
  drawCardBody(ctx, radius);
40
- ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
42
+ ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr, undefined, peakNits, mode);
41
43
  ctx.fill();
42
- ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
44
+ ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr, undefined, peakNits, mode);
43
45
  ctx.stroke();
44
46
  ctx.fillStyle = color;
45
47
  ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
@@ -12,7 +12,7 @@ export class CardDrawer {
12
12
  }
13
13
  const defaultOpacity = context.globalAlpha, container = this.#container;
14
14
  context.globalAlpha = opacity;
15
- drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings);
15
+ drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings, container.peakNits, container.hdrMode);
16
16
  context.globalAlpha = defaultOpacity;
17
17
  }
18
18
  particleInit(_container, particle) {
@@ -1,6 +1,6 @@
1
1
  import { CardDrawer } from "./CardDrawer.js";
2
2
  export async function loadFullCardsShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["card"], container => Promise.resolve(new CardDrawer(container)));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadFullCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["card"], async (container) => {
5
5
  const { CardDrawer } = await import("./CardDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { ClubDrawer } from "./ClubDrawer.js";
2
2
  export async function loadClubsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadClubsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["club", "clubs"], async () => {
5
5
  const { ClubDrawer } = await import("./ClubDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { DiamondDrawer } from "./DiamondDrawer.js";
2
2
  export async function loadDiamondsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadDiamondsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["diamond", "diamonds"], async () => {
5
5
  const { DiamondDrawer } = await import("./DiamondDrawer.js");
@@ -1,6 +1,6 @@
1
1
  import { HeartDrawer } from "./HeartDrawer.js";
2
2
  export async function loadHeartsSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadHeartsSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["heart", "hearts"], async () => {
5
5
  const { HeartDrawer } = await import("./HeartDrawer.js");
package/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { loadCardSuitsShape } from "./suits.js";
2
2
  import { loadFullCardsShape } from "./cards/index.js";
3
3
  export async function loadCardsShape(engine) {
4
- engine.checkVersion("4.3.1");
4
+ engine.checkVersion("4.4.0");
5
5
  await Promise.all([
6
6
  loadFullCardsShape(engine),
7
7
  loadCardSuitsShape(engine),
package/esm/index.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadCardsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(async (e) => {
4
4
  const [{ loadFullCardsShape }, { loadCardSuitsShape }] = await Promise.all([
5
5
  import("./cards/index.lazy.js"),
@@ -1,6 +1,6 @@
1
1
  import { SpadeDrawer } from "./SpadeDrawer.js";
2
2
  export async function loadSpadesSuitShape(engine) {
3
- engine.checkVersion("4.3.1");
3
+ engine.checkVersion("4.4.0");
4
4
  await engine.pluginManager.register(e => {
5
5
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
6
6
  });
@@ -1,5 +1,5 @@
1
1
  export async function loadSpadesSuitShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  await engine.pluginManager.register(e => {
4
4
  e.pluginManager.addShape(["spade", "spades"], async () => {
5
5
  const { SpadeDrawer } = await import("./SpadeDrawer.js");
package/esm/suits.js CHANGED
@@ -3,7 +3,7 @@ import { loadDiamondsSuitShape } from "./diamonds/index.js";
3
3
  import { loadHeartsSuitShape } from "./hearts/index.js";
4
4
  import { loadSpadesSuitShape } from "./spades/index.js";
5
5
  export async function loadCardSuitsShape(engine) {
6
- engine.checkVersion("4.3.1");
6
+ engine.checkVersion("4.4.0");
7
7
  await Promise.all([
8
8
  loadClubsSuitShape(engine),
9
9
  loadDiamondsSuitShape(engine),
package/esm/suits.lazy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export async function loadCardSuitsShape(engine) {
2
- engine.checkVersion("4.3.1");
2
+ engine.checkVersion("4.4.0");
3
3
  const [{ loadClubsSuitShape }, { loadDiamondsSuitShape }, { loadHeartsSuitShape }, { loadSpadesSuitShape }] = await Promise.all([
4
4
  import("./clubs/index.lazy.js"),
5
5
  import("./diamonds/index.lazy.js"),
package/esm/utils.js CHANGED
@@ -1,20 +1,20 @@
1
- import { double, doublePI, getStyleFromRgb, half, originPoint, 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";
5
5
  const cardWidthRatio = (double * double) / triple, cardHeightRatio = double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = { r: 215, g: 20, b: 20 }, blackSuitColor = { r: 18, g: 18, b: 18 };
6
- export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {
6
+ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings, peakNits, mode) {
7
7
  if (flipped) {
8
8
  drawRoundedCardBack(ctx, radius);
9
9
  }
10
10
  else {
11
- const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
11
+ const cacheKey = getCacheKey(radius, hdr, cardData, peakNits, mode), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half;
12
12
  let cachedData = cardsCache.get(cacheKey);
13
13
  if (!cachedData) {
14
14
  const cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight), cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
15
15
  if (cacheCtx) {
16
16
  cacheCtx.translate(halfWidth, halfHeight);
17
- drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
17
+ drawRoundedCardFront(cacheCtx, radius, cardData, hdr, peakNits, mode);
18
18
  cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();
19
19
  cardsCache.set(cacheKey, cachedData);
20
20
  }
@@ -23,23 +23,25 @@ export function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSetti
23
23
  ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);
24
24
  }
25
25
  else {
26
- drawRoundedCardFront(ctx, radius, cardData, hdr);
26
+ drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode);
27
27
  }
28
28
  }
29
29
  }
30
- function getCacheKey(radius, hdr, cardData) {
31
- return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${cardData.suit}-${cardData.value}`;
30
+ function getCacheKey(radius, hdr, cardData, peakNits, mode) {
31
+ return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${peakNits !== undefined ? peakNits.toFixed(fixedCacheKey) : "default"}-${mode ?? "default"}-${cardData.suit}-${cardData.value}`;
32
32
  }
33
33
  function drawRoundedCardBack(ctx, radius) {
34
34
  drawCardBody(ctx, radius);
35
35
  }
36
- function drawRoundedCardFront(ctx, radius, cardData, hdr) {
37
- const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed ? getStyleFromRgb(redSuitColor, hdr) : getStyleFromRgb(blackSuitColor, hdr);
36
+ function drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode) {
37
+ const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * half, halfHeight = cardHeight * half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed
38
+ ? getStyleFromRgb(redSuitColor, hdr, undefined, peakNits, mode)
39
+ : getStyleFromRgb(blackSuitColor, hdr, undefined, peakNits, mode);
38
40
  ctx.save();
39
41
  drawCardBody(ctx, radius);
40
- ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
42
+ ctx.fillStyle = getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr, undefined, peakNits, mode);
41
43
  ctx.fill();
42
- ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
44
+ ctx.strokeStyle = getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr, undefined, peakNits, mode);
43
45
  ctx.stroke();
44
46
  ctx.fillStyle = color;
45
47
  ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-cards",
3
- "version": "4.3.1",
3
+ "version": "4.4.0",
4
4
  "description": "tsParticles cards shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -190,13 +190,13 @@
190
190
  "./package.json": "./package.json"
191
191
  },
192
192
  "peerDependencies": {
193
- "@tsparticles/engine": "4.3.1"
193
+ "@tsparticles/engine": "4.4.0"
194
194
  },
195
195
  "publishConfig": {
196
196
  "access": "public"
197
197
  },
198
198
  "type": "module",
199
199
  "dependencies": {
200
- "@tsparticles/path-utils": "4.3.1"
200
+ "@tsparticles/path-utils": "4.4.0"
201
201
  }
202
202
  }
package/report.html CHANGED
@@ -4930,7 +4930,7 @@ var drawChart = (function (exports) {
4930
4930
  </script>
4931
4931
  <script>
4932
4932
  /*<!--*/
4933
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.shape.cards.js","children":[{"name":"dist/browser","children":[{"uid":"235e1c77-1","name":"SuitType.js"},{"uid":"235e1c77-3","name":"paths.js"},{"name":"clubs","children":[{"uid":"235e1c77-5","name":"ClubDrawer.js"},{"uid":"235e1c77-7","name":"index.js"}]},{"name":"diamonds","children":[{"uid":"235e1c77-9","name":"DiamondDrawer.js"},{"uid":"235e1c77-11","name":"index.js"}]},{"name":"hearts","children":[{"uid":"235e1c77-13","name":"HeartDrawer.js"},{"uid":"235e1c77-15","name":"index.js"}]},{"name":"spades","children":[{"uid":"235e1c77-17","name":"SpadeDrawer.js"},{"uid":"235e1c77-19","name":"index.js"}]},{"uid":"235e1c77-21","name":"suits.js"},{"uid":"235e1c77-23","name":"utils.js"},{"name":"cards","children":[{"uid":"235e1c77-25","name":"CardDrawer.js"},{"uid":"235e1c77-27","name":"index.js"}]},{"uid":"235e1c77-29","name":"index.js"},{"uid":"235e1c77-31","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"235e1c77-1":{"renderedLength":239,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-0"},"235e1c77-3":{"renderedLength":5744,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-2"},"235e1c77-5":{"renderedLength":167,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-4"},"235e1c77-7":{"renderedLength":252,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-6"},"235e1c77-9":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-8"},"235e1c77-11":{"renderedLength":264,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-10"},"235e1c77-13":{"renderedLength":169,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-12"},"235e1c77-15":{"renderedLength":256,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-14"},"235e1c77-17":{"renderedLength":169,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-16"},"235e1c77-19":{"renderedLength":256,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-18"},"235e1c77-21":{"renderedLength":296,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-20"},"235e1c77-23":{"renderedLength":5248,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-22"},"235e1c77-25":{"renderedLength":849,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-24"},"235e1c77-27":{"renderedLength":259,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-26"},"235e1c77-29":{"renderedLength":207,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-28"},"235e1c77-31":{"renderedLength":171,"gzipLength":0,"brotliLength":0,"metaUid":"235e1c77-30"}},"nodeMetas":{"235e1c77-0":{"id":"/dist/browser/SuitType.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-1"},"imported":[],"importedBy":[{"uid":"235e1c77-22"},{"uid":"235e1c77-2"}]},"235e1c77-2":{"id":"/dist/browser/paths.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-3"},"imported":[{"uid":"235e1c77-33"},{"uid":"235e1c77-32"},{"uid":"235e1c77-0"}],"importedBy":[{"uid":"235e1c77-4"},{"uid":"235e1c77-8"},{"uid":"235e1c77-12"},{"uid":"235e1c77-16"},{"uid":"235e1c77-22"}]},"235e1c77-4":{"id":"/dist/browser/clubs/ClubDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-5"},"imported":[{"uid":"235e1c77-33"},{"uid":"235e1c77-2"}],"importedBy":[{"uid":"235e1c77-6"}]},"235e1c77-6":{"id":"/dist/browser/clubs/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-7"},"imported":[{"uid":"235e1c77-4"}],"importedBy":[{"uid":"235e1c77-20"}]},"235e1c77-8":{"id":"/dist/browser/diamonds/DiamondDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-9"},"imported":[{"uid":"235e1c77-33"},{"uid":"235e1c77-2"}],"importedBy":[{"uid":"235e1c77-10"}]},"235e1c77-10":{"id":"/dist/browser/diamonds/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-11"},"imported":[{"uid":"235e1c77-8"}],"importedBy":[{"uid":"235e1c77-20"}]},"235e1c77-12":{"id":"/dist/browser/hearts/HeartDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-13"},"imported":[{"uid":"235e1c77-33"},{"uid":"235e1c77-2"}],"importedBy":[{"uid":"235e1c77-14"}]},"235e1c77-14":{"id":"/dist/browser/hearts/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-15"},"imported":[{"uid":"235e1c77-12"}],"importedBy":[{"uid":"235e1c77-20"}]},"235e1c77-16":{"id":"/dist/browser/spades/SpadeDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-17"},"imported":[{"uid":"235e1c77-33"},{"uid":"235e1c77-2"}],"importedBy":[{"uid":"235e1c77-18"}]},"235e1c77-18":{"id":"/dist/browser/spades/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-19"},"imported":[{"uid":"235e1c77-16"}],"importedBy":[{"uid":"235e1c77-20"}]},"235e1c77-20":{"id":"/dist/browser/suits.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-21"},"imported":[{"uid":"235e1c77-6"},{"uid":"235e1c77-10"},{"uid":"235e1c77-14"},{"uid":"235e1c77-18"}],"importedBy":[{"uid":"235e1c77-28"}]},"235e1c77-22":{"id":"/dist/browser/utils.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-23"},"imported":[{"uid":"235e1c77-32"},{"uid":"235e1c77-0"},{"uid":"235e1c77-33"},{"uid":"235e1c77-2"}],"importedBy":[{"uid":"235e1c77-24"}]},"235e1c77-24":{"id":"/dist/browser/cards/CardDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-25"},"imported":[{"uid":"235e1c77-32"},{"uid":"235e1c77-22"}],"importedBy":[{"uid":"235e1c77-26"}]},"235e1c77-26":{"id":"/dist/browser/cards/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-27"},"imported":[{"uid":"235e1c77-24"}],"importedBy":[{"uid":"235e1c77-28"}]},"235e1c77-28":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-29"},"imported":[{"uid":"235e1c77-20"},{"uid":"235e1c77-26"}],"importedBy":[{"uid":"235e1c77-30"}]},"235e1c77-30":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.shape.cards.js":"235e1c77-31"},"imported":[{"uid":"235e1c77-28"}],"importedBy":[],"isEntry":true},"235e1c77-32":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"235e1c77-24"},{"uid":"235e1c77-22"},{"uid":"235e1c77-2"}],"isExternal":true},"235e1c77-33":{"id":"@tsparticles/path-utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"235e1c77-4"},{"uid":"235e1c77-8"},{"uid":"235e1c77-12"},{"uid":"235e1c77-16"},{"uid":"235e1c77-22"},{"uid":"235e1c77-2"}],"isExternal":true}},"env":{"rollup":"4.62.2"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4933
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"tsparticles.shape.cards.js","children":[{"name":"dist/browser","children":[{"uid":"4724c717-1","name":"SuitType.js"},{"uid":"4724c717-3","name":"paths.js"},{"name":"clubs","children":[{"uid":"4724c717-5","name":"ClubDrawer.js"},{"uid":"4724c717-7","name":"index.js"}]},{"name":"diamonds","children":[{"uid":"4724c717-9","name":"DiamondDrawer.js"},{"uid":"4724c717-11","name":"index.js"}]},{"name":"hearts","children":[{"uid":"4724c717-13","name":"HeartDrawer.js"},{"uid":"4724c717-15","name":"index.js"}]},{"name":"spades","children":[{"uid":"4724c717-17","name":"SpadeDrawer.js"},{"uid":"4724c717-19","name":"index.js"}]},{"uid":"4724c717-21","name":"suits.js"},{"uid":"4724c717-23","name":"utils.js"},{"name":"cards","children":[{"uid":"4724c717-25","name":"CardDrawer.js"},{"uid":"4724c717-27","name":"index.js"}]},{"uid":"4724c717-29","name":"index.js"},{"uid":"4724c717-31","name":"browser.js"}]}]}],"isRoot":true},"nodeParts":{"4724c717-1":{"renderedLength":239,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-0"},"4724c717-3":{"renderedLength":5744,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-2"},"4724c717-5":{"renderedLength":167,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-4"},"4724c717-7":{"renderedLength":252,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-6"},"4724c717-9":{"renderedLength":173,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-8"},"4724c717-11":{"renderedLength":264,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-10"},"4724c717-13":{"renderedLength":169,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-12"},"4724c717-15":{"renderedLength":256,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-14"},"4724c717-17":{"renderedLength":169,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-16"},"4724c717-19":{"renderedLength":256,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-18"},"4724c717-21":{"renderedLength":296,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-20"},"4724c717-23":{"renderedLength":5569,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-22"},"4724c717-25":{"renderedLength":888,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-24"},"4724c717-27":{"renderedLength":259,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-26"},"4724c717-29":{"renderedLength":207,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-28"},"4724c717-31":{"renderedLength":171,"gzipLength":0,"brotliLength":0,"metaUid":"4724c717-30"}},"nodeMetas":{"4724c717-0":{"id":"/dist/browser/SuitType.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-1"},"imported":[],"importedBy":[{"uid":"4724c717-22"},{"uid":"4724c717-2"}]},"4724c717-2":{"id":"/dist/browser/paths.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-3"},"imported":[{"uid":"4724c717-33"},{"uid":"4724c717-32"},{"uid":"4724c717-0"}],"importedBy":[{"uid":"4724c717-4"},{"uid":"4724c717-8"},{"uid":"4724c717-12"},{"uid":"4724c717-16"},{"uid":"4724c717-22"}]},"4724c717-4":{"id":"/dist/browser/clubs/ClubDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-5"},"imported":[{"uid":"4724c717-33"},{"uid":"4724c717-2"}],"importedBy":[{"uid":"4724c717-6"}]},"4724c717-6":{"id":"/dist/browser/clubs/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-7"},"imported":[{"uid":"4724c717-4"}],"importedBy":[{"uid":"4724c717-20"}]},"4724c717-8":{"id":"/dist/browser/diamonds/DiamondDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-9"},"imported":[{"uid":"4724c717-33"},{"uid":"4724c717-2"}],"importedBy":[{"uid":"4724c717-10"}]},"4724c717-10":{"id":"/dist/browser/diamonds/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-11"},"imported":[{"uid":"4724c717-8"}],"importedBy":[{"uid":"4724c717-20"}]},"4724c717-12":{"id":"/dist/browser/hearts/HeartDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-13"},"imported":[{"uid":"4724c717-33"},{"uid":"4724c717-2"}],"importedBy":[{"uid":"4724c717-14"}]},"4724c717-14":{"id":"/dist/browser/hearts/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-15"},"imported":[{"uid":"4724c717-12"}],"importedBy":[{"uid":"4724c717-20"}]},"4724c717-16":{"id":"/dist/browser/spades/SpadeDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-17"},"imported":[{"uid":"4724c717-33"},{"uid":"4724c717-2"}],"importedBy":[{"uid":"4724c717-18"}]},"4724c717-18":{"id":"/dist/browser/spades/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-19"},"imported":[{"uid":"4724c717-16"}],"importedBy":[{"uid":"4724c717-20"}]},"4724c717-20":{"id":"/dist/browser/suits.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-21"},"imported":[{"uid":"4724c717-6"},{"uid":"4724c717-10"},{"uid":"4724c717-14"},{"uid":"4724c717-18"}],"importedBy":[{"uid":"4724c717-28"}]},"4724c717-22":{"id":"/dist/browser/utils.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-23"},"imported":[{"uid":"4724c717-32"},{"uid":"4724c717-0"},{"uid":"4724c717-33"},{"uid":"4724c717-2"}],"importedBy":[{"uid":"4724c717-24"}]},"4724c717-24":{"id":"/dist/browser/cards/CardDrawer.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-25"},"imported":[{"uid":"4724c717-32"},{"uid":"4724c717-22"}],"importedBy":[{"uid":"4724c717-26"}]},"4724c717-26":{"id":"/dist/browser/cards/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-27"},"imported":[{"uid":"4724c717-24"}],"importedBy":[{"uid":"4724c717-28"}]},"4724c717-28":{"id":"/dist/browser/index.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-29"},"imported":[{"uid":"4724c717-20"},{"uid":"4724c717-26"}],"importedBy":[{"uid":"4724c717-30"}]},"4724c717-30":{"id":"/dist/browser/browser.js","moduleParts":{"tsparticles.shape.cards.js":"4724c717-31"},"imported":[{"uid":"4724c717-28"}],"importedBy":[],"isEntry":true},"4724c717-32":{"id":"@tsparticles/engine","moduleParts":{},"imported":[],"importedBy":[{"uid":"4724c717-24"},{"uid":"4724c717-22"},{"uid":"4724c717-2"}],"isExternal":true},"4724c717-33":{"id":"@tsparticles/path-utils","moduleParts":{},"imported":[],"importedBy":[{"uid":"4724c717-4"},{"uid":"4724c717-8"},{"uid":"4724c717-12"},{"uid":"4724c717-16"},{"uid":"4724c717-22"},{"uid":"4724c717-2"}],"isExternal":true}},"env":{"rollup":"4.63.1"},"options":{"gzip":false,"brotli":false,"sourcemap":false}};
4934
4934
 
4935
4935
  const run = () => {
4936
4936
  const width = window.innerWidth;
@@ -1,5 +1,5 @@
1
1
  (function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
2
- /* Shape v4.3.1 */
2
+ /* Shape v4.4.0 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/path-utils'), require('@tsparticles/engine')) :
5
5
  typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/path-utils', '@tsparticles/engine'], factory) :
@@ -194,7 +194,7 @@
194
194
  }
195
195
 
196
196
  async function loadClubsSuitShape(engine) {
197
- engine.checkVersion("4.3.1");
197
+ engine.checkVersion("4.4.0");
198
198
  await engine.pluginManager.register(e => {
199
199
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
200
200
  });
@@ -208,7 +208,7 @@
208
208
  }
209
209
 
210
210
  async function loadDiamondsSuitShape(engine) {
211
- engine.checkVersion("4.3.1");
211
+ engine.checkVersion("4.4.0");
212
212
  await engine.pluginManager.register(e => {
213
213
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
214
214
  });
@@ -222,7 +222,7 @@
222
222
  }
223
223
 
224
224
  async function loadHeartsSuitShape(engine) {
225
- engine.checkVersion("4.3.1");
225
+ engine.checkVersion("4.4.0");
226
226
  await engine.pluginManager.register(e => {
227
227
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer()));
228
228
  });
@@ -236,14 +236,14 @@
236
236
  }
237
237
 
238
238
  async function loadSpadesSuitShape(engine) {
239
- engine.checkVersion("4.3.1");
239
+ engine.checkVersion("4.4.0");
240
240
  await engine.pluginManager.register(e => {
241
241
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
242
242
  });
243
243
  }
244
244
 
245
245
  async function loadCardSuitsShape(engine) {
246
- engine.checkVersion("4.3.1");
246
+ engine.checkVersion("4.4.0");
247
247
  await Promise.all([
248
248
  loadClubsSuitShape(engine),
249
249
  loadDiamondsSuitShape(engine),
@@ -253,18 +253,18 @@
253
253
  }
254
254
 
255
255
  const cardWidthRatio = (engine.double * engine.double) / engine.triple, cardHeightRatio = engine.double, cornerRadiusRatio = 0.2, cornerFontRatio = 0.4, cornerSuitRatio = 0.3, centerSuitRatio = 0.7, cornerPaddingRatio = 0.2, textHorizontalOffsetRatio = 0.25, minRadius = 0, minAngle = 0, suitEdgeBufferFactor = 0.1, fixedCacheKey = 2, cardsCache = new Map(), redSuitColor = { r: 215, g: 20, b: 20 }, blackSuitColor = { r: 18, g: 18, b: 18 };
256
- function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings) {
256
+ function drawRoundedCard(ctx, radius, cardData, hdr, flipped, canvasSettings, peakNits, mode) {
257
257
  if (flipped) {
258
258
  drawRoundedCardBack(ctx, radius);
259
259
  }
260
260
  else {
261
- const cacheKey = getCacheKey(radius, hdr, cardData), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * engine.half, halfHeight = cardHeight * engine.half;
261
+ const cacheKey = getCacheKey(radius, hdr, cardData, peakNits, mode), cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * engine.half, halfHeight = cardHeight * engine.half;
262
262
  let cachedData = cardsCache.get(cacheKey);
263
263
  if (!cachedData) {
264
264
  const cacheCanvas = new OffscreenCanvas(cardWidth, cardHeight), cacheCtx = cacheCanvas.getContext("2d", canvasSettings);
265
265
  if (cacheCtx) {
266
266
  cacheCtx.translate(halfWidth, halfHeight);
267
- drawRoundedCardFront(cacheCtx, radius, cardData, hdr);
267
+ drawRoundedCardFront(cacheCtx, radius, cardData, hdr, peakNits, mode);
268
268
  cachedData = cacheCanvas instanceof HTMLCanvasElement ? cacheCanvas : cacheCanvas.transferToImageBitmap();
269
269
  cardsCache.set(cacheKey, cachedData);
270
270
  }
@@ -273,23 +273,25 @@
273
273
  ctx.drawImage(cachedData, -halfWidth, -halfHeight, cardWidth, cardHeight);
274
274
  }
275
275
  else {
276
- drawRoundedCardFront(ctx, radius, cardData, hdr);
276
+ drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode);
277
277
  }
278
278
  }
279
279
  }
280
- function getCacheKey(radius, hdr, cardData) {
281
- return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${cardData.suit}-${cardData.value}`;
280
+ function getCacheKey(radius, hdr, cardData, peakNits, mode) {
281
+ return `${radius.toFixed(fixedCacheKey)}-${hdr ? "hdr" : "sdr"}-${peakNits !== undefined ? peakNits.toFixed(fixedCacheKey) : "default"}-${mode ?? "default"}-${cardData.suit}-${cardData.value}`;
282
282
  }
283
283
  function drawRoundedCardBack(ctx, radius) {
284
284
  drawCardBody(ctx, radius);
285
285
  }
286
- function drawRoundedCardFront(ctx, radius, cardData, hdr) {
287
- const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * engine.half, halfHeight = cardHeight * engine.half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed ? engine.getStyleFromRgb(redSuitColor, hdr) : engine.getStyleFromRgb(blackSuitColor, hdr);
286
+ function drawRoundedCardFront(ctx, radius, cardData, hdr, peakNits, mode) {
287
+ const { suit, value } = cardData, cardWidth = radius * cardWidthRatio, cardHeight = radius * cardHeightRatio, halfWidth = cardWidth * engine.half, halfHeight = cardHeight * engine.half, cornerPadding = radius * cornerPaddingRatio, cornerFontSize = radius * cornerFontRatio, cornerSuitSize = radius * cornerSuitRatio, centerSuitSize = radius * centerSuitRatio, textOffset = radius * textHorizontalOffsetRatio, suitEdgeBuffer = radius * suitEdgeBufferFactor, isRed = suit === SuitType.hearts || suit === SuitType.diamonds, color = isRed
288
+ ? engine.getStyleFromRgb(redSuitColor, hdr, undefined, peakNits, mode)
289
+ : engine.getStyleFromRgb(blackSuitColor, hdr, undefined, peakNits, mode);
288
290
  ctx.save();
289
291
  drawCardBody(ctx, radius);
290
- ctx.fillStyle = engine.getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr);
292
+ ctx.fillStyle = engine.getStyleFromRgb({ r: 255, g: 255, b: 255 }, hdr, undefined, peakNits, mode);
291
293
  ctx.fill();
292
- ctx.strokeStyle = engine.getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr);
294
+ ctx.strokeStyle = engine.getStyleFromRgb({ r: 0, g: 0, b: 0 }, hdr, undefined, peakNits, mode);
293
295
  ctx.stroke();
294
296
  ctx.fillStyle = color;
295
297
  ctx.font = `bold ${cornerFontSize.toString()}px Arial, serif`;
@@ -351,7 +353,7 @@
351
353
  }
352
354
  const defaultOpacity = context.globalAlpha, container = this.#container;
353
355
  context.globalAlpha = opacity;
354
- drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings);
356
+ drawRoundedCard(context, radius, particle.cardData, container.hdr, particle.isShowingBack(), container.canvas.render.settings, container.peakNits, container.hdrMode);
355
357
  context.globalAlpha = defaultOpacity;
356
358
  }
357
359
  particleInit(_container, particle) {
@@ -364,14 +366,14 @@
364
366
  }
365
367
 
366
368
  async function loadFullCardsShape(engine) {
367
- engine.checkVersion("4.3.1");
369
+ engine.checkVersion("4.4.0");
368
370
  await engine.pluginManager.register(e => {
369
371
  e.pluginManager.addShape(["card"], container => Promise.resolve(new CardDrawer(container)));
370
372
  });
371
373
  }
372
374
 
373
375
  async function loadCardsShape(engine) {
374
- engine.checkVersion("4.3.1");
376
+ engine.checkVersion("4.4.0");
375
377
  await Promise.all([
376
378
  loadFullCardsShape(engine),
377
379
  loadCardSuitsShape(engine),
@@ -1 +1 @@
1
- !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/path-utils"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/path-utils","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.shapes.cards=e.__tsParticlesInternals.shapes.cards||{}),e.__tsParticlesInternals.path.utils,e.__tsParticlesInternals.engine)}(this,function(e,t,s){"use strict";var a;!function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(a||(a={}));const n=s.quarter*s.half,r=s.half,l=r*s.half,i=-r,c=-l,p=r*n,o=r*s.threeQuarter,_={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:l,y:i},{x:l,y:c}]},{type:t.SegmentType.bezier,values:[{x:l,y:c},{x:l,y:c},{x:r,y:c},{x:r,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:r,y:s.empty},{x:r,y:s.empty},{x:r,y:l},{x:l,y:l}]},{type:t.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:l},{x:p,y:l},{x:p,y:p}]},{type:t.SegmentType.bezier,values:[{x:p,y:p},{x:p,y:l},{x:l,y:r},{x:l,y:r}]},{type:t.SegmentType.bezier,values:[{x:l,y:r},{x:l,y:r},{x:s.empty,y:r},{x:s.empty,y:r}]}]},y={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:r},{x:s.empty,y:r},{x:o,y:s.empty},{x:o,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:o,y:s.empty},{x:o,y:s.empty},{x:s.empty,y:i},{x:s.empty,y:i}]}]},u={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:r},{x:s.empty,y:r},{x:r,y:s.empty},{x:r,y:c}]},{type:t.SegmentType.bezier,values:[{x:r,y:c},{x:r,y:c},{x:r,y:i},{x:l,y:i}]},{type:t.SegmentType.bezier,values:[{x:l,y:i},{x:l,y:i},{x:s.empty,y:i},{x:s.empty,y:c}]}]},d={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:r,y:c},{x:r,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:r,y:s.empty},{x:r,y:s.empty},{x:r,y:l},{x:l,y:l}]},{type:t.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:l},{x:p,y:l},{x:p,y:p}]},{type:t.SegmentType.bezier,values:[{x:p,y:p},{x:p,y:l},{x:l,y:r},{x:l,y:r}]},{type:t.SegmentType.bezier,values:[{x:l,y:r},{x:l,y:r},{x:s.empty,y:r},{x:s.empty,y:r}]}]},P={[a.hearts]:u,[a.diamonds]:y,[a.clubs]:_,[a.spades]:d};class g{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.clubs)}}async function h(e){e.checkVersion("4.3.1"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["club","clubs"],()=>Promise.resolve(new g))})}class x{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.diamonds)}}async function I(e){e.checkVersion("4.3.1"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["diamond","diamonds"],()=>Promise.resolve(new x))})}class f{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.hearts)}}async function m(e){e.checkVersion("4.3.1"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["heart","hearts"],()=>Promise.resolve(new f))})}class b{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.spades)}}async function v(e){e.checkVersion("4.3.1"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["spade","spades"],()=>Promise.resolve(new b))})}async function S(e){e.checkVersion("4.3.1"),await Promise.all([h(e),I(e),m(e),v(e)])}const T=s.double*s.double/s.triple,w=s.double,z=new Map,M={r:215,g:20,b:20},C={r:18,g:18,b:18};function k(e,t,a,n,r,l){if(r)!function(e,t){V(e,t)}(e,t);else{const r=function(e,t,s){return`${e.toFixed(2)}-${t?"hdr":"sdr"}-${s.suit}-${s.value}`}(t,n,a),i=t*T,c=t*w,p=i*s.half,o=c*s.half;let _=z.get(r);if(!_){const e=new OffscreenCanvas(i,c),s=e.getContext("2d",l);s&&(s.translate(p,o),q(s,t,a,n),_=e instanceof HTMLCanvasElement?e:e.transferToImageBitmap(),z.set(r,_))}_?e.drawImage(_,-p,-o,i,c):q(e,t,a,n)}}function q(e,n,r,l){const{suit:i,value:c}=r,p=n*w,o=n*T*s.half,_=p*s.half,y=.2*n,u=.4*n,d=.3*n,g=.7*n,h=.25*n,x=.1*n,I=i===a.hearts||i===a.diamonds?s.getStyleFromRgb(M,l):s.getStyleFromRgb(C,l);e.save(),V(e,n),e.fillStyle=s.getStyleFromRgb({r:255,g:255,b:255},l),e.fill(),e.strokeStyle=s.getStyleFromRgb({r:0,g:0,b:0},l),e.stroke(),e.fillStyle=I,e.font=`bold ${u.toString()}px Arial, serif`,e.textAlign="left",e.textBaseline="middle";const f=-o+y+x,m=-_+y+u*s.half;e.save(),e.translate(f,m),e.beginPath(),t.drawPath(e,d,P[i]),e.fill(),e.restore(),e.fillText(c,f+h,m),e.save(),e.translate(o-y-x,_-y-u*s.half),e.rotate(Math.PI),e.save(),e.beginPath(),t.drawPath(e,d,P[i]),e.fill(),e.restore(),e.fillText(c,s.originPoint.x+h,s.originPoint.y),e.restore(),e.save(),e.beginPath(),t.drawPath(e,g,P[i]),e.fillStyle=I,e.fill(),e.restore(),e.beginPath(),e.arc(s.originPoint.x,s.originPoint.y,0,0,s.doublePI,!1),e.closePath(),e.restore()}function V(e,t){const a=t*w,n=t*T*s.half,r=a*s.half,l=.2*t;e.beginPath(),e.moveTo(-n+l,-r),e.lineTo(n-l,-r),e.quadraticCurveTo(n,-r,n,-r+l),e.lineTo(n,r-l),e.quadraticCurveTo(n,r,n-l,r),e.lineTo(-n+l,r),e.quadraticCurveTo(-n,r,-n,r-l),e.lineTo(-n,-r+l),e.quadraticCurveTo(-n,-r,-n+l,-r),e.closePath()}class A{#e;constructor(e){this.#e=e}draw(e){const{context:t,particle:s,opacity:a,radius:n}=e;if(!s.cardData)return;const r=t.globalAlpha,l=this.#e;t.globalAlpha=a,k(t,n,s.cardData,l.hdr,s.isShowingBack(),l.canvas.render.settings),t.globalAlpha=r}particleInit(e,t){const a=t.shapeData;a&&(t.cardData=s.deepExtend({},a))}}async function E(e){e.checkVersion("4.3.1"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["card"],e=>Promise.resolve(new A(e)))})}async function F(e){e.checkVersion("4.3.1"),await Promise.all([E(e),S(e)])}const $=globalThis;$.__tsParticlesInternals=$.__tsParticlesInternals??{},$.loadCardsShape=F,e.loadCardsShape=F}),Object.assign(globalThis.window||globalThis,{loadCardsShape:(globalThis.__tsParticlesInternals.shapes.cards||{}).loadCardsShape}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
1
+ !function(e){e.__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.bundles=e.__tsParticlesInternals.bundles||{},e.__tsParticlesInternals.effects=e.__tsParticlesInternals.effects||{},e.__tsParticlesInternals.engine=e.__tsParticlesInternals.engine||{},e.__tsParticlesInternals.interactions=e.__tsParticlesInternals.interactions||{},e.__tsParticlesInternals.palettes=e.__tsParticlesInternals.palettes||{},e.__tsParticlesInternals.paths=e.__tsParticlesInternals.paths||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins=e.__tsParticlesInternals.plugins||{},e.__tsParticlesInternals.plugins.emittersShapes=e.__tsParticlesInternals.plugins.emittersShapes||{},e.__tsParticlesInternals.presets=e.__tsParticlesInternals.presets||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.updaters=e.__tsParticlesInternals.updaters||{},e.__tsParticlesInternals.utils=e.__tsParticlesInternals.utils||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas=e.__tsParticlesInternals.canvas||{},e.__tsParticlesInternals.canvas.utils=e.__tsParticlesInternals.canvas.utils||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path=e.__tsParticlesInternals.path||{},e.__tsParticlesInternals.path.utils=e.__tsParticlesInternals.path.utils||{};var t="undefined"!=typeof Proxy?function(e){return new Proxy(e,{get:function(e,t){return t in e||(e[t]={}),e[t]}})}:function(e){return e};e.__tsParticlesInternals.bundles=t(e.__tsParticlesInternals.bundles),e.__tsParticlesInternals.effects=t(e.__tsParticlesInternals.effects),e.__tsParticlesInternals.interactions=t(e.__tsParticlesInternals.interactions),e.__tsParticlesInternals.palettes=t(e.__tsParticlesInternals.palettes),e.__tsParticlesInternals.paths=t(e.__tsParticlesInternals.paths),e.__tsParticlesInternals.plugins=t(e.__tsParticlesInternals.plugins),e.__tsParticlesInternals.plugins.emittersShapes=t(e.__tsParticlesInternals.plugins.emittersShapes),e.__tsParticlesInternals.presets=t(e.__tsParticlesInternals.presets),e.__tsParticlesInternals.shapes=t(e.__tsParticlesInternals.shapes),e.__tsParticlesInternals.updaters=t(e.__tsParticlesInternals.updaters),e.__tsParticlesInternals.utils=t(e.__tsParticlesInternals.utils),e.__tsParticlesInternals.canvas=t(e.__tsParticlesInternals.canvas),e.__tsParticlesInternals.path=t(e.__tsParticlesInternals.path),e.tsparticlesInternalExports=e.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tsparticles/path-utils"),require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/path-utils","@tsparticles/engine"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).__tsParticlesInternals=e.__tsParticlesInternals||{},e.__tsParticlesInternals.shapes=e.__tsParticlesInternals.shapes||{},e.__tsParticlesInternals.shapes.cards=e.__tsParticlesInternals.shapes.cards||{}),e.__tsParticlesInternals.path.utils,e.__tsParticlesInternals.engine)}(this,function(e,t,s){"use strict";var a;!function(e){e.hearts="hearts",e.diamonds="diamonds",e.clubs="clubs",e.spades="spades"}(a||(a={}));const n=s.quarter*s.half,r=s.half,l=r*s.half,i=-r,c=-l,p=r*n,o=r*s.threeQuarter,_={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:l,y:i},{x:l,y:c}]},{type:t.SegmentType.bezier,values:[{x:l,y:c},{x:l,y:c},{x:r,y:c},{x:r,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:r,y:s.empty},{x:r,y:s.empty},{x:r,y:l},{x:l,y:l}]},{type:t.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:l},{x:p,y:l},{x:p,y:p}]},{type:t.SegmentType.bezier,values:[{x:p,y:p},{x:p,y:l},{x:l,y:r},{x:l,y:r}]},{type:t.SegmentType.bezier,values:[{x:l,y:r},{x:l,y:r},{x:s.empty,y:r},{x:s.empty,y:r}]}]},y={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:r},{x:s.empty,y:r},{x:o,y:s.empty},{x:o,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:o,y:s.empty},{x:o,y:s.empty},{x:s.empty,y:i},{x:s.empty,y:i}]}]},u={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:r},{x:s.empty,y:r},{x:r,y:s.empty},{x:r,y:c}]},{type:t.SegmentType.bezier,values:[{x:r,y:c},{x:r,y:c},{x:r,y:i},{x:l,y:i}]},{type:t.SegmentType.bezier,values:[{x:l,y:i},{x:l,y:i},{x:s.empty,y:i},{x:s.empty,y:c}]}]},d={half:!0,segments:[{type:t.SegmentType.bezier,values:[{x:s.empty,y:i},{x:s.empty,y:i},{x:r,y:c},{x:r,y:s.empty}]},{type:t.SegmentType.bezier,values:[{x:r,y:s.empty},{x:r,y:s.empty},{x:r,y:l},{x:l,y:l}]},{type:t.SegmentType.bezier,values:[{x:l,y:l},{x:l,y:l},{x:p,y:l},{x:p,y:p}]},{type:t.SegmentType.bezier,values:[{x:p,y:p},{x:p,y:l},{x:l,y:r},{x:l,y:r}]},{type:t.SegmentType.bezier,values:[{x:l,y:r},{x:l,y:r},{x:s.empty,y:r},{x:s.empty,y:r}]}]},P={[a.hearts]:u,[a.diamonds]:y,[a.clubs]:_,[a.spades]:d};class g{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.clubs)}}async function h(e){e.checkVersion("4.4.0"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["club","clubs"],()=>Promise.resolve(new g))})}class x{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.diamonds)}}async function I(e){e.checkVersion("4.4.0"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["diamond","diamonds"],()=>Promise.resolve(new x))})}class f{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.hearts)}}async function m(e){e.checkVersion("4.4.0"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["heart","hearts"],()=>Promise.resolve(new f))})}class b{draw(e){const{context:s,radius:a}=e;t.drawPath(s,a,P.spades)}}async function v(e){e.checkVersion("4.4.0"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["spade","spades"],()=>Promise.resolve(new b))})}async function S(e){e.checkVersion("4.4.0"),await Promise.all([h(e),I(e),m(e),v(e)])}const T=s.double*s.double/s.triple,w=s.double,z=new Map,M={r:215,g:20,b:20},k={r:18,g:18,b:18};function C(e,t,a,n,r,l,i,c){if(r)!function(e,t){V(e,t)}(e,t);else{const r=function(e,t,s,a,n){return`${e.toFixed(2)}-${t?"hdr":"sdr"}-${void 0!==a?a.toFixed(2):"default"}-${n??"default"}-${s.suit}-${s.value}`}(t,n,a,i,c),p=t*T,o=t*w,_=p*s.half,y=o*s.half;let u=z.get(r);if(!u){const e=new OffscreenCanvas(p,o),s=e.getContext("2d",l);s&&(s.translate(_,y),q(s,t,a,n,i,c),u=e instanceof HTMLCanvasElement?e:e.transferToImageBitmap(),z.set(r,u))}u?e.drawImage(u,-_,-y,p,o):q(e,t,a,n,i,c)}}function q(e,n,r,l,i,c){const{suit:p,value:o}=r,_=n*w,y=n*T*s.half,u=_*s.half,d=.2*n,g=.4*n,h=.3*n,x=.7*n,I=.25*n,f=.1*n,m=p===a.hearts||p===a.diamonds?s.getStyleFromRgb(M,l,void 0,i,c):s.getStyleFromRgb(k,l,void 0,i,c);e.save(),V(e,n),e.fillStyle=s.getStyleFromRgb({r:255,g:255,b:255},l,void 0,i,c),e.fill(),e.strokeStyle=s.getStyleFromRgb({r:0,g:0,b:0},l,void 0,i,c),e.stroke(),e.fillStyle=m,e.font=`bold ${g.toString()}px Arial, serif`,e.textAlign="left",e.textBaseline="middle";const b=-y+d+f,v=-u+d+g*s.half;e.save(),e.translate(b,v),e.beginPath(),t.drawPath(e,h,P[p]),e.fill(),e.restore(),e.fillText(o,b+I,v),e.save(),e.translate(y-d-f,u-d-g*s.half),e.rotate(Math.PI),e.save(),e.beginPath(),t.drawPath(e,h,P[p]),e.fill(),e.restore(),e.fillText(o,s.originPoint.x+I,s.originPoint.y),e.restore(),e.save(),e.beginPath(),t.drawPath(e,x,P[p]),e.fillStyle=m,e.fill(),e.restore(),e.beginPath(),e.arc(s.originPoint.x,s.originPoint.y,0,0,s.doublePI,!1),e.closePath(),e.restore()}function V(e,t){const a=t*w,n=t*T*s.half,r=a*s.half,l=.2*t;e.beginPath(),e.moveTo(-n+l,-r),e.lineTo(n-l,-r),e.quadraticCurveTo(n,-r,n,-r+l),e.lineTo(n,r-l),e.quadraticCurveTo(n,r,n-l,r),e.lineTo(-n+l,r),e.quadraticCurveTo(-n,r,-n,r-l),e.lineTo(-n,-r+l),e.quadraticCurveTo(-n,-r,-n+l,-r),e.closePath()}class ${#e;constructor(e){this.#e=e}draw(e){const{context:t,particle:s,opacity:a,radius:n}=e;if(!s.cardData)return;const r=t.globalAlpha,l=this.#e;t.globalAlpha=a,C(t,n,s.cardData,l.hdr,s.isShowingBack(),l.canvas.render.settings,l.peakNits,l.hdrMode),t.globalAlpha=r}particleInit(e,t){const a=t.shapeData;a&&(t.cardData=s.deepExtend({},a))}}async function F(e){e.checkVersion("4.4.0"),await e.pluginManager.register(e=>{e.pluginManager.addShape(["card"],e=>Promise.resolve(new $(e)))})}async function A(e){e.checkVersion("4.4.0"),await Promise.all([F(e),S(e)])}const E=globalThis;E.__tsParticlesInternals=E.__tsParticlesInternals??{},E.loadCardsShape=A,e.loadCardsShape=A}),Object.assign(globalThis.window||globalThis,{loadCardsShape:(globalThis.__tsParticlesInternals.shapes.cards||{}).loadCardsShape}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
package/types/utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ import { type HdrMode } from "@tsparticles/engine";
1
2
  import type { ICardData } from "./ICardData.js";
2
- export declare function drawRoundedCard(ctx: OffscreenCanvasRenderingContext2D, radius: number, cardData: ICardData, hdr: boolean, flipped: boolean, canvasSettings?: CanvasRenderingContext2DSettings): void;
3
+ export declare function drawRoundedCard(ctx: OffscreenCanvasRenderingContext2D, radius: number, cardData: ICardData, hdr: boolean, flipped: boolean, canvasSettings?: CanvasRenderingContext2DSettings, peakNits?: number, mode?: HdrMode): void;