@tsparticles/template-login 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 (69) hide show
  1. package/CHANGELOG.md +16 -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 +151 -0
  6. package/template/angular/src/app/app.component.html +32 -0
  7. package/template/angular/src/app/app.component.ts +105 -0
  8. package/template/angular/src/app/app.module.ts +13 -0
  9. package/template/angular-confetti/package.json +36 -0
  10. package/template/angular-confetti/src/app/app.component.css +151 -0
  11. package/template/angular-confetti/src/app/app.component.html +32 -0
  12. package/template/angular-confetti/src/app/app.component.ts +105 -0
  13. package/template/angular-confetti/src/app/app.module.ts +13 -0
  14. package/template/angular-fireworks/package.json +36 -0
  15. package/template/angular-fireworks/src/app/app.component.css +151 -0
  16. package/template/angular-fireworks/src/app/app.component.html +32 -0
  17. package/template/angular-fireworks/src/app/app.component.ts +105 -0
  18. package/template/angular-fireworks/src/app/app.module.ts +13 -0
  19. package/template/astro/package.json +22 -0
  20. package/template/astro/src/pages/index.astro +173 -0
  21. package/template/ember/app/templates/application.hbs +61 -0
  22. package/template/ember/package.json +42 -0
  23. package/template/inferno/package.json +24 -0
  24. package/template/inferno/src/App.css +151 -0
  25. package/template/inferno/src/App.tsx +158 -0
  26. package/template/jquery/package.json +22 -0
  27. package/template/jquery/src/main.ts +110 -0
  28. package/template/jquery/src/style.css +151 -0
  29. package/template/lit/package.json +22 -0
  30. package/template/lit/src/my-app.ts +143 -0
  31. package/template/nextjs/package.json +25 -0
  32. package/template/nextjs/src/app/page.tsx +168 -0
  33. package/template/nextjs/src/app/providers.tsx +13 -0
  34. package/template/nuxt2/package.json +17 -0
  35. package/template/nuxt2/pages/index.vue +303 -0
  36. package/template/nuxt3/app.vue +288 -0
  37. package/template/nuxt3/package.json +21 -0
  38. package/template/nuxt4/app.vue +288 -0
  39. package/template/nuxt4/package.json +21 -0
  40. package/template/preact/package.json +23 -0
  41. package/template/preact/src/App.css +151 -0
  42. package/template/preact/src/App.tsx +140 -0
  43. package/template/qwik/package.json +22 -0
  44. package/template/qwik/src/App.tsx +139 -0
  45. package/template/react/package.json +19 -0
  46. package/template/react/src/App.css +151 -0
  47. package/template/react/src/App.tsx +140 -0
  48. package/template/riot/package.json +24 -0
  49. package/template/riot/src/app.riot +156 -0
  50. package/template/solid/package.json +18 -0
  51. package/template/solid/src/App.tsx +169 -0
  52. package/template/solid/src/index.css +151 -0
  53. package/template/solid/src/main.tsx +9 -0
  54. package/template/stencil/package.json +20 -0
  55. package/template/stencil/src/components/app-home/app-home.tsx +164 -0
  56. package/template/svelte/package.json +20 -0
  57. package/template/svelte/src/App.svelte +325 -0
  58. package/template/svelte/src/main.ts +12 -0
  59. package/template/vanilla/LICENSE +21 -0
  60. package/template/vanilla/package.json +1 -1
  61. package/template/vanilla/src/main.ts +1 -1
  62. package/template/vue2/package.json +24 -0
  63. package/template/vue2/src/App.vue +287 -0
  64. package/template/vue3/package.json +19 -0
  65. package/template/vue3/src/App.vue +286 -0
  66. package/template/vue3/src/main.ts +14 -0
  67. package/template/webcomponents/package.json +21 -0
  68. package/template/webcomponents/src/main.ts +125 -0
  69. package/template/webcomponents/src/style.css +151 -0
@@ -0,0 +1,286 @@
1
+ <script setup lang="ts">
2
+ import { ref, onMounted } from "vue";
3
+ import type { ISourceOptions } from "@tsparticles/engine";
4
+
5
+ const isLogin = ref(true);
6
+ const theme = ref(localStorage.getItem("theme") || "dark");
7
+ const email = ref("");
8
+ const password = ref("");
9
+ const confirm = ref("");
10
+ const emailErr = ref("");
11
+ const passErr = ref("");
12
+ const confirmErr = ref("");
13
+
14
+ const options: ISourceOptions = {
15
+ background: { color: { value: "transparent" } },
16
+ fpsLimit: 60,
17
+ particles: {
18
+ number: { value: 60, density: { enable: true } },
19
+ color: { value: ["#6c5ce7", "#a29bfe", "#fd79a8", "#00cec9"] },
20
+ shape: { type: "circle" },
21
+ opacity: { value: 0.5, random: true },
22
+ size: { value: { min: 1, max: 3 }, random: true },
23
+ move: { enable: true, speed: 1, direction: "none", random: true, straight: false, outModes: { default: "out" } },
24
+ },
25
+ interactivity: {
26
+ events: { onHover: { enable: true, mode: "bubble" } },
27
+ modes: { bubble: { distance: 200, size: 6, duration: 2, opacity: 0.8 } },
28
+ },
29
+ detectRetina: true,
30
+ };
31
+
32
+ onMounted(() => {
33
+ document.documentElement.setAttribute("data-theme", theme.value);
34
+ });
35
+
36
+ function setTheme(t: string) {
37
+ theme.value = t;
38
+ document.documentElement.setAttribute("data-theme", t);
39
+ localStorage.setItem("theme", t);
40
+ }
41
+
42
+ function toggleTheme() {
43
+ setTheme(theme.value === "dark" ? "light" : "dark");
44
+ }
45
+
46
+ function validateEmail(val: string): boolean {
47
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val);
48
+ }
49
+
50
+ function handleSubmit(e: Event) {
51
+ e.preventDefault();
52
+ let valid = true;
53
+
54
+ if (!email.value || !validateEmail(email.value)) {
55
+ emailErr.value = "Please enter a valid email address";
56
+ valid = false;
57
+ } else {
58
+ emailErr.value = "";
59
+ }
60
+
61
+ if (!password.value || password.value.length < 6) {
62
+ passErr.value = "Password must be at least 6 characters";
63
+ valid = false;
64
+ } else {
65
+ passErr.value = "";
66
+ }
67
+
68
+ if (!isLogin.value) {
69
+ if (password.value !== confirm.value) {
70
+ confirmErr.value = "Passwords do not match";
71
+ valid = false;
72
+ } else {
73
+ confirmErr.value = "";
74
+ }
75
+ }
76
+
77
+ if (!valid) return;
78
+
79
+ if (isLogin.value) {
80
+ alert("Logged in successfully! (demo)");
81
+ } else {
82
+ alert("Account created successfully! (demo)");
83
+ isLogin.value = true;
84
+ }
85
+
86
+ email.value = "";
87
+ password.value = "";
88
+ confirm.value = "";
89
+ }
90
+
91
+ function toggleMode(e: MouseEvent) {
92
+ e.preventDefault();
93
+ isLogin.value = !isLogin.value;
94
+ emailErr.value = "";
95
+ passErr.value = "";
96
+ confirmErr.value = "";
97
+ }
98
+ </script>
99
+
100
+ <template>
101
+ <vue-particles id="tsparticles" :options="options" />
102
+ <div class="auth-container">
103
+ <div class="auth-card">
104
+ <div class="auth-header">
105
+ <h1>{{ isLogin ? 'Login' : 'Register' }}</h1>
106
+ <button class="theme-btn" @click="toggleTheme" aria-label="Toggle theme">{{ theme === 'dark' ? '🌙' : '☀️' }}</button>
107
+ </div>
108
+ <form @submit="handleSubmit" novalidate>
109
+ <div class="form-group">
110
+ <label for="email">Email</label>
111
+ <input id="email" v-model="email" type="email" placeholder="you@example.com" required />
112
+ <span class="error">{{ emailErr }}</span>
113
+ </div>
114
+ <div class="form-group">
115
+ <label for="password">Password</label>
116
+ <input id="password" v-model="password" type="password" placeholder="Enter password" required />
117
+ <span class="error">{{ passErr }}</span>
118
+ </div>
119
+ <div v-if="!isLogin" class="form-group">
120
+ <label for="confirmPassword">Confirm Password</label>
121
+ <input id="confirmPassword" v-model="confirm" type="password" placeholder="Confirm password" />
122
+ <span class="error">{{ confirmErr }}</span>
123
+ </div>
124
+ <button type="submit">{{ isLogin ? 'Sign In' : 'Create Account' }}</button>
125
+ </form>
126
+ <p class="toggle-text">
127
+ <span>{{ isLogin ? "Don't have an account?" : 'Already have an account?' }}</span>
128
+ <a href="#" @click="toggleMode">{{ isLogin ? 'Register' : 'Login' }}</a>
129
+ </p>
130
+ </div>
131
+ </div>
132
+ </template>
133
+
134
+ <style>
135
+ :root {
136
+ --bg: #0f0f1a;
137
+ --card-bg: rgba(255, 255, 255, 0.05);
138
+ --text: #fff;
139
+ --border: rgba(255, 255, 255, 0.1);
140
+ --input-bg: rgba(255, 255, 255, 0.08);
141
+ --accent: #6c5ce7;
142
+ --accent-hover: #a29bfe;
143
+ --error: #e74c3c;
144
+ }
145
+
146
+ [data-theme="light"] {
147
+ --bg: #f0f0f5;
148
+ --card-bg: rgba(255, 255, 255, 0.8);
149
+ --text: #1a1a2e;
150
+ --border: rgba(0, 0, 0, 0.1);
151
+ --input-bg: rgba(0, 0, 0, 0.05);
152
+ }
153
+
154
+ * {
155
+ box-sizing: border-box;
156
+ }
157
+
158
+ body {
159
+ margin: 0;
160
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
161
+ background: var(--bg);
162
+ color: var(--text);
163
+ transition: background 0.3s, color 0.3s;
164
+ }
165
+
166
+ .auth-container {
167
+ position: absolute;
168
+ top: 50%;
169
+ left: 50%;
170
+ transform: translate(-50%, -50%);
171
+ z-index: 10;
172
+ width: 100%;
173
+ max-width: 400px;
174
+ padding: 1rem;
175
+ }
176
+
177
+ .auth-card {
178
+ background: var(--card-bg);
179
+ backdrop-filter: blur(10px);
180
+ border: 1px solid var(--border);
181
+ border-radius: 16px;
182
+ padding: 2rem;
183
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
184
+ }
185
+
186
+ .auth-header {
187
+ display: flex;
188
+ justify-content: space-between;
189
+ align-items: center;
190
+ margin-bottom: 1.5rem;
191
+ }
192
+
193
+ .auth-header h1 {
194
+ margin: 0;
195
+ font-size: 1.8em;
196
+ }
197
+
198
+ .theme-btn {
199
+ background: none;
200
+ border: 1px solid var(--border);
201
+ border-radius: 8px;
202
+ padding: 0.4em 0.6em;
203
+ font-size: 1.2em;
204
+ cursor: pointer;
205
+ transition: background 0.2s;
206
+ }
207
+
208
+ .theme-btn:hover {
209
+ background: var(--input-bg);
210
+ }
211
+
212
+ .form-group {
213
+ margin-bottom: 1rem;
214
+ }
215
+
216
+ label {
217
+ display: block;
218
+ margin-bottom: 0.3em;
219
+ font-size: 0.9em;
220
+ opacity: 0.8;
221
+ }
222
+
223
+ input {
224
+ width: 100%;
225
+ padding: 0.7em 1em;
226
+ font-size: 1em;
227
+ border: 1px solid var(--border);
228
+ border-radius: 8px;
229
+ background: var(--input-bg);
230
+ color: var(--text);
231
+ outline: none;
232
+ transition: border-color 0.2s;
233
+ }
234
+
235
+ input:focus {
236
+ border-color: var(--accent);
237
+ }
238
+
239
+ input::placeholder {
240
+ color: var(--text);
241
+ opacity: 0.4;
242
+ }
243
+
244
+ .error {
245
+ display: block;
246
+ margin-top: 0.3em;
247
+ font-size: 0.8em;
248
+ color: var(--error);
249
+ min-height: 1em;
250
+ }
251
+
252
+ button[type="submit"] {
253
+ width: 100%;
254
+ padding: 0.8em;
255
+ font-size: 1em;
256
+ font-weight: 600;
257
+ border: none;
258
+ border-radius: 8px;
259
+ background: var(--accent);
260
+ color: #fff;
261
+ cursor: pointer;
262
+ transition: background 0.2s;
263
+ margin-top: 0.5rem;
264
+ }
265
+
266
+ button[type="submit"]:hover {
267
+ background: var(--accent-hover);
268
+ }
269
+
270
+ .toggle-text {
271
+ text-align: center;
272
+ margin-top: 1.5rem;
273
+ font-size: 0.9em;
274
+ opacity: 0.7;
275
+ }
276
+
277
+ .toggle-text a {
278
+ color: var(--accent);
279
+ text-decoration: none;
280
+ margin-left: 0.3em;
281
+ }
282
+
283
+ .toggle-text a:hover {
284
+ text-decoration: underline;
285
+ }
286
+ </style>
@@ -0,0 +1,14 @@
1
+ import { createApp } from "vue";
2
+ import Particles from "@tsparticles/vue3";
3
+ import { loadSlim } from "@tsparticles/slim";
4
+ import App from "./App.vue";
5
+
6
+ const app = createApp(App);
7
+
8
+ app.use(Particles, {
9
+ init: async (engine) => {
10
+ await loadSlim(engine);
11
+ },
12
+ });
13
+
14
+ app.mount("#app");
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "{{packageName}}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@tsparticles/webcomponents": "^4.1.3",
13
+ "@tsparticles/slim": "^4.1.3",
14
+ "@tsparticles/configs": "^4.1.3",
15
+ "@tsparticles/engine": "^4.1.3"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.2",
19
+ "vite": "^6.0.0"
20
+ }
21
+ }
@@ -0,0 +1,125 @@
1
+ import { defineParticlesElement, initParticlesEngine } from "@tsparticles/webcomponents";
2
+ import { loadSlim } from "@tsparticles/slim";
3
+ import type { ISourceOptions } from "@tsparticles/engine";
4
+ import "./style.css";
5
+
6
+ void initParticlesEngine(async (engine) => {
7
+ await loadSlim(engine);
8
+ });
9
+
10
+ defineParticlesElement();
11
+
12
+ const options: ISourceOptions = {
13
+ background: { color: { value: "transparent" } },
14
+ fpsLimit: 60,
15
+ particles: {
16
+ number: { value: 60, density: { enable: true } },
17
+ color: { value: ["#6c5ce7", "#a29bfe", "#fd79a8", "#00cec9"] },
18
+ shape: { type: "circle" },
19
+ opacity: { value: 0.5, random: true },
20
+ size: { value: { min: 1, max: 3 }, random: true },
21
+ move: { enable: true, speed: 1, direction: "none", random: true, straight: false, outModes: { default: "out" } },
22
+ },
23
+ interactivity: {
24
+ events: { onHover: { enable: true, mode: "bubble" } },
25
+ modes: { bubble: { distance: 200, size: 6, duration: 2, opacity: 0.8 } },
26
+ },
27
+ detectRetina: true,
28
+ };
29
+
30
+ let isLogin = true;
31
+
32
+ const authTitle = document.getElementById("authTitle") as HTMLHeadingElement;
33
+ const authForm = document.getElementById("authForm") as HTMLFormElement;
34
+ const submitBtn = document.getElementById("submitBtn") as HTMLButtonElement;
35
+ const toggleAuth = document.getElementById("toggleAuth") as HTMLAnchorElement;
36
+ const toggleLabel = document.getElementById("toggleLabel") as HTMLSpanElement;
37
+ const confirmGroup = document.getElementById("confirmGroup") as HTMLDivElement;
38
+ const themeBtn = document.getElementById("themeToggle") as HTMLButtonElement;
39
+
40
+ const emailInput = document.getElementById("email") as HTMLInputElement;
41
+ const passwordInput = document.getElementById("password") as HTMLInputElement;
42
+ const confirmInput = document.getElementById("confirmPassword") as HTMLInputElement;
43
+
44
+ const emailError = document.getElementById("emailError") as HTMLSpanElement;
45
+ const passwordError = document.getElementById("passwordError") as HTMLSpanElement;
46
+ const confirmError = document.getElementById("confirmError") as HTMLSpanElement;
47
+
48
+ function setTheme(theme: string): void {
49
+ document.documentElement.setAttribute("data-theme", theme);
50
+ themeBtn.textContent = theme === "dark" ? "🌙" : "☀️";
51
+ localStorage.setItem("theme", theme);
52
+ }
53
+
54
+ const savedTheme = localStorage.getItem("theme") || "dark";
55
+ setTheme(savedTheme);
56
+
57
+ themeBtn.addEventListener("click", () => {
58
+ const current = document.documentElement.getAttribute("data-theme") || "dark";
59
+ setTheme(current === "dark" ? "light" : "dark");
60
+ });
61
+
62
+ function validateEmail(val: string): boolean {
63
+ return /^[^\s@]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/.test(val);
64
+ }
65
+
66
+ function validate(): boolean {
67
+ let valid = true;
68
+
69
+ if (!emailInput.value || !validateEmail(emailInput.value)) {
70
+ emailError.textContent = "Please enter a valid email address";
71
+ valid = false;
72
+ } else {
73
+ emailError.textContent = "";
74
+ }
75
+
76
+ if (!passwordInput.value || passwordInput.value.length < 6) {
77
+ passwordError.textContent = "Password must be at least 6 characters";
78
+ valid = false;
79
+ } else {
80
+ passwordError.textContent = "";
81
+ }
82
+
83
+ if (!isLogin) {
84
+ if (passwordInput.value !== confirmInput.value) {
85
+ confirmError.textContent = "Passwords do not match";
86
+ valid = false;
87
+ } else {
88
+ confirmError.textContent = "";
89
+ }
90
+ }
91
+
92
+ return valid;
93
+ }
94
+
95
+ function toggleMode(): void {
96
+ isLogin = !isLogin;
97
+ authTitle.textContent = isLogin ? "Login" : "Register";
98
+ submitBtn.textContent = isLogin ? "Sign In" : "Create Account";
99
+ toggleLabel.textContent = isLogin ? "Don't have an account?" : "Already have an account?";
100
+ toggleAuth.textContent = isLogin ? "Register" : "Login";
101
+ confirmGroup.style.display = isLogin ? "none" : "block";
102
+ emailError.textContent = "";
103
+ passwordError.textContent = "";
104
+ confirmError.textContent = "";
105
+ }
106
+
107
+ toggleAuth.addEventListener("click", (e) => {
108
+ e.preventDefault();
109
+ toggleMode();
110
+ });
111
+
112
+ authForm.addEventListener("submit", (e) => {
113
+ e.preventDefault();
114
+
115
+ if (!validate()) return;
116
+
117
+ if (isLogin) {
118
+ alert("Logged in successfully! (demo)");
119
+ } else {
120
+ alert("Account created successfully! (demo)");
121
+ toggleMode();
122
+ }
123
+
124
+ authForm.reset();
125
+ });
@@ -0,0 +1,151 @@
1
+ :root {
2
+ --bg: #0f0f1a;
3
+ --card-bg: rgba(255, 255, 255, 0.05);
4
+ --text: #fff;
5
+ --border: rgba(255, 255, 255, 0.1);
6
+ --input-bg: rgba(255, 255, 255, 0.08);
7
+ --accent: #6c5ce7;
8
+ --accent-hover: #a29bfe;
9
+ --error: #e74c3c;
10
+ }
11
+
12
+ [data-theme="light"] {
13
+ --bg: #f0f0f5;
14
+ --card-bg: rgba(255, 255, 255, 0.8);
15
+ --text: #1a1a2e;
16
+ --border: rgba(0, 0, 0, 0.1);
17
+ --input-bg: rgba(0, 0, 0, 0.05);
18
+ }
19
+
20
+ * {
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ body {
25
+ margin: 0;
26
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
27
+ background: var(--bg);
28
+ color: var(--text);
29
+ transition: background 0.3s, color 0.3s;
30
+ }
31
+
32
+ .auth-container {
33
+ position: absolute;
34
+ top: 50%;
35
+ left: 50%;
36
+ transform: translate(-50%, -50%);
37
+ z-index: 10;
38
+ width: 100%;
39
+ max-width: 400px;
40
+ padding: 1rem;
41
+ }
42
+
43
+ .auth-card {
44
+ background: var(--card-bg);
45
+ backdrop-filter: blur(10px);
46
+ border: 1px solid var(--border);
47
+ border-radius: 16px;
48
+ padding: 2rem;
49
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
50
+ }
51
+
52
+ .auth-header {
53
+ display: flex;
54
+ justify-content: space-between;
55
+ align-items: center;
56
+ margin-bottom: 1.5rem;
57
+ }
58
+
59
+ .auth-header h1 {
60
+ margin: 0;
61
+ font-size: 1.8em;
62
+ }
63
+
64
+ .theme-btn {
65
+ background: none;
66
+ border: 1px solid var(--border);
67
+ border-radius: 8px;
68
+ padding: 0.4em 0.6em;
69
+ font-size: 1.2em;
70
+ cursor: pointer;
71
+ transition: background 0.2s;
72
+ }
73
+
74
+ .theme-btn:hover {
75
+ background: var(--input-bg);
76
+ }
77
+
78
+ .form-group {
79
+ margin-bottom: 1rem;
80
+ }
81
+
82
+ label {
83
+ display: block;
84
+ margin-bottom: 0.3em;
85
+ font-size: 0.9em;
86
+ opacity: 0.8;
87
+ }
88
+
89
+ input {
90
+ width: 100%;
91
+ padding: 0.7em 1em;
92
+ font-size: 1em;
93
+ border: 1px solid var(--border);
94
+ border-radius: 8px;
95
+ background: var(--input-bg);
96
+ color: var(--text);
97
+ outline: none;
98
+ transition: border-color 0.2s;
99
+ }
100
+
101
+ input:focus {
102
+ border-color: var(--accent);
103
+ }
104
+
105
+ input::placeholder {
106
+ color: var(--text);
107
+ opacity: 0.4;
108
+ }
109
+
110
+ .error {
111
+ display: block;
112
+ margin-top: 0.3em;
113
+ font-size: 0.8em;
114
+ color: var(--error);
115
+ min-height: 1em;
116
+ }
117
+
118
+ button[type="submit"] {
119
+ width: 100%;
120
+ padding: 0.8em;
121
+ font-size: 1em;
122
+ font-weight: 600;
123
+ border: none;
124
+ border-radius: 8px;
125
+ background: var(--accent);
126
+ color: #fff;
127
+ cursor: pointer;
128
+ transition: background 0.2s;
129
+ margin-top: 0.5rem;
130
+ }
131
+
132
+ button[type="submit"]:hover {
133
+ background: var(--accent-hover);
134
+ }
135
+
136
+ .toggle-text {
137
+ text-align: center;
138
+ margin-top: 1.5rem;
139
+ font-size: 0.9em;
140
+ opacity: 0.7;
141
+ }
142
+
143
+ .toggle-text a {
144
+ color: var(--accent);
145
+ text-decoration: none;
146
+ margin-left: 0.3em;
147
+ }
148
+
149
+ .toggle-text a:hover {
150
+ text-decoration: underline;
151
+ }