@tsparticles/confetti 4.3.2 → 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.
@@ -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
- /* tsParticles v4.3.2 */
2
+ /* tsParticles v4.4.0 */
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
5
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -880,7 +880,7 @@
880
880
  return this.#domArray;
881
881
  }
882
882
  get version() {
883
- return "4.3.2";
883
+ return "4.4.0";
884
884
  }
885
885
  addEventListener(type, listener) {
886
886
  this.#eventDispatcher.addEventListener(type, listener);
@@ -961,6 +961,10 @@
961
961
  }
962
962
 
963
963
  function initEngine() {
964
+ const existing = globalThis.tsParticles;
965
+ if (existing?.pluginManager) {
966
+ return existing;
967
+ }
964
968
  return new Engine();
965
969
  }
966
970
 
@@ -1058,6 +1062,15 @@
1058
1062
  AnimationMode["random"] = "random";
1059
1063
  })(exports.AnimationMode || (exports.AnimationMode = {}));
1060
1064
 
1065
+ exports.HdrMode = void 0;
1066
+ (function (HdrMode) {
1067
+ HdrMode["standard"] = "standard";
1068
+ HdrMode["natural"] = "natural";
1069
+ HdrMode["vivid"] = "vivid";
1070
+ HdrMode["cinematic"] = "cinematic";
1071
+ HdrMode["dynamic"] = "dynamic";
1072
+ })(exports.HdrMode || (exports.HdrMode = {}));
1073
+
1061
1074
  exports.LimitMode = void 0;
1062
1075
  (function (LimitMode) {
1063
1076
  LimitMode["delete"] = "delete";
@@ -1323,6 +1336,29 @@
1323
1336
  }
1324
1337
  }
1325
1338
 
1339
+ const defaultPeakNits = 400, minPeakNits = 0, toStringValue = (value) => String(value);
1340
+ class HDROptions extends OptionLoader {
1341
+ enable = true;
1342
+ mode = exports.HdrMode.standard;
1343
+ peakNits = defaultPeakNits;
1344
+ doLoad(data) {
1345
+ if (data.enable !== undefined && !isBoolean(data.enable)) {
1346
+ throw new Error(`Invalid HDR "enable" value: expected a boolean, got "${String(data.enable)}"`);
1347
+ }
1348
+ if (data.mode !== undefined &&
1349
+ (typeof data.mode !== "string" || !Object.values(exports.HdrMode).includes(data.mode))) {
1350
+ throw new Error(`Invalid HDR "mode" value: expected one of ${Object.values(exports.HdrMode).join(", ")}, got "${toStringValue(data.mode)}"`);
1351
+ }
1352
+ if (data.peakNits !== undefined &&
1353
+ (!isNumber(data.peakNits) || !Number.isFinite(data.peakNits) || data.peakNits <= minPeakNits)) {
1354
+ throw new Error(`Invalid HDR "peakNits" value: expected a positive number, got "${String(data.peakNits)}"`);
1355
+ }
1356
+ loadProperty(this, "enable", data.enable);
1357
+ loadProperty(this, "mode", data.mode);
1358
+ loadProperty(this, "peakNits", data.peakNits);
1359
+ }
1360
+ }
1361
+
1326
1362
  class ResizeEvent extends OptionLoader {
1327
1363
  delay = 0.5;
1328
1364
  enable = true;
@@ -1766,7 +1802,7 @@
1766
1802
  duration = 0;
1767
1803
  fpsLimit = 120;
1768
1804
  fullScreen;
1769
- hdr = true;
1805
+ hdr;
1770
1806
  key;
1771
1807
  name;
1772
1808
  palette;
@@ -1786,6 +1822,7 @@
1786
1822
  this.#container = container;
1787
1823
  this.background = new Background();
1788
1824
  this.fullScreen = new FullScreen();
1825
+ this.hdr = new HDROptions();
1789
1826
  this.particles = loadParticlesOptions(this.#pluginManager, this.#container);
1790
1827
  this.resize = new ResizeEvent();
1791
1828
  }
@@ -1808,7 +1845,15 @@
1808
1845
  loadProperty(this, "detectRetina", data.detectRetina);
1809
1846
  loadRangeProperty(this, "duration", data.duration);
1810
1847
  loadProperty(this, "fpsLimit", data.fpsLimit);
1811
- loadProperty(this, "hdr", data.hdr);
1848
+ const hdrData = data.hdr;
1849
+ if (isBoolean(hdrData)) {
1850
+ this.hdr.enable = hdrData;
1851
+ this.hdr.mode = exports.HdrMode.standard;
1852
+ this.hdr.peakNits = 400;
1853
+ }
1854
+ else {
1855
+ this.hdr.load(hdrData);
1856
+ }
1812
1857
  loadProperty(this, "pauseOnBlur", data.pauseOnBlur);
1813
1858
  loadProperty(this, "pauseOnOutsideViewport", data.pauseOnOutsideViewport);
1814
1859
  loadProperty(this, "zLayers", data.zLayers);
@@ -1851,7 +1896,7 @@
1851
1896
  }
1852
1897
  }
1853
1898
 
1854
- const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, hdrRgbFixedPrecision = 4, hdrHslFixedPrecision = 4, sdrReferenceWhiteNits = 203, hdrAnimationScale = sdrReferenceWhiteNits / maxNits;
1899
+ const styleCache = new Map(), maxStyleCacheSize = 2000, rgbFixedPrecision = 2, hslFixedPrecision = 2, hdrRgbFixedPrecision = 4, hdrHslFixedPrecision = 4, sdrReferenceWhiteNits = 203, acesA = 2.51, acesB = 0.03, acesC = 2.43, acesD = 0.59, acesE = 0.14, saturationBoost = 1.15, lightnessBoost = 1.05, temperatureR = 1.05, temperatureB = 0.95, contrastFactor = 1.1, luminanceR = 0.2126, luminanceG = 0.7152, luminanceB = 0.0722, dynamicLuminanceFactor = 2, channelCount = 3, srgbThreshold = 0.04045, srgbDivisor = 12.92, srgbOffset = 0.055, srgbScale = 1.055, srgbExponent = 2.4, linearThreshold = 0.0031308, linearScale = 12.92;
1855
1900
  function getCachedStyle(key, generator) {
1856
1901
  let cached = styleCache.get(key);
1857
1902
  if (!cached) {
@@ -1863,6 +1908,48 @@
1863
1908
  }
1864
1909
  return cached;
1865
1910
  }
1911
+ function acesFilmic(x) {
1912
+ return clamp((x * (acesA * x + acesB)) / (x * (acesC * x + acesD) + acesE), none, one);
1913
+ }
1914
+ function srgbToLinear(c) {
1915
+ return c <= srgbThreshold ? c / srgbDivisor : Math.pow((c + srgbOffset) / srgbScale, srgbExponent);
1916
+ }
1917
+ function linearToSrgb(c) {
1918
+ return c <= linearThreshold ? c * linearScale : srgbScale * Math.pow(c, one / srgbExponent) - srgbOffset;
1919
+ }
1920
+ function applyHdrModeAdjustments(r, g, b, mode, maxChannel) {
1921
+ switch (mode) {
1922
+ case exports.HdrMode.vivid: {
1923
+ const avg = (r + g + b) / channelCount;
1924
+ return {
1925
+ b: clamp(clamp(avg + (b - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
1926
+ g: clamp(clamp(avg + (g - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
1927
+ r: clamp(clamp(avg + (r - avg) * saturationBoost, none, maxChannel) * lightnessBoost, none, maxChannel),
1928
+ };
1929
+ }
1930
+ case exports.HdrMode.cinematic: {
1931
+ const tempR = r * temperatureR, tempB = b * temperatureB, avg = (tempR + g + tempB) / channelCount;
1932
+ return {
1933
+ b: clamp(avg + (tempB - avg) * contrastFactor, none, maxChannel),
1934
+ g: clamp(avg + (g - avg) * contrastFactor, none, maxChannel),
1935
+ r: clamp(avg + (tempR - avg) * contrastFactor, none, maxChannel),
1936
+ };
1937
+ }
1938
+ case exports.HdrMode.dynamic: {
1939
+ const luminance = luminanceR * r + luminanceG * g + luminanceB * b, vividWeight = Math.min(one, luminance * dynamicLuminanceFactor), naturalWeight = one - vividWeight, avg = (r + g + b) / channelCount, vividR = clamp(avg + (r - avg) * saturationBoost, none, maxChannel) * lightnessBoost, vividG = clamp(avg + (g - avg) * saturationBoost, none, maxChannel) * lightnessBoost, vividB = clamp(avg + (b - avg) * saturationBoost, none, maxChannel) * lightnessBoost;
1940
+ return {
1941
+ b: clamp(b * naturalWeight + vividB * vividWeight, none, maxChannel),
1942
+ g: clamp(g * naturalWeight + vividG * vividWeight, none, maxChannel),
1943
+ r: clamp(r * naturalWeight + vividR * vividWeight, none, maxChannel),
1944
+ };
1945
+ }
1946
+ case exports.HdrMode.standard:
1947
+ return { b, g, r };
1948
+ case exports.HdrMode.natural:
1949
+ default:
1950
+ return { b, g, r };
1951
+ }
1952
+ }
1866
1953
  function stringToRgba(pluginManager, input) {
1867
1954
  if (!input) {
1868
1955
  return;
@@ -2030,30 +2117,65 @@
2030
2117
  r: getRgbInRangeValue(),
2031
2118
  };
2032
2119
  }
2033
- function getStyleFromRgb(color, hdr, opacity) {
2034
- const rgbPrecision = hdr ? hdrRgbFixedPrecision : rgbFixedPrecision, op = opacity ?? defaultOpacity$2, key = `rgb-${color.r.toFixed(rgbPrecision)}-${color.g.toFixed(rgbPrecision)}-${color.b.toFixed(rgbPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
2035
- return getCachedStyle(key, () => (hdr ? getHdrStyleFromRgb(color, opacity) : getSdrStyleFromRgb(color, opacity)));
2120
+ function getStyleFromRgb(color, hdr, opacity, peakNits, mode) {
2121
+ const rgbPrecision = hdr ? hdrRgbFixedPrecision : rgbFixedPrecision, op = opacity ?? defaultOpacity$2, key = hdr
2122
+ ? `rgb-${color.r.toFixed(rgbPrecision)}-${color.g.toFixed(rgbPrecision)}-${color.b.toFixed(rgbPrecision)}-hdr-${op.toString()}-${(peakNits ?? maxNits).toString()}-${mode ?? exports.HdrMode.standard}`
2123
+ : `rgb-${color.r.toFixed(rgbPrecision)}-${color.g.toFixed(rgbPrecision)}-${color.b.toFixed(rgbPrecision)}-sdr-${op.toString()}`;
2124
+ return getCachedStyle(key, () => hdr ? getHdrStyleFromRgb(color, opacity, peakNits, mode) : getSdrStyleFromRgb(color, opacity));
2125
+ }
2126
+ function getHdrStyleFromRgb(color, opacity, peakNits = maxNits, mode = exports.HdrMode.standard) {
2127
+ const headroom = peakNits / sdrReferenceWhiteNits, middleGray = 0.18, mapped = hdrToneMapColor(color, headroom, middleGray, mode);
2128
+ return `color(display-p3 ${mapped.r.toString()} ${mapped.g.toString()} ${mapped.b.toString()} / ${(opacity ?? defaultOpacity$2).toString()})`;
2129
+ }
2130
+ function hdrToneMapColor(color, headroom, middleGray, mode) {
2131
+ const rNorm = color.r / rgbMax, gNorm = color.g / rgbMax, bNorm = color.b / rgbMax;
2132
+ if (mode !== exports.HdrMode.natural && mode !== exports.HdrMode.vivid && mode !== exports.HdrMode.cinematic && mode !== exports.HdrMode.dynamic) {
2133
+ return { b: bNorm, g: gNorm, r: rNorm };
2134
+ }
2135
+ const maxChannel = Math.max(one, headroom), luminance = luminanceR * rNorm + luminanceG * gNorm + luminanceB * bNorm, mappedLuminance = hdrToneMap(luminance, headroom, middleGray), scale = luminance > none ? mappedLuminance / luminance : one;
2136
+ return applyHdrModeAdjustments(clamp(rNorm * scale, none, maxChannel), clamp(gNorm * scale, none, maxChannel), clamp(bNorm * scale, none, maxChannel), mode, maxChannel);
2036
2137
  }
2037
- function getHdrStyleFromRgb(color, opacity, peakNits = maxNits) {
2038
- const headroom = peakNits / sdrReferenceWhiteNits;
2039
- return `color(display-p3 ${((color.r / rgbMax) * headroom).toString()} ${((color.g / rgbMax) * headroom).toString()} ${((color.b / rgbMax) * headroom).toString()} / ${(opacity ?? defaultOpacity$2).toString()})`;
2138
+ function hdrToneMap(normalized, headroom, middleGray) {
2139
+ if (normalized <= middleGray) {
2140
+ return acesFilmic(normalized);
2141
+ }
2142
+ const expanded = normalized + (normalized - middleGray) * (headroom - one);
2143
+ return acesFilmic(expanded);
2040
2144
  }
2041
2145
  function getSdrStyleFromRgb(color, opacity) {
2042
2146
  return `rgba(${color.r.toString()}, ${color.g.toString()}, ${color.b.toString()}, ${(opacity ?? defaultOpacity$2).toString()})`;
2043
2147
  }
2044
- function getStyleFromHsl(color, hdr, opacity) {
2045
- const hslPrecision = hdr ? hdrHslFixedPrecision : hslFixedPrecision, op = opacity ?? defaultOpacity$2, key = `hsl-${color.h.toFixed(hslPrecision)}-${color.s.toFixed(hslPrecision)}-${color.l.toFixed(hslPrecision)}-${hdr ? "hdr" : "sdr"}-${op.toString()}`;
2148
+ function getStyleFromHsl(color, hdr, opacity, peakNits, mode) {
2149
+ const hslPrecision = hdr ? hdrHslFixedPrecision : hslFixedPrecision, op = opacity ?? defaultOpacity$2, key = hdr
2150
+ ? `hsl-${color.h.toFixed(hslPrecision)}-${color.s.toFixed(hslPrecision)}-${color.l.toFixed(hslPrecision)}-hdr-${op.toString()}-${(peakNits ?? maxNits).toString()}-${mode ?? exports.HdrMode.standard}`
2151
+ : `hsl-${color.h.toFixed(hslPrecision)}-${color.s.toFixed(hslPrecision)}-${color.l.toFixed(hslPrecision)}-sdr-${op.toString()}`;
2046
2152
  return getCachedStyle(key, () => hdr
2047
- ? getStyleFromRgb(hslToRgbFloat(color), true, opacity)
2153
+ ? getStyleFromRgb(hslToRgbFloat(color), true, opacity, peakNits, mode)
2048
2154
  : `hsla(${color.h.toString()}, ${color.s.toString()}%, ${color.l.toString()}%, ${op.toString()})`);
2049
2155
  }
2050
- function colorMix(color1, color2, size1, size2) {
2156
+ function colorMix(color1, color2, size1, size2, hdr) {
2051
2157
  let rgb1 = color1, rgb2 = color2;
2052
2158
  if (!("r" in rgb1)) {
2053
- rgb1 = hslToRgb(color1);
2159
+ rgb1 = hdr ? hslToRgbFloat(color1) : hslToRgb(color1);
2054
2160
  }
2055
2161
  if (!("r" in rgb2)) {
2056
- rgb2 = hslToRgb(color2);
2162
+ rgb2 = hdr ? hslToRgbFloat(color2) : hslToRgb(color2);
2163
+ }
2164
+ if (hdr) {
2165
+ const lin1 = {
2166
+ b: srgbToLinear(rgb1.b / rgbMax),
2167
+ g: srgbToLinear(rgb1.g / rgbMax),
2168
+ r: srgbToLinear(rgb1.r / rgbMax),
2169
+ }, lin2 = {
2170
+ b: srgbToLinear(rgb2.b / rgbMax),
2171
+ g: srgbToLinear(rgb2.g / rgbMax),
2172
+ r: srgbToLinear(rgb2.r / rgbMax),
2173
+ }, totalWeight = size1 + size2;
2174
+ return {
2175
+ b: linearToSrgb((lin1.b * size1 + lin2.b * size2) / totalWeight) * rgbMax,
2176
+ g: linearToSrgb((lin1.g * size1 + lin2.g * size2) / totalWeight) * rgbMax,
2177
+ r: linearToSrgb((lin1.r * size1 + lin2.r * size2) / totalWeight) * rgbMax,
2178
+ };
2057
2179
  }
2058
2180
  return {
2059
2181
  b: mix(rgb1.b, rgb2.b, size1, size2),
@@ -2061,14 +2183,14 @@
2061
2183
  r: mix(rgb1.r, rgb2.r, size1, size2),
2062
2184
  };
2063
2185
  }
2064
- function getLinkColor(p1, p2, linkColor) {
2186
+ function getLinkColor(p1, p2, linkColor, hdr) {
2065
2187
  if (linkColor === randomColorValue) {
2066
2188
  return getRandomRgbColor();
2067
2189
  }
2068
2190
  else if (linkColor === midColorValue) {
2069
2191
  const sourceColor = p1.getFillColor() ?? p1.getStrokeColor(), destColor = p2?.getFillColor() ?? p2?.getStrokeColor();
2070
2192
  if (sourceColor && destColor && p2) {
2071
- return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius());
2193
+ return colorMix(sourceColor, destColor, p1.getRadius(), p2.getRadius(), hdr);
2072
2194
  }
2073
2195
  else {
2074
2196
  const hslColor = sourceColor ?? destColor;
@@ -2164,7 +2286,7 @@
2164
2286
  colorValue.velocity = defaultVelocity;
2165
2287
  }
2166
2288
  }
2167
- function updateColorValue(data, decrease, delta, hdr) {
2289
+ function updateColorValue(data, decrease, delta, _hdr) {
2168
2290
  const minLoops = 0, minDelay = 0, identity = 1, minVelocity = 0, minOffset = 0, velocityFactor = 3.6;
2169
2291
  if (!data.enable ||
2170
2292
  ((data.maxLoops ?? minLoops) > minLoops && (data.loops ?? minLoops) > (data.maxLoops ?? minLoops))) {
@@ -2177,7 +2299,7 @@
2177
2299
  if ((data.delayTime ?? minDelay) > minDelay && data.time < (data.delayTime ?? minDelay)) {
2178
2300
  return;
2179
2301
  }
2180
- const offset = data.offset ? randomInRangeValue(data.offset) : minOffset, velocity = ((data.velocity ?? minVelocity) * delta.factor + offset * velocityFactor) * (hdr ? hdrAnimationScale : identity), decay = data.decay ?? identity, max = data.max, min = data.min;
2302
+ const offset = data.offset ? randomInRangeValue(data.offset) : minOffset, velocity = (data.velocity ?? minVelocity) * delta.factor + offset * velocityFactor, decay = data.decay ?? identity, max = data.max, min = data.min;
2181
2303
  if (!decrease || data.status === exports.AnimationStatus.increasing) {
2182
2304
  data.value += velocity;
2183
2305
  if (data.value > max) {
@@ -2209,9 +2331,9 @@
2209
2331
  return;
2210
2332
  }
2211
2333
  const { h, s, l } = color;
2212
- updateColorValue(h, false, delta, hdr);
2213
- updateColorValue(s, true, delta, hdr);
2214
- updateColorValue(l, true, delta, hdr);
2334
+ updateColorValue(h, false, delta);
2335
+ updateColorValue(s, true, delta);
2336
+ updateColorValue(l, true, delta);
2215
2337
  }
2216
2338
  function alterHsl(color, type, value) {
2217
2339
  return {
@@ -2261,7 +2383,7 @@
2261
2383
  }
2262
2384
 
2263
2385
  async function loadBlendPlugin(engine) {
2264
- engine.checkVersion("4.3.2");
2386
+ engine.checkVersion("4.4.0");
2265
2387
  await engine.pluginManager.register(e => {
2266
2388
  e.pluginManager.addPlugin(new BlendPlugin());
2267
2389
  });
@@ -2298,7 +2420,7 @@
2298
2420
  }
2299
2421
 
2300
2422
  async function loadCircleShape(engine) {
2301
- engine.checkVersion("4.3.2");
2423
+ engine.checkVersion("4.4.0");
2302
2424
  await engine.pluginManager.register(e => {
2303
2425
  e.pluginManager.addShape(["circle"], () => {
2304
2426
  return Promise.resolve(new CircleDrawer());
@@ -2346,7 +2468,7 @@
2346
2468
  }
2347
2469
 
2348
2470
  async function loadHexColorPlugin(engine) {
2349
- engine.checkVersion("4.3.2");
2471
+ engine.checkVersion("4.4.0");
2350
2472
  await engine.pluginManager.register(e => {
2351
2473
  e.pluginManager.addColorManager("hex", new HexColorManager());
2352
2474
  });
@@ -2399,7 +2521,7 @@
2399
2521
  }
2400
2522
 
2401
2523
  async function loadHslColorPlugin(engine) {
2402
- engine.checkVersion("4.3.2");
2524
+ engine.checkVersion("4.4.0");
2403
2525
  await engine.pluginManager.register(e => {
2404
2526
  e.pluginManager.addColorManager("hsl", new HslColorManager());
2405
2527
  });
@@ -2423,7 +2545,7 @@
2423
2545
  }
2424
2546
 
2425
2547
  async function loadMovePlugin(engine) {
2426
- engine.checkVersion("4.3.2");
2548
+ engine.checkVersion("4.4.0");
2427
2549
  await engine.pluginManager.register(e => {
2428
2550
  const moveEngine = e, movePluginManager = moveEngine.pluginManager;
2429
2551
  movePluginManager.initializers.pathGenerators ??= new Map();
@@ -2639,7 +2761,7 @@
2639
2761
  }
2640
2762
 
2641
2763
  async function loadOpacityUpdater(engine) {
2642
- engine.checkVersion("4.3.2");
2764
+ engine.checkVersion("4.4.0");
2643
2765
  await engine.pluginManager.register(e => {
2644
2766
  e.pluginManager.addParticleUpdater("opacity", container => {
2645
2767
  return Promise.resolve(new OpacityUpdater(container));
@@ -2984,7 +3106,7 @@
2984
3106
  }
2985
3107
 
2986
3108
  async function loadOutModesUpdater(engine) {
2987
- engine.checkVersion("4.3.2");
3109
+ engine.checkVersion("4.4.0");
2988
3110
  await engine.pluginManager.register(e => {
2989
3111
  e.pluginManager.addParticleUpdater("outModes", container => {
2990
3112
  return Promise.resolve(new OutOfCanvasUpdater(container));
@@ -3055,7 +3177,7 @@
3055
3177
  }
3056
3178
 
3057
3179
  async function loadPaintUpdater(engine) {
3058
- engine.checkVersion("4.3.2");
3180
+ engine.checkVersion("4.4.0");
3059
3181
  await engine.pluginManager.register(e => {
3060
3182
  e.pluginManager.addParticleUpdater("paint", container => {
3061
3183
  return Promise.resolve(new PaintUpdater(e.pluginManager, container));
@@ -3110,7 +3232,7 @@
3110
3232
  }
3111
3233
 
3112
3234
  async function loadRgbColorPlugin(engine) {
3113
- engine.checkVersion("4.3.2");
3235
+ engine.checkVersion("4.4.0");
3114
3236
  await engine.pluginManager.register(e => {
3115
3237
  e.pluginManager.addColorManager("rgb", new RgbColorManager());
3116
3238
  });
@@ -3195,7 +3317,7 @@
3195
3317
  }
3196
3318
 
3197
3319
  async function loadSizeUpdater(engine) {
3198
- engine.checkVersion("4.3.2");
3320
+ engine.checkVersion("4.4.0");
3199
3321
  await engine.pluginManager.register(e => {
3200
3322
  e.pluginManager.addParticleUpdater("size", container => {
3201
3323
  return Promise.resolve(new SizeUpdater(container));
@@ -3204,7 +3326,7 @@
3204
3326
  }
3205
3327
 
3206
3328
  async function loadBasic(engine) {
3207
- engine.checkVersion("4.3.2");
3329
+ engine.checkVersion("4.4.0");
3208
3330
  await engine.pluginManager.register(async (e) => {
3209
3331
  await Promise.all([
3210
3332
  loadBlendPlugin(e),
@@ -3504,7 +3626,7 @@
3504
3626
  }
3505
3627
 
3506
3628
  async function loadClubsSuitShape(engine) {
3507
- engine.checkVersion("4.3.2");
3629
+ engine.checkVersion("4.4.0");
3508
3630
  await engine.pluginManager.register(e => {
3509
3631
  e.pluginManager.addShape(["club", "clubs"], () => Promise.resolve(new ClubDrawer()));
3510
3632
  });
@@ -3518,7 +3640,7 @@
3518
3640
  }
3519
3641
 
3520
3642
  async function loadDiamondsSuitShape(engine) {
3521
- engine.checkVersion("4.3.2");
3643
+ engine.checkVersion("4.4.0");
3522
3644
  await engine.pluginManager.register(e => {
3523
3645
  e.pluginManager.addShape(["diamond", "diamonds"], () => Promise.resolve(new DiamondDrawer()));
3524
3646
  });
@@ -3532,7 +3654,7 @@
3532
3654
  };
3533
3655
 
3534
3656
  async function loadHeartsSuitShape(engine) {
3535
- engine.checkVersion("4.3.2");
3657
+ engine.checkVersion("4.4.0");
3536
3658
  await engine.pluginManager.register(e => {
3537
3659
  e.pluginManager.addShape(["heart", "hearts"], () => Promise.resolve(new HeartDrawer$1()));
3538
3660
  });
@@ -3546,14 +3668,14 @@
3546
3668
  }
3547
3669
 
3548
3670
  async function loadSpadesSuitShape(engine) {
3549
- engine.checkVersion("4.3.2");
3671
+ engine.checkVersion("4.4.0");
3550
3672
  await engine.pluginManager.register(e => {
3551
3673
  e.pluginManager.addShape(["spade", "spades"], () => Promise.resolve(new SpadeDrawer()));
3552
3674
  });
3553
3675
  }
3554
3676
 
3555
3677
  async function loadCardSuitsShape(engine) {
3556
- engine.checkVersion("4.3.2");
3678
+ engine.checkVersion("4.4.0");
3557
3679
  await Promise.all([
3558
3680
  loadClubsSuitShape(engine),
3559
3681
  loadDiamondsSuitShape(engine),
@@ -3768,7 +3890,7 @@
3768
3890
  })(EmitterClickMode || (EmitterClickMode = {}));
3769
3891
 
3770
3892
  async function loadEmittersPluginSimple(engine) {
3771
- engine.checkVersion("4.3.2");
3893
+ engine.checkVersion("4.4.0");
3772
3894
  await engine.pluginManager.register(async (e) => {
3773
3895
  const instancesManager = await getEmittersInstancesManager(e);
3774
3896
  await addEmittersShapesManager(e);
@@ -3870,7 +3992,7 @@
3870
3992
  }
3871
3993
 
3872
3994
  async function loadEmojiShape(engine) {
3873
- engine.checkVersion("4.3.2");
3995
+ engine.checkVersion("4.4.0");
3874
3996
  await engine.pluginManager.register(e => {
3875
3997
  e.pluginManager.addShape(validTypes, () => Promise.resolve(new EmojiDrawer()));
3876
3998
  });
@@ -3896,7 +4018,7 @@
3896
4018
  }
3897
4019
 
3898
4020
  async function loadHeartShape(engine) {
3899
- engine.checkVersion("4.3.2");
4021
+ engine.checkVersion("4.4.0");
3900
4022
  await engine.pluginManager.register(e => {
3901
4023
  e.pluginManager.addShape(["heart"], () => Promise.resolve(new HeartDrawer()));
3902
4024
  });
@@ -3905,12 +4027,12 @@
3905
4027
  const shapeTypes = ["image", "images"];
3906
4028
  const stringStart = 0, defaultOpacity = 1;
3907
4029
  const currentColorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d.]+%?\))|currentcolor/gi;
3908
- function replaceColorSvg(imageShape, color, opacity, hdr = false) {
4030
+ function replaceColorSvg(imageShape, color, opacity, hdr = false, peakNits, mode) {
3909
4031
  const { svgData } = imageShape;
3910
4032
  if (!svgData) {
3911
4033
  return "";
3912
4034
  }
3913
- const colorStyle = getStyleFromHsl(color, hdr, opacity);
4035
+ const colorStyle = getStyleFromHsl(color, hdr, opacity, peakNits, mode);
3914
4036
  if (svgData.includes("fill")) {
3915
4037
  return svgData.replaceAll(currentColorRegex, () => colorStyle);
3916
4038
  }
@@ -3952,8 +4074,8 @@
3952
4074
  }
3953
4075
  image.loading = false;
3954
4076
  }
3955
- function replaceImageColor(image, imageData, color, particle, hdr = false) {
3956
- const svgColoredData = replaceColorSvg(image, color, particle.opacity?.value ?? defaultOpacity, hdr), imageRes = {
4077
+ function replaceImageColor(image, imageData, color, particle, hdr = false, peakNits, mode) {
4078
+ const svgColoredData = replaceColorSvg(image, color, particle.opacity?.value ?? defaultOpacity, hdr, peakNits, mode), imageRes = {
3957
4079
  color,
3958
4080
  data: {
3959
4081
  ...image,
@@ -4065,7 +4187,7 @@
4065
4187
  void (async () => {
4066
4188
  let imageRes;
4067
4189
  if (image.svgData && color) {
4068
- imageRes = await replaceImageColor(image, imageData, color, particle, container.hdr);
4190
+ imageRes = await replaceImageColor(image, imageData, color, particle, container.hdr, container.peakNits, container.hdrMode);
4069
4191
  }
4070
4192
  else {
4071
4193
  imageRes = {
@@ -4202,7 +4324,7 @@
4202
4324
  };
4203
4325
  }
4204
4326
  async function loadImageShape(engine) {
4205
- engine.checkVersion("4.3.2");
4327
+ engine.checkVersion("4.4.0");
4206
4328
  await engine.pluginManager.register(e => {
4207
4329
  addLoadImageToEngine(e);
4208
4330
  e.pluginManager.addPlugin(new ImagePreloaderPlugin(e));
@@ -4347,7 +4469,7 @@
4347
4469
  }
4348
4470
 
4349
4471
  async function loadLifeUpdater(engine) {
4350
- engine.checkVersion("4.3.2");
4472
+ engine.checkVersion("4.4.0");
4351
4473
  await engine.pluginManager.register(e => {
4352
4474
  e.pluginManager.addParticleUpdater("life", container => {
4353
4475
  return Promise.resolve(new LifeUpdater(container));
@@ -4401,7 +4523,7 @@
4401
4523
  }
4402
4524
 
4403
4525
  async function loadMotionPlugin(engine) {
4404
- engine.checkVersion("4.3.2");
4526
+ engine.checkVersion("4.4.0");
4405
4527
  await engine.pluginManager.register(e => {
4406
4528
  e.pluginManager.addPlugin(new MotionPlugin());
4407
4529
  });
@@ -4486,19 +4608,19 @@
4486
4608
  }
4487
4609
 
4488
4610
  async function loadGenericPolygonShape(engine) {
4489
- engine.checkVersion("4.3.2");
4611
+ engine.checkVersion("4.4.0");
4490
4612
  await engine.pluginManager.register(e => {
4491
4613
  e.pluginManager.addShape(["polygon"], () => Promise.resolve(new PolygonDrawer()));
4492
4614
  });
4493
4615
  }
4494
4616
  async function loadTriangleShape(engine) {
4495
- engine.checkVersion("4.3.2");
4617
+ engine.checkVersion("4.4.0");
4496
4618
  await engine.pluginManager.register(e => {
4497
4619
  e.pluginManager.addShape(["triangle"], () => Promise.resolve(new TriangleDrawer()));
4498
4620
  });
4499
4621
  }
4500
4622
  async function loadPolygonShape(engine) {
4501
- engine.checkVersion("4.3.2");
4623
+ engine.checkVersion("4.4.0");
4502
4624
  await Promise.all([
4503
4625
  loadGenericPolygonShape(engine),
4504
4626
  loadTriangleShape(engine),
@@ -4632,7 +4754,7 @@
4632
4754
  }
4633
4755
 
4634
4756
  async function loadRollUpdater(engine) {
4635
- engine.checkVersion("4.3.2");
4757
+ engine.checkVersion("4.4.0");
4636
4758
  await engine.pluginManager.register(e => {
4637
4759
  e.pluginManager.addParticleUpdater("roll", () => {
4638
4760
  return Promise.resolve(new RollUpdater(e.pluginManager));
@@ -4738,7 +4860,7 @@
4738
4860
  }
4739
4861
 
4740
4862
  async function loadRotateUpdater(engine) {
4741
- engine.checkVersion("4.3.2");
4863
+ engine.checkVersion("4.4.0");
4742
4864
  await engine.pluginManager.register(e => {
4743
4865
  e.pluginManager.addParticleUpdater("rotate", container => {
4744
4866
  return Promise.resolve(new RotateUpdater(container));
@@ -4762,7 +4884,7 @@
4762
4884
  }
4763
4885
 
4764
4886
  async function loadSquareShape(engine) {
4765
- engine.checkVersion("4.3.2");
4887
+ engine.checkVersion("4.4.0");
4766
4888
  await engine.pluginManager.register(e => {
4767
4889
  e.pluginManager.addShape(["edge", "square"], () => Promise.resolve(new SquareDrawer()));
4768
4890
  });
@@ -4796,7 +4918,7 @@
4796
4918
  }
4797
4919
 
4798
4920
  async function loadStarShape(engine) {
4799
- engine.checkVersion("4.3.2");
4921
+ engine.checkVersion("4.4.0");
4800
4922
  await engine.pluginManager.register(e => {
4801
4923
  e.pluginManager.addShape(["star"], () => Promise.resolve(new StarDrawer()));
4802
4924
  });
@@ -4905,7 +5027,7 @@
4905
5027
  }
4906
5028
 
4907
5029
  async function loadTiltUpdater(engine) {
4908
- engine.checkVersion("4.3.2");
5030
+ engine.checkVersion("4.4.0");
4909
5031
  await engine.pluginManager.register(e => {
4910
5032
  e.pluginManager.addParticleUpdater("tilt", container => {
4911
5033
  return Promise.resolve(new TiltUpdater(container));
@@ -5007,7 +5129,7 @@
5007
5129
  }
5008
5130
 
5009
5131
  async function loadWobbleUpdater(engine) {
5010
- engine.checkVersion("4.3.2");
5132
+ engine.checkVersion("4.4.0");
5011
5133
  await engine.pluginManager.register(e => {
5012
5134
  e.pluginManager.addParticleUpdater("wobble", container => {
5013
5135
  return Promise.resolve(new WobbleUpdater(container));
@@ -5412,7 +5534,7 @@
5412
5534
 
5413
5535
  let initPromise = null;
5414
5536
  async function doInitPlugins(engine) {
5415
- engine.checkVersion("4.3.2");
5537
+ engine.checkVersion("4.4.0");
5416
5538
  await engine.pluginManager.register(async (e) => {
5417
5539
  await Promise.all([
5418
5540
  loadBasic(e),
@@ -5485,7 +5607,7 @@
5485
5607
  confetti.init = async () => {
5486
5608
  await initPlugins(tsParticles);
5487
5609
  };
5488
- confetti.version = "4.3.2";
5610
+ confetti.version = "4.4.0";
5489
5611
  globalThis.confetti = confetti;
5490
5612
 
5491
5613
  const globalObject = globalThis;
@@ -5610,7 +5732,11 @@
5610
5732
  if (!fColor && !sColor) {
5611
5733
  return;
5612
5734
  }
5613
- const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity) : fill;
5735
+ const container = this.#container, zIndexOptions = particle.options.zIndex, zIndexFactor = zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this.#reusableTransform, colorStyles = this.#reusableColorStyles, fill = fColor
5736
+ ? getStyleFromHsl(fColor, container.hdr, fillOpacity * opacity, container.peakNits, container.hdrMode)
5737
+ : undefined, stroke = sColor
5738
+ ? getStyleFromHsl(sColor, container.hdr, strokeOpacity * opacity, container.peakNits, container.hdrMode)
5739
+ : fill;
5614
5740
  transform.a = transform.b = transform.c = transform.d = undefined;
5615
5741
  colorStyles.fill = fill;
5616
5742
  colorStyles.stroke = stroke;
@@ -5944,7 +6070,9 @@
5944
6070
  if (typeof background.element === "string") {
5945
6071
  if (typeof document !== "undefined") {
5946
6072
  const node = document.querySelector(background.element);
5947
- if (node instanceof HTMLCanvasElement || node instanceof HTMLVideoElement || node instanceof HTMLImageElement) {
6073
+ if ((typeof HTMLCanvasElement !== "undefined" && node instanceof HTMLCanvasElement) ||
6074
+ (typeof HTMLVideoElement !== "undefined" && node instanceof HTMLVideoElement) ||
6075
+ (typeof HTMLImageElement !== "undefined" && node instanceof HTMLImageElement)) {
5948
6076
  this.#backgroundElement = node;
5949
6077
  }
5950
6078
  else if (node) {
@@ -5955,10 +6083,10 @@
5955
6083
  }
5956
6084
  }
5957
6085
  }
5958
- else if (background.element instanceof HTMLCanvasElement ||
5959
- background.element instanceof OffscreenCanvas ||
5960
- background.element instanceof HTMLVideoElement ||
5961
- background.element instanceof HTMLImageElement) {
6086
+ else if ((typeof HTMLCanvasElement !== "undefined" && background.element instanceof HTMLCanvasElement) ||
6087
+ (typeof OffscreenCanvas !== "undefined" && background.element instanceof OffscreenCanvas) ||
6088
+ (typeof HTMLVideoElement !== "undefined" && background.element instanceof HTMLVideoElement) ||
6089
+ (typeof HTMLImageElement !== "undefined" && background.element instanceof HTMLImageElement)) {
5962
6090
  this.#backgroundElement = background.element;
5963
6091
  }
5964
6092
  }
@@ -6026,6 +6154,7 @@
6026
6154
  zoom = defaultZoom;
6027
6155
  #container;
6028
6156
  #generated;
6157
+ #hdrMediaListeners;
6029
6158
  #mutationObserver;
6030
6159
  #originalStyle;
6031
6160
  #pluginManager;
@@ -6090,7 +6219,6 @@
6090
6219
  });
6091
6220
  this.resize();
6092
6221
  this.#initStyle();
6093
- this.initBackground();
6094
6222
  this.#safeMutationObserver(obs => {
6095
6223
  const element = this.domElement;
6096
6224
  if (!element || !(element instanceof Node)) {
@@ -6100,6 +6228,8 @@
6100
6228
  });
6101
6229
  this.initPlugins();
6102
6230
  this.#initContext();
6231
+ this.initBackground();
6232
+ this.#initHdrListeners();
6103
6233
  this.render.init();
6104
6234
  }
6105
6235
  initBackground() {
@@ -6109,7 +6239,8 @@
6109
6239
  }
6110
6240
  const elementStyle = element.style, color = rangeColorToRgb(this.#pluginManager, background.color);
6111
6241
  if (color) {
6112
- elementStyle.backgroundColor = getStyleFromRgb(color, container.actualOptions.hdr, background.opacity);
6242
+ const hdrOptions = container.actualOptions.hdr;
6243
+ elementStyle.backgroundColor = getStyleFromRgb(color, container.hdr, background.opacity, hdrOptions.peakNits, hdrOptions.mode);
6113
6244
  }
6114
6245
  else {
6115
6246
  elementStyle.backgroundColor = "";
@@ -6206,6 +6337,7 @@
6206
6337
  obs.disconnect();
6207
6338
  });
6208
6339
  this.#mutationObserver = undefined;
6340
+ this.#removeHdrListeners();
6209
6341
  this.render.stop();
6210
6342
  }
6211
6343
  async windowResize() {
@@ -6225,9 +6357,16 @@
6225
6357
  }
6226
6358
  }
6227
6359
  #initContext() {
6228
- const container = this.#container, canSupportHdr = container.actualOptions.hdr &&
6360
+ const container = this.#container, canSupportHdr = container.actualOptions.hdr.enable &&
6229
6361
  safeMatchMedia("(color-gamut: p3)")?.matches &&
6230
6362
  safeMatchMedia("(dynamic-range: high)")?.matches;
6363
+ container.hdr = canSupportHdr ?? false;
6364
+ container.hdrMode = container.actualOptions.hdr.mode;
6365
+ container.peakNits = container.actualOptions.hdr.peakNits;
6366
+ const renderCanvas = this.renderCanvas;
6367
+ if (!renderCanvas) {
6368
+ return;
6369
+ }
6231
6370
  this.render.setContextSettings({
6232
6371
  alpha: true,
6233
6372
  desynchronized: true,
@@ -6236,11 +6375,47 @@
6236
6375
  ? { colorSpace: "display-p3", colorType: "float16" }
6237
6376
  : { colorSpace: "srgb" }),
6238
6377
  });
6239
- const renderCanvas = this.renderCanvas;
6240
- if (!renderCanvas) {
6241
- return;
6378
+ let context;
6379
+ try {
6380
+ context = renderCanvas.getContext("2d", this.render.settings);
6381
+ }
6382
+ catch {
6383
+ context = null;
6384
+ }
6385
+ if (canSupportHdr && !context) {
6386
+ container.hdr = false;
6387
+ const sdrSettings = {
6388
+ alpha: true,
6389
+ desynchronized: true,
6390
+ willReadFrequently: false,
6391
+ colorSpace: "srgb",
6392
+ };
6393
+ this.render.setContextSettings(sdrSettings);
6394
+ try {
6395
+ context = renderCanvas.getContext("2d", sdrSettings);
6396
+ }
6397
+ catch {
6398
+ context = null;
6399
+ }
6242
6400
  }
6243
- this.render.setContext(renderCanvas.getContext("2d", this.render.settings));
6401
+ this.render.setContext(context);
6402
+ }
6403
+ #initHdrListeners() {
6404
+ this.#removeHdrListeners();
6405
+ const p3Query = safeMatchMedia("(color-gamut: p3)"), hdrQuery = safeMatchMedia("(dynamic-range: high)"), handleChange = () => {
6406
+ this.#recreateRenderCanvas();
6407
+ this.#initContext();
6408
+ this.initBackground();
6409
+ }, listeners = [];
6410
+ if (p3Query) {
6411
+ p3Query.addEventListener("change", handleChange);
6412
+ listeners.push({ handler: handleChange, mql: p3Query });
6413
+ }
6414
+ if (hdrQuery) {
6415
+ hdrQuery.addEventListener("change", handleChange);
6416
+ listeners.push({ handler: handleChange, mql: hdrQuery });
6417
+ }
6418
+ this.#hdrMediaListeners = listeners;
6244
6419
  }
6245
6420
  #initStyle() {
6246
6421
  const element = this.domElement, options = this.#container.actualOptions;
@@ -6264,6 +6439,25 @@
6264
6439
  element.style.setProperty(key, value, "important");
6265
6440
  }
6266
6441
  }
6442
+ #recreateRenderCanvas() {
6443
+ const renderCanvas = this.renderCanvas;
6444
+ if (!renderCanvas) {
6445
+ return;
6446
+ }
6447
+ if (this.domElement) {
6448
+ return;
6449
+ }
6450
+ this.renderCanvas = new OffscreenCanvas(renderCanvas.width, renderCanvas.height);
6451
+ }
6452
+ #removeHdrListeners() {
6453
+ if (!this.#hdrMediaListeners) {
6454
+ return;
6455
+ }
6456
+ for (const { handler, mql } of this.#hdrMediaListeners) {
6457
+ mql.removeEventListener("change", handler);
6458
+ }
6459
+ this.#hdrMediaListeners = undefined;
6460
+ }
6267
6461
  #repairStyle() {
6268
6462
  const element = this.domElement;
6269
6463
  if (!element) {
@@ -6648,9 +6842,9 @@
6648
6842
  }
6649
6843
  getOpacity() {
6650
6844
  const zIndexOptions = this.options.zIndex, zIndexFactor = zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, baseOpacity = getRangeValue(this.opacity?.value ?? defaultOpacity$2), modifierOpacity = this.#applyModifiers(undefined, m => m.opacity), opacity = modifierOpacity ?? baseOpacity, fillOpacity = this.fillOpacity ?? defaultOpacity$2, strokeOpacity = this.strokeOpacity ?? defaultOpacity$2;
6651
- this.#cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;
6845
+ this.#cachedOpacityData.fillOpacity = fillOpacity;
6652
6846
  this.#cachedOpacityData.opacity = opacity * zOpacityFactor;
6653
- this.#cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;
6847
+ this.#cachedOpacityData.strokeOpacity = strokeOpacity;
6654
6848
  return this.#cachedOpacityData;
6655
6849
  }
6656
6850
  getPosition() {
@@ -7505,6 +7699,7 @@
7505
7699
  effectDrawers;
7506
7700
  fpsLimit;
7507
7701
  hdr;
7702
+ hdrMode;
7508
7703
  id;
7509
7704
  pageHidden;
7510
7705
  particleCreatedPlugins;
@@ -7512,6 +7707,7 @@
7512
7707
  particlePositionPlugins;
7513
7708
  particleUpdaters;
7514
7709
  particles;
7710
+ peakNits;
7515
7711
  plugins;
7516
7712
  retina;
7517
7713
  shapeDrawers;
@@ -7542,6 +7738,8 @@
7542
7738
  this.id = Symbol(id);
7543
7739
  this.fpsLimit = 120;
7544
7740
  this.hdr = false;
7741
+ this.hdrMode = exports.HdrMode.standard;
7742
+ this.peakNits = 400;
7545
7743
  this.#smooth = false;
7546
7744
  this.#delay = 0;
7547
7745
  this.#duration = 0;
@@ -7681,8 +7879,9 @@
7681
7879
  this.updateActualOptions();
7682
7880
  this.canvas.initBackground();
7683
7881
  this.canvas.resize();
7684
- const { delay, duration, fpsLimit, hdr, smooth, zLayers } = this.actualOptions;
7685
- this.hdr = hdr;
7882
+ const { delay, duration, fpsLimit, smooth, zLayers } = this.actualOptions, hdrOptions = this.actualOptions.hdr;
7883
+ this.hdrMode = hdrOptions.mode;
7884
+ this.peakNits = hdrOptions.peakNits;
7686
7885
  this.zLayers = zLayers;
7687
7886
  this.#duration = getRangeValue(duration) * millisecondsToSeconds;
7688
7887
  this.#delay = getRangeValue(delay) * millisecondsToSeconds;
@@ -8696,6 +8895,7 @@
8696
8895
  exports.ColorAnimation = ColorAnimation;
8697
8896
  exports.Fill = Fill;
8698
8897
  exports.FullScreen = FullScreen;
8898
+ exports.HDROptions = HDROptions;
8699
8899
  exports.HslAnimation = HslAnimation;
8700
8900
  exports.Move = Move;
8701
8901
  exports.MoveAngle = MoveAngle;