@tsparticles/stencil 4.1.3 → 4.2.1

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 (29) hide show
  1. package/README.md +13 -0
  2. package/dist/cjs/{Container-0BqPfTsu.js → Container-BIhHE6mu.js} +659 -1010
  3. package/dist/cjs/{index-Bw7g3biq.js → index-BIoj1BEO.js} +57 -160
  4. package/dist/cjs/{index-B2lLThjb.js → index-BjS63OiI.js} +95 -5
  5. package/dist/cjs/index.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +2 -2
  7. package/dist/cjs/stencil-particles.cjs.entry.js +23 -6
  8. package/dist/cjs/tsparticlesstencil.cjs.js +2 -2
  9. package/dist/collection/components/stencil-particles/stencil-particles.js +83 -4
  10. package/dist/esm/{Container-BxLt611H.js → Container-DZZsfp6i.js} +659 -1010
  11. package/dist/esm/{index-BXzC9NH1.js → index-BH3sNkGS.js} +57 -160
  12. package/dist/esm/{index-DKFk70aj.js → index-PhwiK2_P.js} +95 -6
  13. package/dist/esm/index.js +1 -1
  14. package/dist/esm/loader.js +3 -3
  15. package/dist/esm/stencil-particles.entry.js +23 -6
  16. package/dist/esm/tsparticlesstencil.js +3 -3
  17. package/dist/tsparticlesstencil/index.esm.js +1 -1
  18. package/dist/tsparticlesstencil/p-CIUgBOXY.js +1 -0
  19. package/dist/tsparticlesstencil/p-PhwiK2_P.js +2 -0
  20. package/dist/tsparticlesstencil/p-QSzGOBhI.js +1 -0
  21. package/dist/tsparticlesstencil/p-bd76f15b.entry.js +1 -0
  22. package/dist/tsparticlesstencil/tsparticlesstencil.esm.js +1 -1
  23. package/dist/types/components/stencil-particles/stencil-particles.d.ts +6 -2
  24. package/dist/types/components.d.ts +24 -2
  25. package/package.json +8 -7
  26. package/dist/tsparticlesstencil/p-BhGs05ap.js +0 -1
  27. package/dist/tsparticlesstencil/p-DKFk70aj.js +0 -2
  28. package/dist/tsparticlesstencil/p-LyLjQmWv.js +0 -1
  29. package/dist/tsparticlesstencil/p-cf6e2424.entry.js +0 -1
@@ -9,7 +9,7 @@ const generatedAttribute = "generated", defaultCompositeValue = "source-over", r
9
9
  b: 0,
10
10
  c: 0,
11
11
  d: 1,
12
- }, randomColorValue = "random", double = 2, doublePI = Math.PI * double, defaultFps = 60, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half + quarter, defaultTransformValue = 1, minimumSize = 0, zIndexFactorOffset = 1, defaultOpacity = 1, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, tryCountIncrement = 1, minZ = 0, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, defaultDensityFactor = 1, deleteCount = 1, defaultAngle = 0, identity = 1, minStrokeWidth = 0, lFactor = 1, lMin = 0, triple = 3, sextuple = 6, sNormalizedOffset = 1, phaseNumerator = 1, defaultRgbMin = 0, defaultZoom = 1;
12
+ }, randomColorValue = "random", double = 2, doublePI = Math.PI * double, defaultFps = 60, generatedTrue = "true", generatedFalse = "false", canvasTag = "canvas", defaultRetryCount = 0, squareExp = 2, spatialHashGridCellSize = 100, defaultRemoveQuantity = 1, defaultRatio = 1, defaultReduceFactor = 1, inverseFactorNumerator = 1, rgbMax = 255, hMax = 360, sMax = 100, lMax = 100, hMin = 0, sMin = 0, hPhase = 60, empty = 0, quarter = 0.25, threeQuarter = half + quarter, defaultTransformValue = 1, minimumSize = 0, zIndexFactorOffset = 1, defaultOpacity = 1, removeDeleteCount = 1, removeMinIndex = 0, defaultFpsLimit = 120, minFpsLimit = 0, canvasFirstIndex = 0, loadRandomFactor = 10000, loadMinIndex = 0, one = 1, none = 0, tryCountIncrement = 1, minZ = 0, minLimit = 0, countOffset = 1, minCount = 0, minIndex = 0, defaultDensityFactor = 1, deleteCount = 1, defaultAngle = 0, identity = 1, minStrokeWidth = 0, lFactor = 1, lMin = 0, maxNits = 400, triple = 3, sextuple = 6, sNormalizedOffset = 1, phaseNumerator = 1, defaultRgbMin = 0, defaultZoom = 1;
13
13
 
14
14
  exports.MoveDirection = void 0;
15
15
  (function (MoveDirection) {
@@ -76,11 +76,6 @@ class Vector3d {
76
76
  div(n) {
77
77
  return Vector3d.create(this.x / n, this.y / n, this.z / n);
78
78
  }
79
- divTo(n) {
80
- this.x /= n;
81
- this.y /= n;
82
- this.z /= n;
83
- }
84
79
  getLengthSq() {
85
80
  return this.x ** squareExp + this.y ** squareExp;
86
81
  }
@@ -262,27 +257,6 @@ function calcExactPositionOrRandomFromSize(data) {
262
257
  };
263
258
  }
264
259
 
265
- var AnimationMode;
266
- (function (AnimationMode) {
267
- AnimationMode["auto"] = "auto";
268
- AnimationMode["increase"] = "increase";
269
- AnimationMode["decrease"] = "decrease";
270
- AnimationMode["random"] = "random";
271
- })(AnimationMode || (AnimationMode = {}));
272
-
273
- var AnimationStatus;
274
- (function (AnimationStatus) {
275
- AnimationStatus["increasing"] = "increasing";
276
- AnimationStatus["decreasing"] = "decreasing";
277
- })(AnimationStatus || (AnimationStatus = {}));
278
-
279
- var DestroyType;
280
- (function (DestroyType) {
281
- DestroyType["none"] = "none";
282
- DestroyType["max"] = "max";
283
- DestroyType["min"] = "min";
284
- })(DestroyType || (DestroyType = {}));
285
-
286
260
  exports.OutModeDirection = void 0;
287
261
  (function (OutModeDirection) {
288
262
  OutModeDirection["bottom"] = "bottom";
@@ -297,66 +271,6 @@ exports.PixelMode = void 0;
297
271
  PixelMode["percent"] = "percent";
298
272
  })(exports.PixelMode || (exports.PixelMode = {}));
299
273
 
300
- var StartValueType;
301
- (function (StartValueType) {
302
- StartValueType["max"] = "max";
303
- StartValueType["min"] = "min";
304
- StartValueType["random"] = "random";
305
- })(StartValueType || (StartValueType = {}));
306
-
307
- function memoize(fn, options) {
308
- const cache = new Map(), keyFn = options?.keyFn, stableStringify = (obj, seen = new WeakSet()) => {
309
- if (obj === null) {
310
- return "null";
311
- }
312
- const t = typeof obj;
313
- if (t === "undefined") {
314
- return "undefined";
315
- }
316
- if (t === "number" || t === "boolean" || t === "string") {
317
- return JSON.stringify(obj);
318
- }
319
- if (t === "function") {
320
- try {
321
- const fn = obj;
322
- return fn.toString();
323
- }
324
- catch {
325
- return '"[Function]"';
326
- }
327
- }
328
- if (t === "symbol") {
329
- try {
330
- return obj.toString();
331
- }
332
- catch {
333
- return '"[Symbol]"';
334
- }
335
- }
336
- if (Array.isArray(obj)) {
337
- return `[${obj.map(i => stableStringify(i, seen)).join(",")}]`;
338
- }
339
- if (seen.has(obj)) {
340
- return '"[Circular]"';
341
- }
342
- seen.add(obj);
343
- const keys = Object.keys(obj).sort();
344
- return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k], seen)}`).join(",")}}`;
345
- }, defaultKeyer = (args) => stableStringify(args), makeKey = (args) => (keyFn ? keyFn(args) : defaultKeyer(args));
346
- return (...args) => {
347
- const key = makeKey(args), now = Date.now(), entry = cache.get(key);
348
- if (entry !== undefined) {
349
- {
350
- cache.delete(key);
351
- cache.set(key, { value: entry.value, ts: entry.ts });
352
- return entry.value;
353
- }
354
- }
355
- const result = fn(...args);
356
- cache.set(key, { value: result, ts: now });
357
- return result;
358
- };
359
- }
360
274
  function hasMatchMedia() {
361
275
  return typeof matchMedia !== "undefined";
362
276
  }
@@ -378,11 +292,8 @@ function safeMutationObserver(callback) {
378
292
  function isInArray(value, array) {
379
293
  return value === array || (isArray(array) && array.includes(value));
380
294
  }
381
- function arrayRandomIndex(array) {
382
- return Math.floor(getRandom() * array.length);
383
- }
384
295
  function itemFromArray(array, index, useIndex = true) {
385
- return array[index !== undefined && useIndex ? index % array.length : arrayRandomIndex(array)];
296
+ return array[index !== undefined && useIndex ? index % array.length : Math.floor(getRandom() * array.length)];
386
297
  }
387
298
  function deepExtend(destination, ...sources) {
388
299
  for (const source of sources) {
@@ -483,30 +394,34 @@ function cloneStyle(style) {
483
394
  }
484
395
  return clonedStyle;
485
396
  }
486
- function computeFullScreenStyle(zIndex) {
487
- const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
488
- width: "100%",
489
- height: "100%",
490
- margin: "0",
491
- padding: "0",
492
- borderWidth: "0",
493
- position: "fixed",
494
- zIndex: zIndex.toString(radix),
495
- "z-index": zIndex.toString(radix),
496
- top: "0",
497
- left: "0",
498
- "pointer-events": "none",
499
- };
500
- for (const key in style) {
501
- const value = style[key];
502
- if (value === undefined) {
503
- continue;
397
+ let _cachedZIndex, _cachedStyle;
398
+ function getFullScreenStyle(zIndex) {
399
+ if (_cachedZIndex !== zIndex || !_cachedStyle) {
400
+ _cachedZIndex = zIndex;
401
+ const fullScreenStyle = safeDocument().createElement("div").style, radix = 10, style = {
402
+ width: "100%",
403
+ height: "100%",
404
+ margin: "0",
405
+ padding: "0",
406
+ borderWidth: "0",
407
+ position: "fixed",
408
+ zIndex: zIndex.toString(radix),
409
+ "z-index": zIndex.toString(radix),
410
+ top: "0",
411
+ left: "0",
412
+ "pointer-events": "none",
413
+ };
414
+ for (const key in style) {
415
+ const value = style[key];
416
+ if (value === undefined) {
417
+ continue;
418
+ }
419
+ fullScreenStyle.setProperty(key, value);
504
420
  }
505
- fullScreenStyle.setProperty(key, value);
421
+ _cachedStyle = fullScreenStyle;
506
422
  }
507
- return fullScreenStyle;
423
+ return _cachedStyle;
508
424
  }
509
- const getFullScreenStyle = memoize(computeFullScreenStyle);
510
425
  function manageListener(element, event, handler, add, options) {
511
426
  if (add) {
512
427
  let addOptions = { passive: true };
@@ -833,7 +748,7 @@ class Engine {
833
748
  return this.#domArray;
834
749
  }
835
750
  get version() {
836
- return "4.1.3";
751
+ return "4.2.1";
837
752
  }
838
753
  addEventListener(type, listener) {
839
754
  this.#eventDispatcher.addEventListener(type, listener);
@@ -868,7 +783,7 @@ class Engine {
868
783
  if (typeof HTMLElement !== "undefined" && params.element instanceof HTMLElement) {
869
784
  domSourceElement = params.element;
870
785
  }
871
- const { Container } = await Promise.resolve().then(function () { return require('./Container-0BqPfTsu.js'); }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
786
+ const { Container } = await Promise.resolve().then(function () { return require('./Container-BIhHE6mu.js'); }), id = params.id ?? domSourceElement?.id ?? `tsparticles${Math.floor(getRandom() * loadRandomFactor).toString()}`, { index, url } = params, options = url ? await getDataFromUrl({ fallback: params.options, url, index }) : params.options, currentOptions = itemFromSingleOrMultiple(options, index), { items } = this, oldIndex = items.findIndex(v => v.id.description === id), newItem = new Container({
872
787
  dispatchCallback: (eventType, args) => {
873
788
  this.dispatchEvent(eventType, args);
874
789
  },
@@ -930,6 +845,14 @@ var RotateDirection;
930
845
  RotateDirection["random"] = "random";
931
846
  })(RotateDirection || (RotateDirection = {}));
932
847
 
848
+ var AnimationMode;
849
+ (function (AnimationMode) {
850
+ AnimationMode["auto"] = "auto";
851
+ AnimationMode["increase"] = "increase";
852
+ AnimationMode["decrease"] = "decrease";
853
+ AnimationMode["random"] = "random";
854
+ })(AnimationMode || (AnimationMode = {}));
855
+
933
856
  exports.LimitMode = void 0;
934
857
  (function (LimitMode) {
935
858
  LimitMode["delete"] = "delete";
@@ -951,6 +874,13 @@ exports.AlterType = void 0;
951
874
  AlterType["enlighten"] = "enlighten";
952
875
  })(exports.AlterType || (exports.AlterType = {}));
953
876
 
877
+ var DestroyType;
878
+ (function (DestroyType) {
879
+ DestroyType["none"] = "none";
880
+ DestroyType["max"] = "max";
881
+ DestroyType["min"] = "min";
882
+ })(DestroyType || (DestroyType = {}));
883
+
954
884
  var GradientType;
955
885
  (function (GradientType) {
956
886
  GradientType["linear"] = "linear";
@@ -965,51 +895,18 @@ exports.ParticleOutType = void 0;
965
895
  ParticleOutType["outside"] = "outside";
966
896
  })(exports.ParticleOutType || (exports.ParticleOutType = {}));
967
897
 
968
- var EasingType;
969
- (function (EasingType) {
970
- EasingType["easeInBack"] = "ease-in-back";
971
- EasingType["easeInBounce"] = "ease-in-bounce";
972
- EasingType["easeInCirc"] = "ease-in-circ";
973
- EasingType["easeInCubic"] = "ease-in-cubic";
974
- EasingType["easeInElastic"] = "ease-in-elastic";
975
- EasingType["easeInExpo"] = "ease-in-expo";
976
- EasingType["easeInGaussian"] = "ease-in-gaussian";
977
- EasingType["easeInLinear"] = "ease-in-linear";
978
- EasingType["easeInQuad"] = "ease-in-quad";
979
- EasingType["easeInQuart"] = "ease-in-quart";
980
- EasingType["easeInQuint"] = "ease-in-quint";
981
- EasingType["easeInSigmoid"] = "ease-in-sigmoid";
982
- EasingType["easeInSine"] = "ease-in-sine";
983
- EasingType["easeInSmoothstep"] = "ease-in-smoothstep";
984
- EasingType["easeOutBack"] = "ease-out-back";
985
- EasingType["easeOutBounce"] = "ease-out-bounce";
986
- EasingType["easeOutCirc"] = "ease-out-circ";
987
- EasingType["easeOutCubic"] = "ease-out-cubic";
988
- EasingType["easeOutElastic"] = "ease-out-elastic";
989
- EasingType["easeOutExpo"] = "ease-out-expo";
990
- EasingType["easeOutGaussian"] = "ease-out-gaussian";
991
- EasingType["easeOutLinear"] = "ease-out-linear";
992
- EasingType["easeOutQuad"] = "ease-out-quad";
993
- EasingType["easeOutQuart"] = "ease-out-quart";
994
- EasingType["easeOutQuint"] = "ease-out-quint";
995
- EasingType["easeOutSigmoid"] = "ease-out-sigmoid";
996
- EasingType["easeOutSine"] = "ease-out-sine";
997
- EasingType["easeOutSmoothstep"] = "ease-out-smoothstep";
998
- EasingType["easeInOutBack"] = "ease-in-out-back";
999
- EasingType["easeInOutBounce"] = "ease-in-out-bounce";
1000
- EasingType["easeInOutCirc"] = "ease-in-out-circ";
1001
- EasingType["easeInOutCubic"] = "ease-in-out-cubic";
1002
- EasingType["easeInOutElastic"] = "ease-in-out-elastic";
1003
- EasingType["easeInOutExpo"] = "ease-in-out-expo";
1004
- EasingType["easeInOutGaussian"] = "ease-in-out-gaussian";
1005
- EasingType["easeInOutLinear"] = "ease-in-out-linear";
1006
- EasingType["easeInOutQuad"] = "ease-in-out-quad";
1007
- EasingType["easeInOutQuart"] = "ease-in-out-quart";
1008
- EasingType["easeInOutQuint"] = "ease-in-out-quint";
1009
- EasingType["easeInOutSigmoid"] = "ease-in-out-sigmoid";
1010
- EasingType["easeInOutSine"] = "ease-in-out-sine";
1011
- EasingType["easeInOutSmoothstep"] = "ease-in-out-smoothstep";
1012
- })(EasingType || (EasingType = {}));
898
+ var StartValueType;
899
+ (function (StartValueType) {
900
+ StartValueType["max"] = "max";
901
+ StartValueType["min"] = "min";
902
+ StartValueType["random"] = "random";
903
+ })(StartValueType || (StartValueType = {}));
904
+
905
+ var AnimationStatus;
906
+ (function (AnimationStatus) {
907
+ AnimationStatus["increasing"] = "increasing";
908
+ AnimationStatus["decreasing"] = "decreasing";
909
+ })(AnimationStatus || (AnimationStatus = {}));
1013
910
 
1014
911
  const tsParticles = initEngine();
1015
912
 
@@ -1079,7 +976,6 @@ exports.degToRad = degToRad;
1079
976
  exports.deleteCount = deleteCount;
1080
977
  exports.double = double;
1081
978
  exports.doublePI = doublePI;
1082
- exports.empty = empty;
1083
979
  exports.executeOnSingleOrMultiple = executeOnSingleOrMultiple;
1084
980
  exports.generatedAttribute = generatedAttribute;
1085
981
  exports.getFullScreenStyle = getFullScreenStyle;
@@ -1110,6 +1006,7 @@ exports.lFactor = lFactor;
1110
1006
  exports.lMax = lMax;
1111
1007
  exports.lMin = lMin;
1112
1008
  exports.manageListener = manageListener;
1009
+ exports.maxNits = maxNits;
1113
1010
  exports.millisecondsToSeconds = millisecondsToSeconds;
1114
1011
  exports.minCount = minCount;
1115
1012
  exports.minFpsLimit = minFpsLimit;
@@ -84,6 +84,7 @@ var registerHost = (hostElement, cmpMeta) => {
84
84
  hostElement.__stencil__getHostRef = () => ref;
85
85
  return ref;
86
86
  };
87
+ var isMemberInElement = (elm, memberName) => memberName in elm;
87
88
  var consoleError = (e, el) => (0, console.error)(e, el);
88
89
 
89
90
  // src/client/client-load-module.ts
@@ -291,6 +292,25 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
291
292
  }
292
293
  return propValue;
293
294
  };
295
+ var getElement = (ref) => {
296
+ var _a;
297
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
298
+ };
299
+
300
+ // src/runtime/event-emitter.ts
301
+ var createEvent = (ref, name, flags) => {
302
+ const elm = getElement(ref);
303
+ return {
304
+ emit: (detail) => {
305
+ return emitEvent(elm, name, {
306
+ bubbles: true,
307
+ composed: true,
308
+ cancelable: true,
309
+ detail
310
+ });
311
+ }
312
+ };
313
+ };
294
314
  var emitEvent = (elm, name, opts) => {
295
315
  const ev = plt.ce(name, opts);
296
316
  elm.dispatchEvent(ev);
@@ -300,6 +320,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
300
320
  if (oldValue === newValue) {
301
321
  return;
302
322
  }
323
+ let isProp = isMemberInElement(elm, memberName);
303
324
  memberName.toLowerCase();
304
325
  if (memberName === "style") {
305
326
  {
@@ -326,7 +347,70 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
326
347
  if (newValue) {
327
348
  queueRefAttachment(newValue, elm);
328
349
  }
329
- } else ;
350
+ } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
351
+ const propName = memberName.slice(5);
352
+ let attrName;
353
+ {
354
+ const hostRef = getHostRef(elm);
355
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
356
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
357
+ if (memberMeta && memberMeta[1]) {
358
+ attrName = memberMeta[1];
359
+ }
360
+ }
361
+ }
362
+ if (!attrName) {
363
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
364
+ }
365
+ if (newValue == null || newValue === false) {
366
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
367
+ elm.removeAttribute(attrName);
368
+ }
369
+ } else {
370
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
371
+ }
372
+ return;
373
+ } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
374
+ const propName = memberName.slice(5);
375
+ try {
376
+ elm[propName] = newValue;
377
+ } catch (e) {
378
+ }
379
+ return;
380
+ } else {
381
+ const isComplex = isComplexType(newValue);
382
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
383
+ try {
384
+ if (!elm.tagName.includes("-")) {
385
+ const n = newValue == null ? "" : newValue;
386
+ if (memberName === "list") {
387
+ isProp = false;
388
+ } else if (oldValue == null || elm[memberName] !== n) {
389
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
390
+ elm[memberName] = n;
391
+ } else {
392
+ elm.setAttribute(memberName, n);
393
+ }
394
+ }
395
+ } else if (elm[memberName] !== newValue) {
396
+ elm[memberName] = newValue;
397
+ }
398
+ } catch (e) {
399
+ }
400
+ }
401
+ if (newValue == null || newValue === false) {
402
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
403
+ {
404
+ elm.removeAttribute(memberName);
405
+ }
406
+ }
407
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
408
+ newValue = newValue === true ? "" : newValue;
409
+ {
410
+ elm.setAttribute(memberName, newValue);
411
+ }
412
+ }
413
+ }
330
414
  };
331
415
 
332
416
  // src/runtime/vdom/update-element.ts
@@ -341,7 +425,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
341
425
  elm,
342
426
  memberName,
343
427
  oldVnodeAttrs[memberName],
344
- void 0);
428
+ void 0,
429
+ isSvgMode2,
430
+ newVnode.$flags$);
345
431
  }
346
432
  }
347
433
  }
@@ -350,7 +436,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
350
436
  elm,
351
437
  memberName,
352
438
  oldVnodeAttrs[memberName],
353
- newVnodeAttrs[memberName]);
439
+ newVnodeAttrs[memberName],
440
+ isSvgMode2,
441
+ newVnode.$flags$);
354
442
  }
355
443
  };
356
444
  function sortedAttrNames(attrNames) {
@@ -363,6 +451,7 @@ function sortedAttrNames(attrNames) {
363
451
  );
364
452
  }
365
453
  var hostTagName;
454
+ var isSvgMode = false;
366
455
  var refCallbacksToRemove = [];
367
456
  var refCallbacksToAttach = [];
368
457
  var createElm = (oldParentVNode, newParentVNode, childIndex) => {
@@ -378,7 +467,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
378
467
  newVNode2.$tag$
379
468
  );
380
469
  {
381
- updateElement(null, newVNode2);
470
+ updateElement(null, newVNode2, isSvgMode);
382
471
  }
383
472
  if (newVNode2.$children$) {
384
473
  const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
@@ -524,7 +613,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
524
613
  const newChildren = newVNode2.$children$;
525
614
  {
526
615
  {
527
- updateElement(oldVNode, newVNode2);
616
+ updateElement(oldVNode, newVNode2, isSvgMode);
528
617
  }
529
618
  if (oldChildren !== null && newChildren !== null) {
530
619
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -1223,6 +1312,7 @@ function transformTag(tag) {
1223
1312
  }
1224
1313
 
1225
1314
  exports.bootstrapLazy = bootstrapLazy;
1315
+ exports.createEvent = createEvent;
1226
1316
  exports.h = h;
1227
1317
  exports.promiseResolve = promiseResolve;
1228
1318
  exports.registerInstance = registerInstance;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bw7g3biq.js');
3
+ var index = require('./index-BIoj1BEO.js');
4
4
 
5
5
 
6
6
 
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-B2lLThjb.js');
3
+ var index = require('./index-BjS63OiI.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["stencil-particles.cjs",[[0,"stencil-particles",{"options":[16],"url":[1],"init":[16]},null,{"options":[{"onPropsChange":0}],"url":[{"onPropsChange":0}],"init":[{"onPropsChange":0}]}]]]], options);
9
+ return index.bootstrapLazy([["stencil-particles.cjs",[[0,"stencil-particles",{"options":[16],"url":[1],"init":[16],"containerId":[1,"container-id"],"theme":[1]},null,{"options":[{"onPropsChange":0}],"url":[{"onPropsChange":0}],"init":[{"onPropsChange":0}],"containerId":[{"onPropsChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-B2lLThjb.js');
4
- var index$1 = require('./index-Bw7g3biq.js');
3
+ var index = require('./index-BjS63OiI.js');
4
+ var index$1 = require('./index-BIoj1BEO.js');
5
5
 
6
6
  const StencilParticles = class {
7
7
  constructor(hostRef) {
8
8
  index.registerInstance(this, hostRef);
9
+ this.particlesLoaded = index.createEvent(this, "particlesLoaded");
9
10
  this.renderId = 0;
10
11
  }
11
12
  async componentDidLoad() {
@@ -20,8 +21,14 @@ const StencilParticles = class {
20
21
  async onPropsChange() {
21
22
  await this.loadParticles(++this.renderId);
22
23
  }
24
+ async onThemeChange() {
25
+ var _a, _b;
26
+ if (!this.container)
27
+ return;
28
+ (_b = (_a = this.container).loadTheme) === null || _b === void 0 ? void 0 : _b.call(_a, this.theme);
29
+ }
23
30
  async loadParticles(currentRenderId) {
24
- var _a;
31
+ var _a, _b, _c;
25
32
  (_a = this.container) === null || _a === void 0 ? void 0 : _a.destroy();
26
33
  if (!this.containerElement) {
27
34
  console.warn("[stencil-particles] container element not available yet");
@@ -40,8 +47,8 @@ const StencilParticles = class {
40
47
  return;
41
48
  }
42
49
  // Load particles directly onto the DOM element.
43
- // tsParticles will auto-generate a unique internal ID, preventing collisions.
44
- const loadParams = Object.assign({ element: this.containerElement }, (this.options ? { options: this.options } : { url: this.url }));
50
+ // If a container-id is provided, use it so consumers can retrieve the container later.
51
+ const loadParams = Object.assign(Object.assign({ element: this.containerElement }, (this.containerId ? { id: this.containerId } : {})), (this.options ? { options: this.options } : { url: this.url }));
45
52
  container = await index$1.tsParticles.load(loadParams);
46
53
  }
47
54
  catch (error) {
@@ -54,9 +61,13 @@ const StencilParticles = class {
54
61
  return;
55
62
  }
56
63
  this.container = container;
64
+ this.particlesLoaded.emit(container);
65
+ if (container && this.theme) {
66
+ (_c = (_b = container).loadTheme) === null || _c === void 0 ? void 0 : _c.call(_b, this.theme);
67
+ }
57
68
  }
58
69
  render() {
59
- return (index.h("div", { key: '870e2cc222aed94f8bbfa274dc3c047392ed8b1a', ref: el => {
70
+ return (index.h("div", { key: 'f5fe33d147a1a606a75fe0d1ee385bacaf0e0b7d', id: this.containerId, ref: el => {
60
71
  this.containerElement = el;
61
72
  }, style: { width: "100%", height: "100%" } }));
62
73
  }
@@ -69,6 +80,12 @@ const StencilParticles = class {
69
80
  }],
70
81
  "init": [{
71
82
  "onPropsChange": 0
83
+ }],
84
+ "containerId": [{
85
+ "onPropsChange": 0
86
+ }],
87
+ "theme": [{
88
+ "onThemeChange": 0
72
89
  }]
73
90
  }; }
74
91
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-B2lLThjb.js');
3
+ var index = require('./index-BjS63OiI.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["stencil-particles.cjs",[[0,"stencil-particles",{"options":[16],"url":[1],"init":[16]},null,{"options":[{"onPropsChange":0}],"url":[{"onPropsChange":0}],"init":[{"onPropsChange":0}]}]]]], options);
22
+ return index.bootstrapLazy([["stencil-particles.cjs",[[0,"stencil-particles",{"options":[16],"url":[1],"init":[16],"containerId":[1,"container-id"],"theme":[1]},null,{"options":[{"onPropsChange":0}],"url":[{"onPropsChange":0}],"init":[{"onPropsChange":0}],"containerId":[{"onPropsChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;