SaLang is a new programming language with unique syntax and features, specifically focused on simplifying the development and management of web components.
- Component-based architecture
- Concise and clear syntax
- Optimized for web development
Instructions to install SaLang language.
Basic usage of the SaLang language.
@component MyComponent {
// Contents of the component
}
@state {
counter: 0;
isvisible: true;
}
@attribute title: "Interactive Component";
@style {
.my-class {
color: var(primaryColor);
}
}
@event click on .my-button {
@js {
// Event handling logic
}
}
@template {
div.my-component {
"Hello, world!"
}
}
@component ComplexComponent {
@state {
items: [];
selectedItem: null;
}
@attribute defaultColor: "blue";
@style {
.item {
color: var(defaultColor);
padding: 10px;
border: 1px solid black;
}
.selected {
background-color: yellow;
}
}
@function selectItem(itemId) {
@js {
this.selectedItem = this.items.find(item => item.id === itemId);
}
}
@event click on .item {
@js {
selectItem(var(itemId));
}
}
@template {
ul {
@repeat item in var(items) {
li.item(id: "item-" var(item.id)) {
"Item: " var(item.name)
}
}
}
}
}
Contributions to SaLang are welcome! Please read our CONTRIBUTING.md for details on how to contribute.
This project is licensed under the MIT License.