Skip to content

Commit 782d200

Browse files
authored
Update readme.md
1 parent c1bb5df commit 782d200

File tree

1 file changed

+60
-42
lines changed

1 file changed

+60
-42
lines changed

readme.md

+60-42
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,51 @@
11
# Kasper-js 1.0.1
22

3-
This is a work in progress of a javascript html template parser and renderer
3+
**Kasper-js** is a work-in-progress JavaScript HTML template parser and renderer designed to help create and learn core mechanics of modern JavaScript frameworks.
44

55
## > [Try it out in playground!](https://eugenioenko.github.io/kasper-js/live/)
66

77
Here you can find a small demo of Kanban board done with kasper-js
88

99
### > [KasperJS Kanban board demo](https://eugenioenko.github.io/kasper-js/live/demo.html)
1010

11-
## Project goals
11+
## Project Vision
1212

13-
> Create a full modern javascript framework
13+
Kasper-js aims to bridge the gap between simple templating engines and full-fledged JavaScript frameworks by providing a lightweight, extensible solution that emphasizes performance and developer experience. As web applications continue to evolve, the need for flexible and efficient frameworks has never been greater.
14+
15+
## Project Goals
16+
The primary goal of Kasper-js is to create a comprehensive modern JavaScript framework. This includes:
17+
18+
- Developing a JavaScript HTML template parser and view renderer engine.
19+
- Establishing a base for a full JavaScript framework, including components, dependency injection, and build tools.
20+
- Gaining insights into the complexities of framework development through research and practical implementation.
1421

15-
Realistic goal is to write a javascript template parser and use it later to create a base for a javascript framework (components, dependency injection, build, etc..) and learn, research and understand the complexity of the task.
1622

1723
## Template syntax goals
1824

19-
Kasper's template syntax should always be a valid html syntax. Any html editor should work correctly with it.
20-
The template language should be cohesive and clean, ideally with no compromises
25+
Kasper's template syntax aims to maintain valid HTML syntax, ensuring compatibility with any HTML editor. The syntax is designed to be:
26+
27+
- Cohesive and clean.
28+
- Intuitive with minimal compromises.
2129

22-
## Implemented so far
30+
## Best Practices
2331

24-
- html parser
25-
- javascript like syntax parser and interpreter
26-
- template renderer
27-
- re-render on state update
32+
The framework adheres to the following best practices:
33+
- **Modular Design**: Each component is encapsulated, promoting reusability.
34+
- **Separation of Concerns**: Logic is separated from presentation, enhancing readability and maintainability.
2835

29-
## Getting started
36+
## Features Implemented So Far
3037

31-
To use kasper you will need to:
38+
- HTML parser
39+
- JavaScript-like syntax parser and interpreter
40+
- Template renderer
41+
- Re-rendering on state updates
3242

33-
- Include the `kasper.js`.
34-
- Add a `<template>` element
35-
- Add a class that extends from `KasperApp`
36-
- Render the app by calling `Kasper`
43+
To use Kasper, follow these steps:
44+
45+
1. Include the `kasper.js` script in your HTML file.
46+
2. Create a `<template>` element for your UI.
47+
3. Extend the `KasperApp` class to create your application.
48+
4. Render the app by calling `Kasper`.
3749

3850
```
3951
<html>
@@ -54,6 +66,7 @@ To use kasper you will need to:
5466
</html>
5567
```
5668

69+
5770
## Conditional expression
5871

5972
```
@@ -106,40 +119,45 @@ Evaluates the expression to string and inserts it into the dom as a TextNode
106119
{{ "Hello" + " " + "World" }}
107120
```
108121

109-
# Template expression interpreter
110-
111-
Kasper's expression interpreter emulates basic javascript expressions.
112-
So far it implements the following expressions:
113-
Assign, Binary, Call, Debug, Dictionary, Each, Get, Grouping, Key, Logical, List, Literal, New, NullCoalescing, Postfix, Set, Template, Ternary, Typeof, Unary, Variable, Void
122+
## Template Expression Interpreter
114123

115-
## Assignment expression
124+
The **Kasper** expression interpreter is designed to emulate basic JavaScript expressions, providing a versatile framework for template rendering and dynamic content management. It allows developers to use familiar JavaScript syntax and constructs, enhancing the functionality and flexibility of the templates.
116125

117-
`identifier [operator] expression;`
118-
Valid operators are: `= += -= *= /=`
119126

120-
```
121-
number = 22;
122-
list = [1, 2, "hello"];
123-
dict = {"green": "#00FF00 };
124-
text += "Hello World";
125-
```
127+
## Supported JavaScript Expressions
126128

127-
## Binary expression
129+
Currently, the interpreter supports the following expressions:
128130

129-
`identifier [operator] expression;`
130-
Valid operators are: `+ - / *`
131+
- **Assign**: Assigns a value to a variable.
132+
- **Binary**: Performs binary operations (e.g., addition, subtraction).
133+
- **Call**: Invokes a function or method.
134+
- **Debug**: Outputs debug information.
135+
- **Dictionary**: Creates and manages key-value pairs.
136+
- **Each**: Iterates over a collection or array.
137+
- **Get**: Retrieves a value from an object or array.
138+
- **Grouping**: Groups expressions for evaluation.
139+
- **Key**: Accesses object properties using keys.
140+
- **Logical**: Performs logical operations (e.g., AND, OR).
141+
- **List**: Represents a list of values.
142+
- **Literal**: Represents a fixed value (e.g., strings, numbers).
143+
- **New**: Creates new instances of objects or arrays.
144+
- **Null Coalescing**: Returns the first non-null value.
145+
- **Postfix**: Applies operations after the value.
146+
- **Set**: Sets a value to a variable.
147+
- **Template**: Processes template literals for rendering.
148+
- **Ternary**: Implements conditional expressions (ternary operator).
149+
- **Typeof**: Returns the type of a variable or expression.
150+
- **Unary**: Applies unary operations (e.g., negation).
151+
- **Variable**: Represents a variable that can store values.
152+
- **Void**: Represents an expression that does not return a value.
131153

132-
```
133-
text + list[0] * dict.value;
134-
```
154+
### Future Enhancements
135155

136-
## Function call expression
156+
Future updates will focus on expanding the capabilities of the expression interpreter, incorporating additional expressions and features to enhance the framework's power and usability.
137157

138-
`identifier(arg*);`
158+
## Testing
139159

140-
```
141-
console.log('something');
142-
```
160+
Kasper-js employs **Jasmine** for unit testing to ensure code reliability and maintainability. The tests are organized in the `/specs` folder, allowing for easy navigation and management of test cases. However, the current test coverage needs improvement, and additional tests are encouraged to enhance the robustness of the framework.
143161

144162
## Todo
145163

0 commit comments

Comments
 (0)