typecomposer 0.0.45 → 0.0.46
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/README.md +68 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# TypeComposer
|
|
2
|
+
|
|
3
|
+
TypeComposer is a frontend framework that allows you to create user interfaces declaratively using only classes in TypeScript or JavaScript, eliminating the need to write HTML directly.It offers a simplified and efficient approach to web development.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Create user interfaces without writing HTML directly.
|
|
8
|
+
|
|
9
|
+
- Uses a class-based syntax to define the structure of the interface.
|
|
10
|
+
- Full TypeScript support and compatibility with JavaScript.
|
|
11
|
+
- Easily integratable with other frontend frameworks and libraries.
|
|
12
|
+
- Style and positioning of elements controlled via CSS.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
You can install TypeComposer via npm:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install typecomposer
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
To get started with TypeComposer, import the necessary elements from the package and start creating your user interface using classes.Here's a basic example of a login page:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
|
|
28
|
+
import { BorderPaneElement, ButtonElement, H1Element, TextFieldElement, VBoxElement } from 'typecomposer';
|
|
29
|
+
|
|
30
|
+
export class LoginPage extends BorderPaneElement {
|
|
31
|
+
onInit(): void {
|
|
32
|
+
const vbox = new VBoxElement({ className: 'login-container' });
|
|
33
|
+
|
|
34
|
+
vbox.append(new H1Element({ text: "Login", textAlign: "center", color: "#333" }));
|
|
35
|
+
|
|
36
|
+
const emailField = new TextFieldElement({ placeholder: "Email", type: "email", className: 'login-field' });
|
|
37
|
+
const passwordField = new TextFieldElement({ placeholder: "Password", type: "password", className: 'login-field' });
|
|
38
|
+
|
|
39
|
+
const loginButton = new ButtonElement({ text: "Login", className: 'login-button' });
|
|
40
|
+
loginButton.onclick = () => {
|
|
41
|
+
const email = (emailField.value as string).trim();
|
|
42
|
+
const password = (passwordField.value as string).trim();
|
|
43
|
+
alert(`Email: ${ email } \nPassword: ${ password } `);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
vbox.append(emailField);
|
|
47
|
+
vbox.append(passwordField);
|
|
48
|
+
vbox.append(loginButton);
|
|
49
|
+
|
|
50
|
+
this.center.setStyle({ display: 'flex', justifyContent: 'center', alignItems: 'center' });
|
|
51
|
+
this.center.append(vbox);
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Set the login page as the main page
|
|
57
|
+
App.setPage(new LoginPage());
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Contributions are welcome! If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request in this GitHub repository.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
This project is licensed under the[MIT License](LICENSE).
|
|
68
|
+
```
|