@tsparticles/template-tictactoe 4.1.3 → 4.2.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 (66) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +3 -0
  3. package/package.json +4 -3
  4. package/template/angular/package.json +34 -0
  5. package/template/angular/src/app/app.component.css +97 -0
  6. package/template/angular/src/app/app.component.html +21 -0
  7. package/template/angular/src/app/app.component.ts +94 -0
  8. package/template/angular-confetti/package.json +34 -0
  9. package/template/angular-confetti/src/app/app.component.css +97 -0
  10. package/template/angular-confetti/src/app/app.component.html +21 -0
  11. package/template/angular-confetti/src/app/app.component.ts +94 -0
  12. package/template/angular-fireworks/package.json +34 -0
  13. package/template/angular-fireworks/src/app/app.component.css +97 -0
  14. package/template/angular-fireworks/src/app/app.component.html +21 -0
  15. package/template/angular-fireworks/src/app/app.component.ts +94 -0
  16. package/template/astro/package.json +15 -0
  17. package/template/astro/src/pages/index.astro +158 -0
  18. package/template/ember/app/controllers/application.js +94 -0
  19. package/template/ember/app/templates/application.hbs +39 -0
  20. package/template/ember/package.json +17 -0
  21. package/template/inferno/package.json +20 -0
  22. package/template/inferno/src/App.css +97 -0
  23. package/template/inferno/src/App.tsx +149 -0
  24. package/template/jquery/package.json +20 -0
  25. package/template/jquery/src/main.ts +126 -0
  26. package/template/jquery/src/style.css +97 -0
  27. package/template/lit/package.json +19 -0
  28. package/template/lit/src/my-app.ts +133 -0
  29. package/template/nextjs/package.json +20 -0
  30. package/template/nextjs/src/app/page.tsx +173 -0
  31. package/template/nextjs/src/app/providers.tsx +13 -0
  32. package/template/nuxt2/package.json +14 -0
  33. package/template/nuxt2/pages/index.vue +203 -0
  34. package/template/nuxt3/app.vue +204 -0
  35. package/template/nuxt3/package.json +16 -0
  36. package/template/nuxt4/app.vue +202 -0
  37. package/template/nuxt4/package.json +16 -0
  38. package/template/preact/package.json +20 -0
  39. package/template/preact/src/App.css +97 -0
  40. package/template/preact/src/App.tsx +141 -0
  41. package/template/qwik/package.json +19 -0
  42. package/template/qwik/src/App.tsx +132 -0
  43. package/template/react/package.json +19 -0
  44. package/template/react/src/App.css +97 -0
  45. package/template/react/src/App.tsx +141 -0
  46. package/template/riot/package.json +20 -0
  47. package/template/riot/src/app.riot +139 -0
  48. package/template/solid/package.json +18 -0
  49. package/template/solid/src/App.tsx +151 -0
  50. package/template/solid/src/index.css +97 -0
  51. package/template/solid/src/main.tsx +9 -0
  52. package/template/stencil/package.json +14 -0
  53. package/template/stencil/src/components/app-home/app-home.css +97 -0
  54. package/template/stencil/src/components/app-home/app-home.tsx +122 -0
  55. package/template/svelte/package.json +20 -0
  56. package/template/svelte/src/App.svelte +256 -0
  57. package/template/svelte/src/main.ts +12 -0
  58. package/template/vanilla/LICENSE +21 -0
  59. package/template/vue2/package.json +19 -0
  60. package/template/vue2/src/App.vue +204 -0
  61. package/template/vue3/package.json +19 -0
  62. package/template/vue3/src/App.vue +215 -0
  63. package/template/vue3/src/main.ts +14 -0
  64. package/template/webcomponents/package.json +18 -0
  65. package/template/webcomponents/src/main.ts +134 -0
  66. package/template/webcomponents/src/style.css +97 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [4.2.0](https://github.com/tsparticles/tsparticles/compare/v4.1.3...v4.2.0) (2026-06-17)
7
+
8
+ ### Features
9
+
10
+ - adding templates to cli create ([bc118ef](https://github.com/tsparticles/tsparticles/commit/bc118efa3f40497f9fa84186ac6102411a19fda7))
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @tsparticles/template-tictactoe
2
+
3
+ tsParticles tic-tac-toe game template. Use with `create-tsparticles-app` to scaffold a new tic-tac-toe game project with animated particles.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/template-tictactoe",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,7 +8,8 @@
8
8
  "scripts": {
9
9
  "prebuild": "node scripts/prebuild.js",
10
10
  "build": "pnpm run prebuild",
11
- "build:ci": "pnpm run prebuild"
11
+ "build:ci": "pnpm run prebuild",
12
+ "version": "pnpm run build && git add template.json"
12
13
  },
13
- "gitHead": "0551736c55ae8eec3855a693af8a99b1b4420350"
14
+ "gitHead": "0a0fbf89c6cb3e1c2395763f55dabecfa85618f9"
14
15
  }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "dev": "ng serve",
9
+ "build": "ng build",
10
+ "preview": "ng serve",
11
+ "watch": "ng build --watch --configuration development"
12
+ },
13
+ "dependencies": {
14
+ "@angular/animations": "~22.0.0",
15
+ "@angular/common": "~22.0.0",
16
+ "@angular/compiler": "~22.0.0",
17
+ "@angular/core": "~22.0.0",
18
+ "@angular/forms": "~22.0.0",
19
+ "@angular/platform-browser": "~22.0.0",
20
+ "@angular/platform-browser-dynamic": "~22.0.0",
21
+ "@angular/router": "~22.0.0",
22
+ "@tsparticles/angular": "^4.1.3",
23
+ "@tsparticles/confetti": "^3.8.1",
24
+ "rxjs": "~7.8.2",
25
+ "tslib": "^2.8.1",
26
+ "zone.js": "~0.16.2"
27
+ },
28
+ "devDependencies": {
29
+ "@angular-devkit/build-angular": "~22.0.0",
30
+ "@angular/cli": "~22.0.0",
31
+ "@angular/compiler-cli": "~22.0.0",
32
+ "typescript": "~6.0.3"
33
+ }
34
+ }
@@ -0,0 +1,97 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ margin: 0;
7
+ min-height: 100vh;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ background: #0a0a1a;
12
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
13
+ color: #fff;
14
+ }
15
+
16
+ #app {
17
+ text-align: center;
18
+ z-index: 10;
19
+ padding: 1rem;
20
+ }
21
+
22
+ h1 {
23
+ font-size: 2.5em;
24
+ margin-bottom: 1rem;
25
+ background: linear-gradient(135deg, #6c5ce7, #fd79a8);
26
+ -webkit-background-clip: text;
27
+ -webkit-text-fill-color: transparent;
28
+ background-clip: text;
29
+ }
30
+
31
+ .scoreboard {
32
+ display: flex;
33
+ justify-content: center;
34
+ gap: 2rem;
35
+ margin-bottom: 1rem;
36
+ font-size: 1.1em;
37
+ opacity: 0.8;
38
+ }
39
+
40
+ .turn {
41
+ font-size: 1.2em;
42
+ margin-bottom: 1rem;
43
+ opacity: 0.7;
44
+ }
45
+
46
+ .board {
47
+ display: grid;
48
+ grid-template-columns: repeat(3, 100px);
49
+ grid-template-rows: repeat(3, 100px);
50
+ gap: 4px;
51
+ background: rgba(255, 255, 255, 0.1);
52
+ border-radius: 12px;
53
+ overflow: hidden;
54
+ margin: 0 auto;
55
+ width: fit-content;
56
+ }
57
+
58
+ .cell {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ font-size: 2.5em;
63
+ font-weight: 700;
64
+ background: #12122a;
65
+ cursor: pointer;
66
+ transition: background 0.2s;
67
+ user-select: none;
68
+ }
69
+
70
+ .cell:hover {
71
+ background: #1a1a3a;
72
+ }
73
+
74
+ .cell.taken {
75
+ cursor: default;
76
+ }
77
+
78
+ .cell.win {
79
+ background: rgba(108, 92, 231, 0.3);
80
+ }
81
+
82
+ .reset-btn {
83
+ margin-top: 1.5rem;
84
+ padding: 0.7em 2em;
85
+ font-size: 1em;
86
+ font-weight: 600;
87
+ border: none;
88
+ border-radius: 8px;
89
+ background: linear-gradient(135deg, #6c5ce7, #a29bfe);
90
+ color: #fff;
91
+ cursor: pointer;
92
+ transition: transform 0.2s;
93
+ }
94
+
95
+ .reset-btn:hover {
96
+ transform: scale(1.05);
97
+ }
@@ -0,0 +1,21 @@
1
+ <ngx-particles id="tsparticles" [options]="particlesOptions" />
2
+
3
+ <div id="app">
4
+ <h1>Tic-Tac-Toe</h1>
5
+ <div class="scoreboard">
6
+ <span>X: <strong>{{ scores.X }}</strong></span>
7
+ <span>Draws: <strong>{{ scores.draw }}</strong></span>
8
+ <span>O: <strong>{{ scores.O }}</strong></span>
9
+ </div>
10
+ <div class="turn">{{ status }}</div>
11
+ <div class="board">
12
+ <div
13
+ *ngFor="let cell of board; let i = index"
14
+ [ngClass]="['cell', { taken: cell, win: winLine?.includes(i) }]"
15
+ (click)="handleMove(i)"
16
+ >
17
+ {{ cell }}
18
+ </div>
19
+ </div>
20
+ <button class="reset-btn" (click)="handleReset()">New Game</button>
21
+ </div>
@@ -0,0 +1,94 @@
1
+ import { Component } from "@angular/core";
2
+ import { confetti } from "@tsparticles/confetti";
3
+ import type { ISourceOptions } from "@tsparticles/engine";
4
+
5
+ type Player = "X" | "O";
6
+
7
+ const WIN_PATTERNS = [
8
+ [0, 1, 2], [3, 4, 5], [6, 7, 8],
9
+ [0, 3, 6], [1, 4, 7], [2, 5, 8],
10
+ [0, 4, 8], [2, 4, 6],
11
+ ];
12
+
13
+ @Component({
14
+ selector: "app-root",
15
+ templateUrl: "./app.component.html",
16
+ styleUrls: ["./app.component.css"],
17
+ })
18
+ export class AppComponent {
19
+ board: (Player | null)[] = Array(9).fill(null);
20
+ currentPlayer: Player = "X";
21
+ winner: Player | "draw" | null = null;
22
+ winLine: number[] | null = null;
23
+ scores = { X: 0, O: 0, draw: 0 };
24
+
25
+ particlesOptions: ISourceOptions = {
26
+ fullScreen: { enable: true, zIndex: -1 },
27
+ background: { color: { value: "#0a0a1a" } },
28
+ fpsLimit: 60,
29
+ particles: {
30
+ number: { value: 30, density: { enable: true } },
31
+ color: { value: ["#6c5ce7", "#a29bfe"] },
32
+ shape: { type: "circle" },
33
+ opacity: { value: 0.2, random: true },
34
+ size: { value: { min: 1, max: 2 } },
35
+ move: { enable: true, speed: 0.5, direction: "none", random: true, straight: false, outModes: { default: "out" } },
36
+ },
37
+ detectRetina: true,
38
+ };
39
+
40
+ get status(): string {
41
+ if (!this.winner) return `${this.currentPlayer}'s turn`;
42
+ if (this.winner === "draw") return "It's a draw!";
43
+ return `${this.winner} wins!`;
44
+ }
45
+
46
+ private checkWin(board: (Player | null)[]): { winner: Player | "draw"; winLine: number[] } | null {
47
+ for (const pattern of WIN_PATTERNS) {
48
+ const [a, b, c] = pattern;
49
+ if (board[a] && board[a] === board[b] && board[a] === board[c]) {
50
+ return { winner: board[a] as Player, winLine: pattern };
51
+ }
52
+ }
53
+ if (board.every((cell) => cell !== null)) return { winner: "draw" as const, winLine: [] };
54
+ return null;
55
+ }
56
+
57
+ private fireConfettiEffect(): void {
58
+ const count = 200;
59
+ const defaults = { origin: { y: 0.7 } };
60
+ const fire = (particleRatio: number, opts: Record<string, unknown>) => {
61
+ confetti({ ...defaults, ...opts, particleCount: Math.floor(count * particleRatio) });
62
+ };
63
+ fire(0.25, { spread: 26, startVelocity: 55 });
64
+ fire(0.2, { spread: 60 });
65
+ fire(0.35, { spread: 100, decay: 0.91, scalar: 0.8 });
66
+ fire(0.1, { spread: 120, startVelocity: 25, decay: 0.92, scalar: 1.2 });
67
+ fire(0.1, { spread: 120, startVelocity: 45 });
68
+ }
69
+
70
+ handleMove(index: number): void {
71
+ if (this.board[index] || this.winner) return;
72
+ const board = [...this.board];
73
+ board[index] = this.currentPlayer;
74
+ const result = this.checkWin(board);
75
+ if (result) {
76
+ this.board = board;
77
+ this.winner = result.winner;
78
+ this.winLine = result.winLine;
79
+ if (result.winner === "draw") this.scores.draw++;
80
+ else this.scores[result.winner]++;
81
+ if (result.winner !== "draw") setTimeout(() => this.fireConfettiEffect(), 100);
82
+ } else {
83
+ this.board = board;
84
+ this.currentPlayer = this.currentPlayer === "X" ? "O" : "X";
85
+ }
86
+ }
87
+
88
+ handleReset(): void {
89
+ this.board = Array(9).fill(null);
90
+ this.currentPlayer = "X";
91
+ this.winner = null;
92
+ this.winLine = null;
93
+ }
94
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "dev": "ng serve",
9
+ "build": "ng build",
10
+ "preview": "ng serve",
11
+ "watch": "ng build --watch --configuration development"
12
+ },
13
+ "dependencies": {
14
+ "@angular/animations": "~22.0.0",
15
+ "@angular/common": "~22.0.0",
16
+ "@angular/compiler": "~22.0.0",
17
+ "@angular/core": "~22.0.0",
18
+ "@angular/forms": "~22.0.0",
19
+ "@angular/platform-browser": "~22.0.0",
20
+ "@angular/platform-browser-dynamic": "~22.0.0",
21
+ "@angular/router": "~22.0.0",
22
+ "@tsparticles/angular": "^4.1.3",
23
+ "@tsparticles/confetti": "^3.8.1",
24
+ "rxjs": "~7.8.2",
25
+ "tslib": "^2.8.1",
26
+ "zone.js": "~0.16.2"
27
+ },
28
+ "devDependencies": {
29
+ "@angular-devkit/build-angular": "~22.0.0",
30
+ "@angular/cli": "~22.0.0",
31
+ "@angular/compiler-cli": "~22.0.0",
32
+ "typescript": "~6.0.3"
33
+ }
34
+ }
@@ -0,0 +1,97 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ margin: 0;
7
+ min-height: 100vh;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ background: #0a0a1a;
12
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
13
+ color: #fff;
14
+ }
15
+
16
+ #app {
17
+ text-align: center;
18
+ z-index: 10;
19
+ padding: 1rem;
20
+ }
21
+
22
+ h1 {
23
+ font-size: 2.5em;
24
+ margin-bottom: 1rem;
25
+ background: linear-gradient(135deg, #6c5ce7, #fd79a8);
26
+ -webkit-background-clip: text;
27
+ -webkit-text-fill-color: transparent;
28
+ background-clip: text;
29
+ }
30
+
31
+ .scoreboard {
32
+ display: flex;
33
+ justify-content: center;
34
+ gap: 2rem;
35
+ margin-bottom: 1rem;
36
+ font-size: 1.1em;
37
+ opacity: 0.8;
38
+ }
39
+
40
+ .turn {
41
+ font-size: 1.2em;
42
+ margin-bottom: 1rem;
43
+ opacity: 0.7;
44
+ }
45
+
46
+ .board {
47
+ display: grid;
48
+ grid-template-columns: repeat(3, 100px);
49
+ grid-template-rows: repeat(3, 100px);
50
+ gap: 4px;
51
+ background: rgba(255, 255, 255, 0.1);
52
+ border-radius: 12px;
53
+ overflow: hidden;
54
+ margin: 0 auto;
55
+ width: fit-content;
56
+ }
57
+
58
+ .cell {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ font-size: 2.5em;
63
+ font-weight: 700;
64
+ background: #12122a;
65
+ cursor: pointer;
66
+ transition: background 0.2s;
67
+ user-select: none;
68
+ }
69
+
70
+ .cell:hover {
71
+ background: #1a1a3a;
72
+ }
73
+
74
+ .cell.taken {
75
+ cursor: default;
76
+ }
77
+
78
+ .cell.win {
79
+ background: rgba(108, 92, 231, 0.3);
80
+ }
81
+
82
+ .reset-btn {
83
+ margin-top: 1.5rem;
84
+ padding: 0.7em 2em;
85
+ font-size: 1em;
86
+ font-weight: 600;
87
+ border: none;
88
+ border-radius: 8px;
89
+ background: linear-gradient(135deg, #6c5ce7, #a29bfe);
90
+ color: #fff;
91
+ cursor: pointer;
92
+ transition: transform 0.2s;
93
+ }
94
+
95
+ .reset-btn:hover {
96
+ transform: scale(1.05);
97
+ }
@@ -0,0 +1,21 @@
1
+ <ngx-particles id="tsparticles" [options]="particlesOptions" />
2
+
3
+ <div id="app">
4
+ <h1>Tic-Tac-Toe</h1>
5
+ <div class="scoreboard">
6
+ <span>X: <strong>{{ scores.X }}</strong></span>
7
+ <span>Draws: <strong>{{ scores.draw }}</strong></span>
8
+ <span>O: <strong>{{ scores.O }}</strong></span>
9
+ </div>
10
+ <div class="turn">{{ status }}</div>
11
+ <div class="board">
12
+ <div
13
+ *ngFor="let cell of board; let i = index"
14
+ [ngClass]="['cell', { taken: cell, win: winLine?.includes(i) }]"
15
+ (click)="handleMove(i)"
16
+ >
17
+ {{ cell }}
18
+ </div>
19
+ </div>
20
+ <button class="reset-btn" (click)="handleReset()">New Game</button>
21
+ </div>
@@ -0,0 +1,94 @@
1
+ import { Component } from "@angular/core";
2
+ import { confetti } from "@tsparticles/confetti";
3
+ import type { ISourceOptions } from "@tsparticles/engine";
4
+
5
+ type Player = "X" | "O";
6
+
7
+ const WIN_PATTERNS = [
8
+ [0, 1, 2], [3, 4, 5], [6, 7, 8],
9
+ [0, 3, 6], [1, 4, 7], [2, 5, 8],
10
+ [0, 4, 8], [2, 4, 6],
11
+ ];
12
+
13
+ @Component({
14
+ selector: "app-root",
15
+ templateUrl: "./app.component.html",
16
+ styleUrls: ["./app.component.css"],
17
+ })
18
+ export class AppComponent {
19
+ board: (Player | null)[] = Array(9).fill(null);
20
+ currentPlayer: Player = "X";
21
+ winner: Player | "draw" | null = null;
22
+ winLine: number[] | null = null;
23
+ scores = { X: 0, O: 0, draw: 0 };
24
+
25
+ particlesOptions: ISourceOptions = {
26
+ fullScreen: { enable: true, zIndex: -1 },
27
+ background: { color: { value: "#0a0a1a" } },
28
+ fpsLimit: 60,
29
+ particles: {
30
+ number: { value: 30, density: { enable: true } },
31
+ color: { value: ["#6c5ce7", "#a29bfe"] },
32
+ shape: { type: "circle" },
33
+ opacity: { value: 0.2, random: true },
34
+ size: { value: { min: 1, max: 2 } },
35
+ move: { enable: true, speed: 0.5, direction: "none", random: true, straight: false, outModes: { default: "out" } },
36
+ },
37
+ detectRetina: true,
38
+ };
39
+
40
+ get status(): string {
41
+ if (!this.winner) return `${this.currentPlayer}'s turn`;
42
+ if (this.winner === "draw") return "It's a draw!";
43
+ return `${this.winner} wins!`;
44
+ }
45
+
46
+ private checkWin(board: (Player | null)[]): { winner: Player | "draw"; winLine: number[] } | null {
47
+ for (const pattern of WIN_PATTERNS) {
48
+ const [a, b, c] = pattern;
49
+ if (board[a] && board[a] === board[b] && board[a] === board[c]) {
50
+ return { winner: board[a] as Player, winLine: pattern };
51
+ }
52
+ }
53
+ if (board.every((cell) => cell !== null)) return { winner: "draw" as const, winLine: [] };
54
+ return null;
55
+ }
56
+
57
+ private fireConfettiEffect(): void {
58
+ const count = 200;
59
+ const defaults = { origin: { y: 0.7 } };
60
+ const fire = (particleRatio: number, opts: Record<string, unknown>) => {
61
+ confetti({ ...defaults, ...opts, particleCount: Math.floor(count * particleRatio) });
62
+ };
63
+ fire(0.25, { spread: 26, startVelocity: 55 });
64
+ fire(0.2, { spread: 60 });
65
+ fire(0.35, { spread: 100, decay: 0.91, scalar: 0.8 });
66
+ fire(0.1, { spread: 120, startVelocity: 25, decay: 0.92, scalar: 1.2 });
67
+ fire(0.1, { spread: 120, startVelocity: 45 });
68
+ }
69
+
70
+ handleMove(index: number): void {
71
+ if (this.board[index] || this.winner) return;
72
+ const board = [...this.board];
73
+ board[index] = this.currentPlayer;
74
+ const result = this.checkWin(board);
75
+ if (result) {
76
+ this.board = board;
77
+ this.winner = result.winner;
78
+ this.winLine = result.winLine;
79
+ if (result.winner === "draw") this.scores.draw++;
80
+ else this.scores[result.winner]++;
81
+ if (result.winner !== "draw") setTimeout(() => this.fireConfettiEffect(), 100);
82
+ } else {
83
+ this.board = board;
84
+ this.currentPlayer = this.currentPlayer === "X" ? "O" : "X";
85
+ }
86
+ }
87
+
88
+ handleReset(): void {
89
+ this.board = Array(9).fill(null);
90
+ this.currentPlayer = "X";
91
+ this.winner = null;
92
+ this.winLine = null;
93
+ }
94
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "ng": "ng",
7
+ "start": "ng serve",
8
+ "dev": "ng serve",
9
+ "build": "ng build",
10
+ "preview": "ng serve",
11
+ "watch": "ng build --watch --configuration development"
12
+ },
13
+ "dependencies": {
14
+ "@angular/animations": "~22.0.0",
15
+ "@angular/common": "~22.0.0",
16
+ "@angular/compiler": "~22.0.0",
17
+ "@angular/core": "~22.0.0",
18
+ "@angular/forms": "~22.0.0",
19
+ "@angular/platform-browser": "~22.0.0",
20
+ "@angular/platform-browser-dynamic": "~22.0.0",
21
+ "@angular/router": "~22.0.0",
22
+ "@tsparticles/angular": "^4.1.3",
23
+ "@tsparticles/confetti": "^3.8.1",
24
+ "rxjs": "~7.8.2",
25
+ "tslib": "^2.8.1",
26
+ "zone.js": "~0.16.2"
27
+ },
28
+ "devDependencies": {
29
+ "@angular-devkit/build-angular": "~22.0.0",
30
+ "@angular/cli": "~22.0.0",
31
+ "@angular/compiler-cli": "~22.0.0",
32
+ "typescript": "~6.0.3"
33
+ }
34
+ }
@@ -0,0 +1,97 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ margin: 0;
7
+ min-height: 100vh;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+ background: #0a0a1a;
12
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
13
+ color: #fff;
14
+ }
15
+
16
+ #app {
17
+ text-align: center;
18
+ z-index: 10;
19
+ padding: 1rem;
20
+ }
21
+
22
+ h1 {
23
+ font-size: 2.5em;
24
+ margin-bottom: 1rem;
25
+ background: linear-gradient(135deg, #6c5ce7, #fd79a8);
26
+ -webkit-background-clip: text;
27
+ -webkit-text-fill-color: transparent;
28
+ background-clip: text;
29
+ }
30
+
31
+ .scoreboard {
32
+ display: flex;
33
+ justify-content: center;
34
+ gap: 2rem;
35
+ margin-bottom: 1rem;
36
+ font-size: 1.1em;
37
+ opacity: 0.8;
38
+ }
39
+
40
+ .turn {
41
+ font-size: 1.2em;
42
+ margin-bottom: 1rem;
43
+ opacity: 0.7;
44
+ }
45
+
46
+ .board {
47
+ display: grid;
48
+ grid-template-columns: repeat(3, 100px);
49
+ grid-template-rows: repeat(3, 100px);
50
+ gap: 4px;
51
+ background: rgba(255, 255, 255, 0.1);
52
+ border-radius: 12px;
53
+ overflow: hidden;
54
+ margin: 0 auto;
55
+ width: fit-content;
56
+ }
57
+
58
+ .cell {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ font-size: 2.5em;
63
+ font-weight: 700;
64
+ background: #12122a;
65
+ cursor: pointer;
66
+ transition: background 0.2s;
67
+ user-select: none;
68
+ }
69
+
70
+ .cell:hover {
71
+ background: #1a1a3a;
72
+ }
73
+
74
+ .cell.taken {
75
+ cursor: default;
76
+ }
77
+
78
+ .cell.win {
79
+ background: rgba(108, 92, 231, 0.3);
80
+ }
81
+
82
+ .reset-btn {
83
+ margin-top: 1.5rem;
84
+ padding: 0.7em 2em;
85
+ font-size: 1em;
86
+ font-weight: 600;
87
+ border: none;
88
+ border-radius: 8px;
89
+ background: linear-gradient(135deg, #6c5ce7, #a29bfe);
90
+ color: #fff;
91
+ cursor: pointer;
92
+ transition: transform 0.2s;
93
+ }
94
+
95
+ .reset-btn:hover {
96
+ transform: scale(1.05);
97
+ }
@@ -0,0 +1,21 @@
1
+ <ngx-particles id="tsparticles" [options]="particlesOptions" />
2
+
3
+ <div id="app">
4
+ <h1>Tic-Tac-Toe</h1>
5
+ <div class="scoreboard">
6
+ <span>X: <strong>{{ scores.X }}</strong></span>
7
+ <span>Draws: <strong>{{ scores.draw }}</strong></span>
8
+ <span>O: <strong>{{ scores.O }}</strong></span>
9
+ </div>
10
+ <div class="turn">{{ status }}</div>
11
+ <div class="board">
12
+ <div
13
+ *ngFor="let cell of board; let i = index"
14
+ [ngClass]="['cell', { taken: cell, win: winLine?.includes(i) }]"
15
+ (click)="handleMove(i)"
16
+ >
17
+ {{ cell }}
18
+ </div>
19
+ </div>
20
+ <button class="reset-btn" (click)="handleReset()">New Game</button>
21
+ </div>