create-template-html-css 1.8.1 → 2.0.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 (55) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +179 -2
  3. package/bin/cli.js +20 -2
  4. package/package.json +1 -1
  5. package/templates/blackjack/index.html +97 -0
  6. package/templates/blackjack/script.js +381 -0
  7. package/templates/blackjack/style.css +452 -0
  8. package/templates/breakout/index.html +56 -0
  9. package/templates/breakout/script.js +387 -0
  10. package/templates/breakout/style.css +239 -0
  11. package/templates/connect-four/index.html +78 -0
  12. package/templates/connect-four/script.js +413 -0
  13. package/templates/connect-four/style.css +426 -0
  14. package/templates/dice-game/index.html +99 -0
  15. package/templates/dice-game/script.js +291 -0
  16. package/templates/dice-game/style.css +403 -0
  17. package/templates/flappy-bird/index.html +47 -0
  18. package/templates/flappy-bird/script.js +394 -0
  19. package/templates/flappy-bird/style.css +243 -0
  20. package/templates/game-2048/index.html +59 -0
  21. package/templates/game-2048/script.js +269 -0
  22. package/templates/game-2048/style.css +281 -0
  23. package/templates/guess-number/index.html +71 -0
  24. package/templates/guess-number/script.js +216 -0
  25. package/templates/guess-number/style.css +337 -0
  26. package/templates/memory-game/index.html +50 -0
  27. package/templates/memory-game/script.js +216 -0
  28. package/templates/memory-game/style.css +288 -0
  29. package/templates/pong/index.html +90 -0
  30. package/templates/pong/script.js +364 -0
  31. package/templates/pong/style.css +371 -0
  32. package/templates/rock-paper-scissors/index.html +84 -0
  33. package/templates/rock-paper-scissors/script.js +199 -0
  34. package/templates/rock-paper-scissors/style.css +295 -0
  35. package/templates/simon-says/index.html +64 -0
  36. package/templates/simon-says/script.js +206 -0
  37. package/templates/simon-says/style.css +250 -0
  38. package/templates/slot-machine/index.html +112 -0
  39. package/templates/slot-machine/script.js +238 -0
  40. package/templates/slot-machine/style.css +464 -0
  41. package/templates/snake-game/index.html +61 -0
  42. package/templates/snake-game/script.js +360 -0
  43. package/templates/snake-game/style.css +246 -0
  44. package/templates/tetris/index.html +84 -0
  45. package/templates/tetris/script.js +447 -0
  46. package/templates/tetris/style.css +286 -0
  47. package/templates/tic-tac-toe/index.html +57 -0
  48. package/templates/tic-tac-toe/script.js +156 -0
  49. package/templates/tic-tac-toe/style.css +244 -0
  50. package/templates/whack-a-mole/index.html +85 -0
  51. package/templates/whack-a-mole/script.js +172 -0
  52. package/templates/whack-a-mole/style.css +263 -0
  53. package/COMPONENTS-GALLERY.html +0 -773
  54. package/PUBLISH-GUIDE.md +0 -112
  55. package/create-template-html-css-1.8.0.tgz +0 -0
@@ -0,0 +1,244 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
9
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
10
+ min-height: 100vh;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ padding: 20px;
15
+ }
16
+
17
+ .container {
18
+ width: 100%;
19
+ max-width: 500px;
20
+ }
21
+
22
+ .game-card {
23
+ background: white;
24
+ border-radius: 16px;
25
+ padding: 30px;
26
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
27
+ }
28
+
29
+ .game-card h1 {
30
+ text-align: center;
31
+ color: #333;
32
+ margin-bottom: 20px;
33
+ font-size: 2.5rem;
34
+ }
35
+
36
+ .game-info {
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ .current-player {
41
+ text-align: center;
42
+ font-size: 1.3rem;
43
+ margin-bottom: 15px;
44
+ font-weight: 600;
45
+ color: #555;
46
+ }
47
+
48
+ .player-x {
49
+ color: #3b82f6;
50
+ font-weight: bold;
51
+ }
52
+
53
+ .player-o {
54
+ color: #ef4444;
55
+ font-weight: bold;
56
+ }
57
+
58
+ .score-board {
59
+ display: flex;
60
+ justify-content: space-around;
61
+ padding: 15px;
62
+ background: #f3f4f6;
63
+ border-radius: 12px;
64
+ margin-bottom: 20px;
65
+ }
66
+
67
+ .score-item {
68
+ text-align: center;
69
+ font-size: 1.1rem;
70
+ }
71
+
72
+ .score-item span:last-child {
73
+ display: block;
74
+ font-size: 1.5rem;
75
+ font-weight: bold;
76
+ margin-top: 5px;
77
+ }
78
+
79
+ .board {
80
+ display: grid;
81
+ grid-template-columns: repeat(3, 1fr);
82
+ gap: 10px;
83
+ margin: 20px 0;
84
+ padding: 10px;
85
+ background: #f9fafb;
86
+ border-radius: 12px;
87
+ }
88
+
89
+ .cell {
90
+ aspect-ratio: 1;
91
+ background: white;
92
+ border: 3px solid #e5e7eb;
93
+ border-radius: 12px;
94
+ font-size: 3rem;
95
+ font-weight: bold;
96
+ display: flex;
97
+ justify-content: center;
98
+ align-items: center;
99
+ cursor: pointer;
100
+ transition: all 0.3s ease;
101
+ }
102
+
103
+ .cell:hover:not(.taken) {
104
+ background: #f3f4f6;
105
+ transform: scale(1.05);
106
+ border-color: #9ca3af;
107
+ }
108
+
109
+ .cell.taken {
110
+ cursor: not-allowed;
111
+ }
112
+
113
+ .cell.player-x {
114
+ color: #3b82f6;
115
+ animation: scaleIn 0.3s ease;
116
+ }
117
+
118
+ .cell.player-o {
119
+ color: #ef4444;
120
+ animation: scaleIn 0.3s ease;
121
+ }
122
+
123
+ .cell.winner {
124
+ background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
125
+ animation: winnerPulse 0.6s ease;
126
+ }
127
+
128
+ @keyframes scaleIn {
129
+ 0% {
130
+ transform: scale(0);
131
+ }
132
+ 50% {
133
+ transform: scale(1.2);
134
+ }
135
+ 100% {
136
+ transform: scale(1);
137
+ }
138
+ }
139
+
140
+ @keyframes winnerPulse {
141
+ 0%, 100% {
142
+ transform: scale(1);
143
+ }
144
+ 50% {
145
+ transform: scale(1.1);
146
+ }
147
+ }
148
+
149
+ .message {
150
+ text-align: center;
151
+ font-size: 1.3rem;
152
+ font-weight: bold;
153
+ height: 40px;
154
+ display: flex;
155
+ justify-content: center;
156
+ align-items: center;
157
+ margin-bottom: 20px;
158
+ opacity: 0;
159
+ transition: opacity 0.3s ease;
160
+ }
161
+
162
+ .message.show {
163
+ opacity: 1;
164
+ animation: slideDown 0.4s ease;
165
+ }
166
+
167
+ .message.win-x {
168
+ color: #3b82f6;
169
+ }
170
+
171
+ .message.win-o {
172
+ color: #ef4444;
173
+ }
174
+
175
+ .message.draw {
176
+ color: #8b5cf6;
177
+ }
178
+
179
+ @keyframes slideDown {
180
+ from {
181
+ transform: translateY(-20px);
182
+ opacity: 0;
183
+ }
184
+ to {
185
+ transform: translateY(0);
186
+ opacity: 1;
187
+ }
188
+ }
189
+
190
+ .button-group {
191
+ display: flex;
192
+ gap: 10px;
193
+ justify-content: center;
194
+ }
195
+
196
+ .btn {
197
+ flex: 1;
198
+ padding: 12px 24px;
199
+ border: none;
200
+ border-radius: 8px;
201
+ font-size: 1rem;
202
+ font-weight: 600;
203
+ cursor: pointer;
204
+ transition: all 0.3s ease;
205
+ }
206
+
207
+ .btn-primary {
208
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
209
+ color: white;
210
+ }
211
+
212
+ .btn-primary:hover {
213
+ transform: translateY(-2px);
214
+ box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
215
+ }
216
+
217
+ .btn-secondary {
218
+ background: #6b7280;
219
+ color: white;
220
+ }
221
+
222
+ .btn-secondary:hover {
223
+ background: #4b5563;
224
+ transform: translateY(-2px);
225
+ box-shadow: 0 5px 15px rgba(107, 114, 128, 0.4);
226
+ }
227
+
228
+ @media (max-width: 480px) {
229
+ .game-card {
230
+ padding: 20px;
231
+ }
232
+
233
+ .game-card h1 {
234
+ font-size: 2rem;
235
+ }
236
+
237
+ .cell {
238
+ font-size: 2rem;
239
+ }
240
+
241
+ .button-group {
242
+ flex-direction: column;
243
+ }
244
+ }
@@ -0,0 +1,85 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{name}} - Whack-a-Mole</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <div class="game-card">
12
+ <h1>🔨 Whack-a-Mole</h1>
13
+
14
+ <div class="game-stats">
15
+ <div class="stat">
16
+ <div class="stat-label">Score</div>
17
+ <div id="score" class="stat-value">0</div>
18
+ </div>
19
+ <div class="stat">
20
+ <div class="stat-label">Time</div>
21
+ <div id="timer" class="stat-value">30</div>
22
+ </div>
23
+ <div class="stat">
24
+ <div class="stat-label">High Score</div>
25
+ <div id="highScore" class="stat-value">0</div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="difficulty-selector">
30
+ <label>Difficulty:</label>
31
+ <select id="difficulty">
32
+ <option value="easy">Easy</option>
33
+ <option value="medium" selected>Medium</option>
34
+ <option value="hard">Hard</option>
35
+ </select>
36
+ </div>
37
+
38
+ <div class="game-board" id="gameBoard">
39
+ <div class="hole" data-hole="0">
40
+ <div class="mole">🐹</div>
41
+ </div>
42
+ <div class="hole" data-hole="1">
43
+ <div class="mole">🐹</div>
44
+ </div>
45
+ <div class="hole" data-hole="2">
46
+ <div class="mole">🐹</div>
47
+ </div>
48
+ <div class="hole" data-hole="3">
49
+ <div class="mole">🐹</div>
50
+ </div>
51
+ <div class="hole" data-hole="4">
52
+ <div class="mole">🐹</div>
53
+ </div>
54
+ <div class="hole" data-hole="5">
55
+ <div class="mole">🐹</div>
56
+ </div>
57
+ <div class="hole" data-hole="6">
58
+ <div class="mole">🐹</div>
59
+ </div>
60
+ <div class="hole" data-hole="7">
61
+ <div class="mole">🐹</div>
62
+ </div>
63
+ <div class="hole" data-hole="8">
64
+ <div class="mole">🐹</div>
65
+ </div>
66
+ </div>
67
+
68
+ <div class="message" id="message"></div>
69
+
70
+ <div class="button-group">
71
+ <button id="startBtn" class="btn btn-success">Start Game</button>
72
+ <button id="pauseBtn" class="btn btn-warning" disabled>Pause</button>
73
+ </div>
74
+
75
+ <div class="instructions">
76
+ <h3>How to Play:</h3>
77
+ <p>🔨 Click on the moles as they pop up!</p>
78
+ <p>⏱️ You have 30 seconds to score as many points as possible</p>
79
+ <p>🎯 Each hit = +1 point</p>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <script src="script.js"></script>
84
+ </body>
85
+ </html>
@@ -0,0 +1,172 @@
1
+ // Whack-a-Mole Game Logic
2
+
3
+ const holes = document.querySelectorAll('.hole');
4
+ const moles = document.querySelectorAll('.mole');
5
+ const scoreDisplay = document.getElementById('score');
6
+ const timerDisplay = document.getElementById('timer');
7
+ const highScoreDisplay = document.getElementById('highScore');
8
+ const startBtn = document.getElementById('startBtn');
9
+ const pauseBtn = document.getElementById('pauseBtn');
10
+ const messageDisplay = document.getElementById('message');
11
+ const difficultySelect = document.getElementById('difficulty');
12
+
13
+ let score = 0;
14
+ let timeLeft = 30;
15
+ let highScore = localStorage.getItem('whackHighScore') || 0;
16
+ let gameInterval = null;
17
+ let moleInterval = null;
18
+ let isPaused = false;
19
+ let isGameActive = false;
20
+
21
+ // Difficulty settings
22
+ const difficulties = {
23
+ easy: { minTime: 800, maxTime: 1500 },
24
+ medium: { minTime: 500, maxTime: 1200 },
25
+ hard: { minTime: 300, maxTime: 800 }
26
+ };
27
+
28
+ // Initialize
29
+ highScoreDisplay.textContent = highScore;
30
+
31
+ // Start game
32
+ function startGame() {
33
+ score = 0;
34
+ timeLeft = 30;
35
+ isPaused = false;
36
+ isGameActive = true;
37
+
38
+ scoreDisplay.textContent = score;
39
+ timerDisplay.textContent = timeLeft;
40
+ messageDisplay.textContent = '';
41
+
42
+ startBtn.disabled = true;
43
+ pauseBtn.disabled = false;
44
+ difficultySelect.disabled = true;
45
+
46
+ // Hide all moles
47
+ moles.forEach(mole => mole.classList.remove('up', 'whacked'));
48
+
49
+ // Start timer
50
+ gameInterval = setInterval(() => {
51
+ if (!isPaused) {
52
+ timeLeft--;
53
+ timerDisplay.textContent = timeLeft;
54
+
55
+ if (timeLeft <= 0) {
56
+ endGame();
57
+ }
58
+ }
59
+ }, 1000);
60
+
61
+ // Start spawning moles
62
+ spawnMole();
63
+ }
64
+
65
+ // Spawn mole
66
+ function spawnMole() {
67
+ if (!isGameActive) return;
68
+
69
+ const difficulty = difficultySelect.value;
70
+ const { minTime, maxTime } = difficulties[difficulty];
71
+
72
+ // Random hole
73
+ const randomHole = Math.floor(Math.random() * holes.length);
74
+ const mole = moles[randomHole];
75
+
76
+ // Check if already up
77
+ if (mole.classList.contains('up')) {
78
+ spawnMole();
79
+ return;
80
+ }
81
+
82
+ // Show mole
83
+ mole.classList.add('up');
84
+
85
+ // Random time to stay up
86
+ const upTime = Math.random() * (maxTime - minTime) + minTime;
87
+
88
+ setTimeout(() => {
89
+ if (mole.classList.contains('up') && !mole.classList.contains('whacked')) {
90
+ mole.classList.remove('up');
91
+ }
92
+
93
+ // Spawn next mole
94
+ if (isGameActive && !isPaused) {
95
+ const spawnDelay = Math.random() * 300 + 200;
96
+ setTimeout(spawnMole, spawnDelay);
97
+ }
98
+ }, upTime);
99
+ }
100
+
101
+ // Whack mole
102
+ function whack(e) {
103
+ if (!isGameActive || isPaused) return;
104
+
105
+ const mole = e.target;
106
+
107
+ if (mole.classList.contains('up') && !mole.classList.contains('whacked')) {
108
+ mole.classList.add('whacked');
109
+ score++;
110
+ scoreDisplay.textContent = score;
111
+
112
+ // Shake animation
113
+ mole.style.animation = 'shake 0.3s';
114
+
115
+ setTimeout(() => {
116
+ mole.classList.remove('up', 'whacked');
117
+ mole.style.animation = '';
118
+ }, 300);
119
+ }
120
+ }
121
+
122
+ // Pause game
123
+ function pauseGame() {
124
+ isPaused = !isPaused;
125
+
126
+ if (isPaused) {
127
+ pauseBtn.textContent = 'Resume';
128
+ messageDisplay.textContent = 'Game Paused';
129
+ } else {
130
+ pauseBtn.textContent = 'Pause';
131
+ messageDisplay.textContent = '';
132
+ spawnMole();
133
+ }
134
+ }
135
+
136
+ // End game
137
+ function endGame() {
138
+ clearInterval(gameInterval);
139
+ isGameActive = false;
140
+
141
+ // Hide all moles
142
+ moles.forEach(mole => mole.classList.remove('up', 'whacked'));
143
+
144
+ startBtn.disabled = false;
145
+ pauseBtn.disabled = true;
146
+ pauseBtn.textContent = 'Pause';
147
+ difficultySelect.disabled = false;
148
+
149
+ // Update high score
150
+ if (score > highScore) {
151
+ highScore = score;
152
+ localStorage.setItem('whackHighScore', highScore);
153
+ highScoreDisplay.textContent = highScore;
154
+ messageDisplay.textContent = `🎉 New High Score: ${score}!`;
155
+ } else {
156
+ messageDisplay.textContent = `Game Over! Final Score: ${score}`;
157
+ }
158
+
159
+ messageDisplay.classList.add('show');
160
+ }
161
+
162
+ // Event listeners
163
+ moles.forEach(mole => mole.addEventListener('click', whack));
164
+ startBtn.addEventListener('click', startGame);
165
+ pauseBtn.addEventListener('click', pauseGame);
166
+
167
+ // Prevent text selection on double click
168
+ document.addEventListener('selectstart', (e) => {
169
+ if (isGameActive) {
170
+ e.preventDefault();
171
+ }
172
+ });