@tsparticles/template-login 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 (68) 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 +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/src/main.ts +1 -1
  61. package/template/vue2/package.json +24 -0
  62. package/template/vue2/src/App.vue +287 -0
  63. package/template/vue3/package.json +19 -0
  64. package/template/vue3/src/App.vue +286 -0
  65. package/template/vue3/src/main.ts +14 -0
  66. package/template/webcomponents/package.json +21 -0
  67. package/template/webcomponents/src/main.ts +125 -0
  68. package/template/webcomponents/src/style.css +151 -0
@@ -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
+ }