@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.
- package/CHANGELOG.md +10 -0
- package/README.md +3 -0
- package/package.json +4 -3
- package/template/angular/package.json +34 -0
- package/template/angular/src/app/app.component.css +151 -0
- package/template/angular/src/app/app.component.html +32 -0
- package/template/angular/src/app/app.component.ts +105 -0
- package/template/angular/src/app/app.module.ts +13 -0
- package/template/angular-confetti/package.json +36 -0
- package/template/angular-confetti/src/app/app.component.css +151 -0
- package/template/angular-confetti/src/app/app.component.html +32 -0
- package/template/angular-confetti/src/app/app.component.ts +105 -0
- package/template/angular-confetti/src/app/app.module.ts +13 -0
- package/template/angular-fireworks/package.json +36 -0
- package/template/angular-fireworks/src/app/app.component.css +151 -0
- package/template/angular-fireworks/src/app/app.component.html +32 -0
- package/template/angular-fireworks/src/app/app.component.ts +105 -0
- package/template/angular-fireworks/src/app/app.module.ts +13 -0
- package/template/astro/package.json +22 -0
- package/template/astro/src/pages/index.astro +173 -0
- package/template/ember/app/templates/application.hbs +61 -0
- package/template/ember/package.json +42 -0
- package/template/inferno/package.json +24 -0
- package/template/inferno/src/App.css +151 -0
- package/template/inferno/src/App.tsx +158 -0
- package/template/jquery/package.json +22 -0
- package/template/jquery/src/main.ts +110 -0
- package/template/jquery/src/style.css +151 -0
- package/template/lit/package.json +22 -0
- package/template/lit/src/my-app.ts +143 -0
- package/template/nextjs/package.json +25 -0
- package/template/nextjs/src/app/page.tsx +168 -0
- package/template/nextjs/src/app/providers.tsx +13 -0
- package/template/nuxt2/package.json +17 -0
- package/template/nuxt2/pages/index.vue +303 -0
- package/template/nuxt3/app.vue +288 -0
- package/template/nuxt3/package.json +21 -0
- package/template/nuxt4/app.vue +288 -0
- package/template/nuxt4/package.json +21 -0
- package/template/preact/package.json +23 -0
- package/template/preact/src/App.css +151 -0
- package/template/preact/src/App.tsx +140 -0
- package/template/qwik/package.json +22 -0
- package/template/qwik/src/App.tsx +139 -0
- package/template/react/package.json +19 -0
- package/template/react/src/App.css +151 -0
- package/template/react/src/App.tsx +140 -0
- package/template/riot/package.json +24 -0
- package/template/riot/src/app.riot +156 -0
- package/template/solid/package.json +18 -0
- package/template/solid/src/App.tsx +169 -0
- package/template/solid/src/index.css +151 -0
- package/template/solid/src/main.tsx +9 -0
- package/template/stencil/package.json +20 -0
- package/template/stencil/src/components/app-home/app-home.tsx +164 -0
- package/template/svelte/package.json +20 -0
- package/template/svelte/src/App.svelte +325 -0
- package/template/svelte/src/main.ts +12 -0
- package/template/vanilla/LICENSE +21 -0
- package/template/vanilla/src/main.ts +1 -1
- package/template/vue2/package.json +24 -0
- package/template/vue2/src/App.vue +287 -0
- package/template/vue3/package.json +19 -0
- package/template/vue3/src/App.vue +286 -0
- package/template/vue3/src/main.ts +14 -0
- package/template/webcomponents/package.json +21 -0
- package/template/webcomponents/src/main.ts +125 -0
- package/template/webcomponents/src/style.css +151 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core";
|
|
2
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
3
|
+
import { FormsModule } from "@angular/forms";
|
|
4
|
+
import { NgxConfettiModule } from "angular-confetti";
|
|
5
|
+
import { AppComponent } from "./app.component";
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
declarations: [AppComponent],
|
|
9
|
+
imports: [BrowserModule, FormsModule, NgxConfettiModule],
|
|
10
|
+
providers: [],
|
|
11
|
+
bootstrap: [AppComponent],
|
|
12
|
+
})
|
|
13
|
+
export class AppModule {}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
"angular-fireworks": "^4.1.3",
|
|
23
|
+
"@tsparticles/slim": "^4.1.3",
|
|
24
|
+
"@tsparticles/configs": "^4.1.3",
|
|
25
|
+
"@tsparticles/engine": "^4.1.3",
|
|
26
|
+
"rxjs": "~7.8.2",
|
|
27
|
+
"tslib": "^2.8.1",
|
|
28
|
+
"zone.js": "~0.16.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@angular-devkit/build-angular": "~22.0.0",
|
|
32
|
+
"@angular/cli": "~22.0.0",
|
|
33
|
+
"@angular/compiler-cli": "~22.0.0",
|
|
34
|
+
"typescript": "~6.0.3"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<ngx-fireworks id="tsparticles" [options]="options" />
|
|
2
|
+
|
|
3
|
+
<div class="auth-container">
|
|
4
|
+
<div class="auth-card">
|
|
5
|
+
<div class="auth-header">
|
|
6
|
+
<h1>{{ isLogin ? 'Login' : 'Register' }}</h1>
|
|
7
|
+
<button class="theme-btn" (click)="toggleTheme()" aria-label="Toggle theme">{{ theme === 'dark' ? '🌙' : '☀️' }}</button>
|
|
8
|
+
</div>
|
|
9
|
+
<form (ngSubmit)="onSubmit()" novalidate>
|
|
10
|
+
<div class="form-group">
|
|
11
|
+
<label for="email">Email</label>
|
|
12
|
+
<input id="email" type="email" [(ngModel)]="email" name="email" placeholder="you@example.com" required />
|
|
13
|
+
<span class="error">{{ emailErr }}</span>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="form-group">
|
|
16
|
+
<label for="password">Password</label>
|
|
17
|
+
<input id="password" type="password" [(ngModel)]="password" name="password" placeholder="Enter password" required />
|
|
18
|
+
<span class="error">{{ passErr }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="form-group" *ngIf="!isLogin">
|
|
21
|
+
<label for="confirmPassword">Confirm Password</label>
|
|
22
|
+
<input id="confirmPassword" type="password" [(ngModel)]="confirm" name="confirmPassword" placeholder="Confirm password" />
|
|
23
|
+
<span class="error">{{ confirmErr }}</span>
|
|
24
|
+
</div>
|
|
25
|
+
<button type="submit">{{ isLogin ? 'Sign In' : 'Create Account' }}</button>
|
|
26
|
+
</form>
|
|
27
|
+
<p class="toggle-text">
|
|
28
|
+
<span>{{ isLogin ? "Don't have an account?" : 'Already have an account?' }}</span>
|
|
29
|
+
<a href="#" (click)="toggleMode($event)">{{ isLogin ? 'Register' : 'Login' }}</a>
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Component, OnInit } from "@angular/core";
|
|
2
|
+
import { NgxFireworksService } from "angular-fireworks";
|
|
3
|
+
import { loadSlim } from "@tsparticles/slim";
|
|
4
|
+
import type { ISourceOptions } from "@tsparticles/engine";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: "app-root",
|
|
8
|
+
templateUrl: "./app.component.html",
|
|
9
|
+
styleUrls: ["./app.component.css"],
|
|
10
|
+
})
|
|
11
|
+
export class AppComponent implements OnInit {
|
|
12
|
+
isLogin = true;
|
|
13
|
+
theme = localStorage.getItem("theme") || "dark";
|
|
14
|
+
email = "";
|
|
15
|
+
password = "";
|
|
16
|
+
confirm = "";
|
|
17
|
+
emailErr = "";
|
|
18
|
+
passErr = "";
|
|
19
|
+
confirmErr = "";
|
|
20
|
+
|
|
21
|
+
constructor(private readonly fireworksService: NgxFireworksService) {}
|
|
22
|
+
|
|
23
|
+
options: ISourceOptions = {
|
|
24
|
+
background: { color: { value: "transparent" } },
|
|
25
|
+
fpsLimit: 60,
|
|
26
|
+
particles: {
|
|
27
|
+
number: { value: 60, density: { enable: true } },
|
|
28
|
+
color: { value: ["#6c5ce7", "#a29bfe", "#fd79a8", "#00cec9"] },
|
|
29
|
+
shape: { type: "circle" },
|
|
30
|
+
opacity: { value: 0.5, random: true },
|
|
31
|
+
size: { value: { min: 1, max: 3 }, random: true },
|
|
32
|
+
move: { enable: true, speed: 1, direction: "none", random: true, straight: false, outModes: { default: "out" } },
|
|
33
|
+
},
|
|
34
|
+
interactivity: {
|
|
35
|
+
events: { onHover: { enable: true, mode: "bubble" } },
|
|
36
|
+
modes: { bubble: { distance: 200, size: 6, duration: 2, opacity: 0.8 } },
|
|
37
|
+
},
|
|
38
|
+
detectRetina: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
ngOnInit(): void {
|
|
42
|
+
document.documentElement.setAttribute("data-theme", this.theme);
|
|
43
|
+
void this.fireworksService.init(async (engine) => {
|
|
44
|
+
await loadSlim(engine);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toggleTheme(): void {
|
|
49
|
+
this.theme = this.theme === "dark" ? "light" : "dark";
|
|
50
|
+
document.documentElement.setAttribute("data-theme", this.theme);
|
|
51
|
+
localStorage.setItem("theme", this.theme);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private validateEmail(val: string): boolean {
|
|
55
|
+
return /^[^\s@]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/.test(val);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
onSubmit(): void {
|
|
59
|
+
let valid = true;
|
|
60
|
+
|
|
61
|
+
if (!this.email || !this.validateEmail(this.email)) {
|
|
62
|
+
this.emailErr = "Please enter a valid email address";
|
|
63
|
+
valid = false;
|
|
64
|
+
} else {
|
|
65
|
+
this.emailErr = "";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!this.password || this.password.length < 6) {
|
|
69
|
+
this.passErr = "Password must be at least 6 characters";
|
|
70
|
+
valid = false;
|
|
71
|
+
} else {
|
|
72
|
+
this.passErr = "";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!this.isLogin) {
|
|
76
|
+
if (this.password !== this.confirm) {
|
|
77
|
+
this.confirmErr = "Passwords do not match";
|
|
78
|
+
valid = false;
|
|
79
|
+
} else {
|
|
80
|
+
this.confirmErr = "";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!valid) return;
|
|
85
|
+
|
|
86
|
+
if (this.isLogin) {
|
|
87
|
+
alert("Logged in successfully! (demo)");
|
|
88
|
+
} else {
|
|
89
|
+
alert("Account created successfully! (demo)");
|
|
90
|
+
this.isLogin = true;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.email = "";
|
|
94
|
+
this.password = "";
|
|
95
|
+
this.confirm = "";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
toggleMode(event: Event): void {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
this.isLogin = !this.isLogin;
|
|
101
|
+
this.emailErr = "";
|
|
102
|
+
this.passErr = "";
|
|
103
|
+
this.confirmErr = "";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgModule } from "@angular/core";
|
|
2
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
3
|
+
import { FormsModule } from "@angular/forms";
|
|
4
|
+
import { NgxFireworksModule } from "angular-fireworks";
|
|
5
|
+
import { AppComponent } from "./app.component";
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
declarations: [AppComponent],
|
|
9
|
+
imports: [BrowserModule, FormsModule, NgxFireworksModule],
|
|
10
|
+
providers: [],
|
|
11
|
+
bootstrap: [AppComponent],
|
|
12
|
+
})
|
|
13
|
+
export class AppModule {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "astro dev",
|
|
8
|
+
"build": "astro build",
|
|
9
|
+
"preview": "astro preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@astrojs/check": "^0.9.4",
|
|
13
|
+
"astro": "^5.7.10",
|
|
14
|
+
"@tsparticles/astro": "^4.1.3",
|
|
15
|
+
"@tsparticles/slim": "^4.1.3",
|
|
16
|
+
"@tsparticles/configs": "^4.1.3",
|
|
17
|
+
"@tsparticles/engine": "^4.1.3"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^6.0.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { initParticlesEngine } from "@tsparticles/astro";
|
|
3
|
+
import { loadSlim } from "@tsparticles/slim";
|
|
4
|
+
|
|
5
|
+
const id = "tsparticles";
|
|
6
|
+
---
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="utf-8" />
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
11
|
+
<title>{{projectName}}</title>
|
|
12
|
+
<style>
|
|
13
|
+
:root { --bg: #0f0f1a; --card-bg: rgba(255, 255, 255, 0.05); --text: #fff; --border: rgba(255, 255, 255, 0.1); --input-bg: rgba(255, 255, 255, 0.08); --accent: #6c5ce7; --accent-hover: #a29bfe; --error: #e74c3c; }
|
|
14
|
+
[data-theme="light"] { --bg: #f0f0f5; --card-bg: rgba(255, 255, 255, 0.8); --text: #1a1a2e; --border: rgba(0, 0, 0, 0.1); --input-bg: rgba(0, 0, 0, 0.05); }
|
|
15
|
+
* { box-sizing: border-box; }
|
|
16
|
+
body { margin: 0; font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); transition: background 0.3s, color 0.3s; }
|
|
17
|
+
.auth-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; width: 100%; max-width: 400px; padding: 1rem; }
|
|
18
|
+
.auth-card { background: var(--card-bg); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
|
|
19
|
+
.auth-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
|
|
20
|
+
.auth-header h1 { margin: 0; font-size: 1.8em; }
|
|
21
|
+
.theme-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0.4em 0.6em; font-size: 1.2em; cursor: pointer; transition: background 0.2s; }
|
|
22
|
+
.theme-btn:hover { background: var(--input-bg); }
|
|
23
|
+
.form-group { margin-bottom: 1rem; }
|
|
24
|
+
label { display: block; margin-bottom: 0.3em; font-size: 0.9em; opacity: 0.8; }
|
|
25
|
+
input { width: 100%; padding: 0.7em 1em; font-size: 1em; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); outline: none; transition: border-color 0.2s; }
|
|
26
|
+
input:focus { border-color: var(--accent); }
|
|
27
|
+
input::placeholder { color: var(--text); opacity: 0.4; }
|
|
28
|
+
.error { display: block; margin-top: 0.3em; font-size: 0.8em; color: var(--error); min-height: 1em; }
|
|
29
|
+
button[type="submit"] { width: 100%; padding: 0.8em; font-size: 1em; font-weight: 600; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; transition: background 0.2s; margin-top: 0.5rem; }
|
|
30
|
+
button[type="submit"]:hover { background: var(--accent-hover); }
|
|
31
|
+
.toggle-text { text-align: center; margin-top: 1.5rem; font-size: 0.9em; opacity: 0.7; }
|
|
32
|
+
.toggle-text a { color: var(--accent); text-decoration: none; margin-left: 0.3em; }
|
|
33
|
+
.toggle-text a:hover { text-decoration: underline; }
|
|
34
|
+
</style>
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div class="auth-container">
|
|
38
|
+
<div class="auth-card">
|
|
39
|
+
<div class="auth-header">
|
|
40
|
+
<h1 id="authTitle">Login</h1>
|
|
41
|
+
<button class="theme-btn" id="themeToggle" aria-label="Toggle theme">🌙</button>
|
|
42
|
+
</div>
|
|
43
|
+
<form id="authForm" novalidate>
|
|
44
|
+
<div class="form-group">
|
|
45
|
+
<label for="email">Email</label>
|
|
46
|
+
<input id="email" type="email" placeholder="you@example.com" required />
|
|
47
|
+
<span class="error" id="emailError"></span>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="form-group">
|
|
50
|
+
<label for="password">Password</label>
|
|
51
|
+
<input id="password" type="password" placeholder="Enter password" required />
|
|
52
|
+
<span class="error" id="passwordError"></span>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="form-group" id="confirmGroup" style="display: none">
|
|
55
|
+
<label for="confirmPassword">Confirm Password</label>
|
|
56
|
+
<input id="confirmPassword" type="password" placeholder="Confirm password" />
|
|
57
|
+
<span class="error" id="confirmError"></span>
|
|
58
|
+
</div>
|
|
59
|
+
<button type="submit" id="submitBtn">Sign In</button>
|
|
60
|
+
</form>
|
|
61
|
+
<p class="toggle-text">
|
|
62
|
+
<span id="toggleLabel">Don't have an account?</span>
|
|
63
|
+
<a href="#" id="toggleAuth">Register</a>
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</body>
|
|
68
|
+
</html>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import { initParticlesEngine } from "@tsparticles/astro";
|
|
72
|
+
import { loadSlim } from "@tsparticles/slim";
|
|
73
|
+
|
|
74
|
+
await initParticlesEngine(async (engine) => {
|
|
75
|
+
await loadSlim(engine);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
let isLogin = true;
|
|
79
|
+
|
|
80
|
+
const authTitle = document.getElementById("authTitle");
|
|
81
|
+
const authForm = document.getElementById("authForm");
|
|
82
|
+
const submitBtn = document.getElementById("submitBtn");
|
|
83
|
+
const toggleAuth = document.getElementById("toggleAuth");
|
|
84
|
+
const toggleLabel = document.getElementById("toggleLabel");
|
|
85
|
+
const confirmGroup = document.getElementById("confirmGroup");
|
|
86
|
+
const themeToggle = document.getElementById("themeToggle");
|
|
87
|
+
|
|
88
|
+
const emailInput = document.getElementById("email");
|
|
89
|
+
const passwordInput = document.getElementById("password");
|
|
90
|
+
const confirmInput = document.getElementById("confirmPassword");
|
|
91
|
+
|
|
92
|
+
const emailError = document.getElementById("emailError");
|
|
93
|
+
const passwordError = document.getElementById("passwordError");
|
|
94
|
+
const confirmError = document.getElementById("confirmError");
|
|
95
|
+
|
|
96
|
+
function setTheme(theme) {
|
|
97
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
98
|
+
themeToggle.textContent = theme === "dark" ? "🌙" : "☀️";
|
|
99
|
+
localStorage.setItem("theme", theme);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const savedTheme = localStorage.getItem("theme") || "dark";
|
|
103
|
+
setTheme(savedTheme);
|
|
104
|
+
|
|
105
|
+
themeToggle.addEventListener("click", () => {
|
|
106
|
+
const current = document.documentElement.getAttribute("data-theme") || "dark";
|
|
107
|
+
setTheme(current === "dark" ? "light" : "dark");
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
function validateEmail(val) {
|
|
111
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function validate() {
|
|
115
|
+
let valid = true;
|
|
116
|
+
|
|
117
|
+
if (!emailInput.value || !validateEmail(emailInput.value)) {
|
|
118
|
+
emailError.textContent = "Please enter a valid email address";
|
|
119
|
+
valid = false;
|
|
120
|
+
} else {
|
|
121
|
+
emailError.textContent = "";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!passwordInput.value || passwordInput.value.length < 6) {
|
|
125
|
+
passwordError.textContent = "Password must be at least 6 characters";
|
|
126
|
+
valid = false;
|
|
127
|
+
} else {
|
|
128
|
+
passwordError.textContent = "";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!isLogin) {
|
|
132
|
+
if (passwordInput.value !== confirmInput.value) {
|
|
133
|
+
confirmError.textContent = "Passwords do not match";
|
|
134
|
+
valid = false;
|
|
135
|
+
} else {
|
|
136
|
+
confirmError.textContent = "";
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return valid;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function toggleMode() {
|
|
144
|
+
isLogin = !isLogin;
|
|
145
|
+
authTitle.textContent = isLogin ? "Login" : "Register";
|
|
146
|
+
submitBtn.textContent = isLogin ? "Sign In" : "Create Account";
|
|
147
|
+
toggleLabel.textContent = isLogin ? "Don't have an account?" : "Already have an account?";
|
|
148
|
+
toggleAuth.textContent = isLogin ? "Register" : "Login";
|
|
149
|
+
confirmGroup.style.display = isLogin ? "none" : "block";
|
|
150
|
+
emailError.textContent = "";
|
|
151
|
+
passwordError.textContent = "";
|
|
152
|
+
confirmError.textContent = "";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
toggleAuth.addEventListener("click", (e) => {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
toggleMode();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
authForm.addEventListener("submit", (e) => {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
if (!validate()) return;
|
|
163
|
+
|
|
164
|
+
if (isLogin) {
|
|
165
|
+
alert("Logged in successfully! (demo)");
|
|
166
|
+
} else {
|
|
167
|
+
alert("Account created successfully! (demo)");
|
|
168
|
+
toggleMode();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
authForm.reset();
|
|
172
|
+
});
|
|
173
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<div id="particles-container" {{did-insert this.initParticles}} {{particles options=this.options}}>
|
|
2
|
+
</div>
|
|
3
|
+
|
|
4
|
+
<div class="auth-container">
|
|
5
|
+
<div class="auth-card">
|
|
6
|
+
<div class="auth-header">
|
|
7
|
+
<h1>{{if this.isLogin "Login" "Register"}}</h1>
|
|
8
|
+
<button class="theme-btn" type="button" {{on "click" this.toggleTheme}} aria-label="Toggle theme">{{if (eq this.theme "dark") "🌙" "☀️"}}</button>
|
|
9
|
+
</div>
|
|
10
|
+
<form {{on "submit" this.handleSubmit}} novalidate>
|
|
11
|
+
<div class="form-group">
|
|
12
|
+
<label for="email">Email</label>
|
|
13
|
+
<Input id="email" @type="email" @value={{this.email}} placeholder="you@example.com" required />
|
|
14
|
+
<span class="error">{{this.emailErr}}</span>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="form-group">
|
|
17
|
+
<label for="password">Password</label>
|
|
18
|
+
<Input id="password" @type="password" @value={{this.password}} placeholder="Enter password" required />
|
|
19
|
+
<span class="error">{{this.passErr}}</span>
|
|
20
|
+
</div>
|
|
21
|
+
{{#unless this.isLogin}}
|
|
22
|
+
<div class="form-group">
|
|
23
|
+
<label for="confirmPassword">Confirm Password</label>
|
|
24
|
+
<Input id="confirmPassword" @type="password" @value={{this.confirm}} placeholder="Confirm password" />
|
|
25
|
+
<span class="error">{{this.confirmErr}}</span>
|
|
26
|
+
</div>
|
|
27
|
+
{{/unless}}
|
|
28
|
+
<button type="submit">{{if this.isLogin "Sign In" "Create Account"}}</button>
|
|
29
|
+
</form>
|
|
30
|
+
<p class="toggle-text">
|
|
31
|
+
<span>{{if this.isLogin "Don't have an account?" "Already have an account?"}}</span>
|
|
32
|
+
<a href="#" {{on "click" this.toggleMode}}>{{if this.isLogin "Register" "Login"}}</a>
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{{outlet}}
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
:root { --bg: #0f0f1a; --card-bg: rgba(255, 255, 255, 0.05); --text: #fff; --border: rgba(255, 255, 255, 0.1); --input-bg: rgba(255, 255, 255, 0.08); --accent: #6c5ce7; --accent-hover: #a29bfe; --error: #e74c3c; }
|
|
41
|
+
[data-theme="light"] { --bg: #f0f0f5; --card-bg: rgba(255, 255, 255, 0.8); --text: #1a1a2e; --border: rgba(0, 0, 0, 0.1); --input-bg: rgba(0, 0, 0, 0.05); }
|
|
42
|
+
* { box-sizing: border-box; }
|
|
43
|
+
body { margin: 0; font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); transition: background 0.3s, color 0.3s; }
|
|
44
|
+
.auth-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; width: 100%; max-width: 400px; padding: 1rem; }
|
|
45
|
+
.auth-card { background: var(--card-bg); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
|
|
46
|
+
.auth-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
|
|
47
|
+
.auth-header h1 { margin: 0; font-size: 1.8em; }
|
|
48
|
+
.theme-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0.4em 0.6em; font-size: 1.2em; cursor: pointer; transition: background 0.2s; }
|
|
49
|
+
.theme-btn:hover { background: var(--input-bg); }
|
|
50
|
+
.form-group { margin-bottom: 1rem; }
|
|
51
|
+
label { display: block; margin-bottom: 0.3em; font-size: 0.9em; opacity: 0.8; }
|
|
52
|
+
input { width: 100%; padding: 0.7em 1em; font-size: 1em; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); outline: none; transition: border-color 0.2s; }
|
|
53
|
+
input:focus { border-color: var(--accent); }
|
|
54
|
+
input::placeholder { color: var(--text); opacity: 0.4; }
|
|
55
|
+
.error { display: block; margin-top: 0.3em; font-size: 0.8em; color: var(--error); min-height: 1em; }
|
|
56
|
+
button[type="submit"] { width: 100%; padding: 0.8em; font-size: 1em; font-weight: 600; border: none; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; transition: background 0.2s; margin-top: 0.5rem; }
|
|
57
|
+
button[type="submit"]:hover { background: var(--accent-hover); }
|
|
58
|
+
.toggle-text { text-align: center; margin-top: 1.5rem; font-size: 0.9em; opacity: 0.7; }
|
|
59
|
+
.toggle-text a { color: var(--accent); text-decoration: none; margin-left: 0.3em; }
|
|
60
|
+
.toggle-text a:hover { text-decoration: underline; }
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "ember serve",
|
|
7
|
+
"build": "ember build",
|
|
8
|
+
"preview": "ember serve"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@ember/optional-features": "^3.0.0",
|
|
12
|
+
"@glimmer/component": "^2.1.1",
|
|
13
|
+
"@glimmer/tracking": "^1.1.2",
|
|
14
|
+
"broccoli-asset-rev": "^3.0.0",
|
|
15
|
+
"ember-auto-import": "^2.13.1",
|
|
16
|
+
"ember-cli": "~6.12.0",
|
|
17
|
+
"ember-cli-babel": "^8.3.1",
|
|
18
|
+
"ember-cli-htmlbars": "^7.0.1",
|
|
19
|
+
"ember-cli-inject-live-reload": "^2.1.0",
|
|
20
|
+
"ember-cli-sri": "^2.1.1",
|
|
21
|
+
"ember-cli-terser": "^4.0.2",
|
|
22
|
+
"ember-load-initializers": "^3.0.1",
|
|
23
|
+
"ember-modifier": "^4.3.0",
|
|
24
|
+
"ember-resolver": "^13.2.0",
|
|
25
|
+
"ember-source": "~6.12.0",
|
|
26
|
+
"loader.js": "^4.7.0",
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"webpack": "^5.106.1"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@tsparticles/ember": "^4.1.3",
|
|
32
|
+
"@tsparticles/slim": "^4.1.3",
|
|
33
|
+
"@tsparticles/configs": "^4.1.3",
|
|
34
|
+
"@tsparticles/engine": "^4.1.3"
|
|
35
|
+
},
|
|
36
|
+
"ember": {
|
|
37
|
+
"edition": "octane"
|
|
38
|
+
},
|
|
39
|
+
"ember-addon": {
|
|
40
|
+
"configPath": "tests/dummy/config"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
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
|
+
"inferno": "^9.1.0",
|
|
13
|
+
"@tsparticles/inferno": "^4.1.3",
|
|
14
|
+
"@tsparticles/slim": "^4.1.3",
|
|
15
|
+
"@tsparticles/configs": "^4.1.3",
|
|
16
|
+
"@tsparticles/engine": "^4.1.3"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^6.0.3",
|
|
20
|
+
"vite": "^8.0.14",
|
|
21
|
+
"babel-plugin-inferno": "^6.8.5",
|
|
22
|
+
"vite-plugin-inferno": "^2.0.1"
|
|
23
|
+
}
|
|
24
|
+
}
|