angular-confetti 4.0.4 → 4.1.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.
@@ -4,17 +4,19 @@ import { PLATFORM_ID, Input, Inject, Component, NgModule } from '@angular/core';
4
4
  import { confetti } from '@tsparticles/confetti';
5
5
 
6
6
  class NgxConfettiComponent {
7
+ #container;
8
+ #renderId;
7
9
  constructor(platformId) {
8
10
  this.platformId = platformId;
9
11
  this.id = "tsparticles";
10
12
  this.fire = true;
11
- this.renderId = 0;
13
+ this.#renderId = 0;
12
14
  }
13
15
  ngAfterViewInit() {
14
16
  if (isPlatformServer(this.platformId)) {
15
17
  return;
16
18
  }
17
- void this.tryFire();
19
+ void this.#tryFire();
18
20
  }
19
21
  ngOnChanges(changes) {
20
22
  if (isPlatformServer(this.platformId)) {
@@ -22,28 +24,28 @@ class NgxConfettiComponent {
22
24
  }
23
25
  const fireChanges = changes["fire"];
24
26
  if (this.fire && fireChanges && fireChanges.previousValue !== fireChanges.currentValue) {
25
- void this.tryFire();
27
+ void this.#tryFire();
26
28
  }
27
29
  }
28
30
  ngOnDestroy() {
29
- this.renderId++;
30
- this.container?.destroy();
31
- this.container = undefined;
31
+ this.#renderId++;
32
+ this.#container?.destroy();
33
+ this.#container = undefined;
32
34
  }
33
- async tryFire() {
34
- const currentRenderId = ++this.renderId;
35
+ async #tryFire() {
36
+ const currentRenderId = ++this.#renderId;
35
37
  const container = await confetti(this.id, this.options);
36
- if (currentRenderId !== this.renderId) {
38
+ if (currentRenderId !== this.#renderId) {
37
39
  container?.destroy();
38
40
  return;
39
41
  }
40
- this.container?.destroy();
41
- this.container = container;
42
+ this.#container?.destroy();
43
+ this.#container = container;
42
44
  }
43
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiComponent, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
44
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: NgxConfettiComponent, isStandalone: false, selector: "ngx-confetti", inputs: { options: "options", id: "id", fire: "fire" }, usesOnChanges: true, ngImport: i0, template: '<div [id]="id"></div>', isInline: true }); }
45
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiComponent, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }
46
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: NgxConfettiComponent, isStandalone: false, selector: "ngx-confetti", inputs: { options: "options", id: "id", fire: "fire" }, usesOnChanges: true, ngImport: i0, template: '<div [id]="id"></div>', isInline: true }); }
45
47
  }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiComponent, decorators: [{
48
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiComponent, decorators: [{
47
49
  type: Component,
48
50
  args: [{
49
51
  selector: "ngx-confetti",
@@ -62,11 +64,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
62
64
  }] } });
63
65
 
64
66
  class NgxConfettiModule {
65
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
66
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiModule, declarations: [NgxConfettiComponent], exports: [NgxConfettiComponent] }); }
67
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiModule }); }
67
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
68
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiModule, declarations: [NgxConfettiComponent], exports: [NgxConfettiComponent] }); }
69
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiModule }); }
68
70
  }
69
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: NgxConfettiModule, decorators: [{
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgxConfettiModule, decorators: [{
70
72
  type: NgModule,
71
73
  args: [{
72
74
  declarations: [NgxConfettiComponent],
@@ -1 +1 @@
1
- {"version":3,"file":"angular-confetti.mjs","sources":["../../../projects/ng-confetti/src/lib/ng-confetti.component.ts","../../../projects/ng-confetti/src/lib/ng-confetti.module.ts","../../../projects/ng-confetti/src/public-api.ts","../../../projects/ng-confetti/src/angular-confetti.ts"],"sourcesContent":["import { isPlatformServer } from \"@angular/common\";\nimport {\n AfterViewInit,\n Component,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n PLATFORM_ID,\n SimpleChanges,\n} from \"@angular/core\";\nimport { confetti, ConfettiOptions } from \"@tsparticles/confetti\";\nimport type { Container } from \"@tsparticles/engine\";\n\n@Component({\n selector: \"ngx-confetti\",\n standalone: false,\n template: '<div [id]=\"id\"></div>',\n})\nexport class NgxConfettiComponent implements AfterViewInit, OnChanges, OnDestroy {\n @Input() options?: ConfettiOptions;\n @Input() id = \"tsparticles\";\n @Input() fire: boolean | number = true;\n\n private container?: Container;\n private renderId = 0;\n\n constructor(@Inject(PLATFORM_ID) protected platformId: string) {}\n\n public ngAfterViewInit(): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n void this.tryFire();\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n const fireChanges = changes[\"fire\"];\n\n if (this.fire && fireChanges && fireChanges.previousValue !== fireChanges.currentValue) {\n void this.tryFire();\n }\n }\n\n public ngOnDestroy(): void {\n this.renderId++;\n this.container?.destroy();\n\n this.container = undefined;\n }\n\n private async tryFire(): Promise<void> {\n const currentRenderId = ++this.renderId;\n const container = await confetti(this.id, this.options);\n\n if (currentRenderId !== this.renderId) {\n container?.destroy();\n\n return;\n }\n\n this.container?.destroy();\n this.container = container;\n }\n}\n","import { NgModule } from \"@angular/core\";\nimport { NgxConfettiComponent } from \"./ng-confetti.component\";\n\n@NgModule({\n declarations: [NgxConfettiComponent],\n imports: [],\n exports: [NgxConfettiComponent],\n})\nexport class NgxConfettiModule {}\n","/*\n * Public API Surface of ng-confetti\n */\n\nexport * from \"./lib/ng-confetti.component\";\nexport * from \"./lib/ng-confetti.module\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,oBAAoB,CAAA;AAQ/B,IAAA,WAAA,CAA2C,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;QAN5C,IAAA,CAAA,EAAE,GAAG,aAAa;QAClB,IAAA,CAAA,IAAI,GAAqB,IAAI;QAG9B,IAAA,CAAA,QAAQ,GAAG,CAAC;IAE4C;IAEzD,eAAe,GAAA;AACpB,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACrC;QACF;AAEA,QAAA,KAAK,IAAI,CAAC,OAAO,EAAE;IACrB;AAEO,IAAA,WAAW,CAAC,OAAsB,EAAA;AACvC,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACrC;QACF;AAEA,QAAA,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;AAEnC,QAAA,IAAI,IAAI,CAAC,IAAI,IAAI,WAA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EAAE,KAAK;AACjB,oBAAA,QAAQ,EAAE,uBAAuB;AAClC,iBAAA;;0BASc,MAAM;2BAAC,WAAW;;sBAP9B;;sBACA;;sBACA;;;MCdU,iBAAiB,CAAA;8GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAjB,iBAAiB,EAAA,YAAA,EAAA,CAJb,oBAAoB,CAAA,EAAA,OAAA,EAAA,CAEzB,oBAAoB,CAAA,EAAA,CAAA,CAAA;+GAEnB,iBAAiB,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;AACpC,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,oBAAoB,CAAC;AAChC,iBAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"angular-confetti.mjs","sources":["../../../projects/ng-confetti/src/lib/ng-confetti.component.ts","../../../projects/ng-confetti/src/lib/ng-confetti.module.ts","../../../projects/ng-confetti/src/public-api.ts","../../../projects/ng-confetti/src/angular-confetti.ts"],"sourcesContent":["import { isPlatformServer } from \"@angular/common\";\nimport {\n AfterViewInit,\n Component,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n PLATFORM_ID,\n SimpleChanges,\n} from \"@angular/core\";\nimport { confetti, ConfettiOptions } from \"@tsparticles/confetti\";\nimport type { Container } from \"@tsparticles/engine\";\n\n@Component({\n selector: \"ngx-confetti\",\n standalone: false,\n template: '<div [id]=\"id\"></div>',\n})\nexport class NgxConfettiComponent implements AfterViewInit, OnChanges, OnDestroy {\n @Input() options?: ConfettiOptions;\n @Input() id = \"tsparticles\";\n @Input() fire: boolean | number = true;\n\n #container?: Container;\n #renderId = 0;\n\n constructor(@Inject(PLATFORM_ID) protected platformId: string) {}\n\n public ngAfterViewInit(): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n void this.#tryFire();\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n const fireChanges = changes[\"fire\"];\n\n if (this.fire && fireChanges && fireChanges.previousValue !== fireChanges.currentValue) {\n void this.#tryFire();\n }\n }\n\n public ngOnDestroy(): void {\n this.#renderId++;\n this.#container?.destroy();\n\n this.#container = undefined;\n }\n\n async #tryFire(): Promise<void> {\n const currentRenderId = ++this.#renderId;\n const container = await confetti(this.id, this.options);\n\n if (currentRenderId !== this.#renderId) {\n container?.destroy();\n\n return;\n }\n\n this.#container?.destroy();\n this.#container = container;\n }\n}\n","import { NgModule } from \"@angular/core\";\nimport { NgxConfettiComponent } from \"./ng-confetti.component\";\n\n@NgModule({\n declarations: [NgxConfettiComponent],\n imports: [],\n exports: [NgxConfettiComponent],\n})\nexport class NgxConfettiModule {}\n","/*\n * Public API Surface of ng-confetti\n */\n\nexport * from \"./lib/ng-confetti.component\";\nexport * from \"./lib/ng-confetti.module\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,oBAAoB,CAAA;AAK/B,IAAA,UAAU;AACV,IAAA,SAAS;AAET,IAAA,WAAA,CAA2C,UAAkB,EAAA;QAAlB,IAAA,CAAA,UAAU,GAAV,UAAU;QAN5C,IAAA,CAAA,EAAE,GAAG,aAAa;QAClB,IAAA,CAAA,IAAI,GAAqB,IAAI;QAGtC,IAAA,CAAA,SAAS,GAAG,CAAC;IAEmD;IAEzD,eAAe,GAAA;AACpB,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACrC;QACF;AAEA,QAAA,KAAK,IAAI,CAAC,QAAQ,EAAE;IACtB;AAEO,IAAA,WAAW,CAAC,OAAsB,EAAA;AACvC,QAAA,IAAI,gBAAgB,CAAC,IAAI,CAAC,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tB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBALhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,UAAU,EAAE,KAAK;AACjB,oBAAA,QAAQ,EAAE,uBAAuB;AAClC,iBAAA;;0BASc,MAAM;2BAAC,WAAW;;sBAP9B;;sBACA;;sBACA;;;MCdU,iBAAiB,CAAA;+GAAjB,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAAjB,iBAAiB,EAAA,YAAA,EAAA,CAJb,oBAAoB,CAAA,EAAA,OAAA,EAAA,CAEzB,oBAAoB,CAAA,EAAA,CAAA,CAAA;gHAEnB,iBAAiB,EAAA,CAAA,CAAA;;4FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;AACpC,oBAAA,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,CAAC,oBAAoB,CAAC;AAChC,iBAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-confetti",
3
- "version": "4.0.4",
3
+ "version": "4.1.0",
4
4
  "description": "Official tsParticles Angular Confetti Component - Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for Web Components, React, Vue.js (2.x and 3.x), Svelte, jQuery, Preact, Riot.js, Solid.js, Inferno.",
5
5
  "homepage": "https://confetti.js.org",
6
6
  "repository": {
@@ -85,8 +85,8 @@
85
85
  "@angular/common": ">=2.0.0",
86
86
  "@angular/core": ">=2.0.0",
87
87
  "rxjs": ">=7.0.0",
88
- "@tsparticles/confetti": "^4.0.4",
89
- "@tsparticles/engine": "^4.0.4"
88
+ "@tsparticles/confetti": "^4.1.0",
89
+ "@tsparticles/engine": "^4.1.0"
90
90
  },
91
91
  "dependencies": {
92
92
  "tslib": "^2.8.1"
@@ -3,17 +3,15 @@ import { AfterViewInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/cor
3
3
  import { ConfettiOptions } from '@tsparticles/confetti';
4
4
 
5
5
  declare class NgxConfettiComponent implements AfterViewInit, OnChanges, OnDestroy {
6
+ #private;
6
7
  protected platformId: string;
7
8
  options?: ConfettiOptions;
8
9
  id: string;
9
10
  fire: boolean | number;
10
- private container?;
11
- private renderId;
12
11
  constructor(platformId: string);
13
12
  ngAfterViewInit(): void;
14
13
  ngOnChanges(changes: SimpleChanges): void;
15
14
  ngOnDestroy(): void;
16
- private tryFire;
17
15
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxConfettiComponent, never>;
18
16
  static ɵcmp: i0.ɵɵComponentDeclaration<NgxConfettiComponent, "ngx-confetti", never, { "options": { "alias": "options"; "required": false; }; "id": { "alias": "id"; "required": false; }; "fire": { "alias": "fire"; "required": false; }; }, {}, never, never, false, never>;
19
17
  }