You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://github.com/sktryo/XIV/actions/workflows/publish_npm.yaml)
2
+
[](https://github.com/sktryo/XIV/actions/workflows/publish.yml)
3
+
3
4
# XIV
4
5
5
6
A simple, component-based template engine that evolves into a lightweight JavaScript framework.
6
7
7
-
XIV allows you to write clean, reusable HTML components and bring them to life with minimal JavaScript, powered by a Python-based compiler.
8
+
XIV allows you to write clean, reusable HTML components and bring them to life with minimal JavaScript, all powered by the Bun runtime.
8
9
9
10
## Features
10
11
11
-
-**Component-Based Architecture:** Use `<x-temp>` to build your UI from reusable parts.
12
-
-**Props:** Pass data to components with `t-*` attributes.
12
+
The compiler sets up a basic HTML structure, while the lightweight JavaScript runtime handles dynamic features directly in the browser.
13
+
14
+
-**Component-Based Architecture:** Build your UI from reusable parts.
15
+
-**Props:** Pass data to components.
13
16
-**Slots:** Inject complex HTML content into your components.
14
-
-**Conditional Rendering:** Use `x-if`and `x-if="not ..."`to show or hide elements.
15
-
-**List Rendering:** Loop over arrays violência`x-for="item in items"`.
17
+
-**Conditional Rendering:** Use `x-if` to show or hide elements.
18
+
-**List Rendering:** Loop over arrays with`x-for`.
16
19
-**Reactive State:** Manage component state with `x-data`.
17
20
-**Event Handling:** Listen to DOM events with `x-on:<event>`.
18
21
-**Reactive Text:** Bind state properties to text content with `x-text`.
19
22
20
23
## Installation
21
24
22
-
XIV uses a Python-based compiler wrapped in a Node.js CLI. Installation is a two-step process.
23
-
24
-
### Step 1: Python Environment Setup
25
-
26
-
First, ensure you have Python 3 and `pip` installed. Then, set up the compiler's dependencies:
25
+
First, ensure you have [Bun](https://bun.sh/) installed.
27
26
28
27
```shell
29
-
# Clone the repository (or download the source)
30
-
git clone https://github.com/sktryo/XIV.git
31
-
cd XIV
32
-
33
-
# Create a virtual environment (recommended)
34
-
python3 -m venv venv
35
-
36
-
# Install required Python packages
37
-
venv/bin/pip install -r requirements.txt
38
-
```
39
-
40
-
### Step 2: Install from npm
41
-
42
-
Once the Python environment is ready, you can install the `xiv-lang` command-line tool globally from npm:
43
-
44
-
```shell
45
-
npm install -g .
46
-
# (In a real scenario, this would be: npm install -g xiv-lang)
28
+
# Install from the Bun package registry
29
+
bun add xiv-lang
47
30
```
48
31
49
32
## Usage
@@ -57,67 +40,51 @@ xiv <input_file> [options]
57
40
**Example:**
58
41
59
42
```shell
60
-
xiv docs/main.xiv -o dist/index.html -t docs/templates
43
+
xiv docs/main.xiv -o dist/index.html
61
44
```
62
45
63
46
**Options:**
64
47
65
-
-`-t, --templates_dir <path>`: Directory for template files (default: `./templates`)
66
48
-`-o, --output_file <path>`: Path for the output HTML file (default: `./index.html`)
XIV injects a lightweight JavaScript runtime to handle client-side interactivity.
68
+
The `xiv` compiler takes a main `.xiv` file, extracts the content from `<head>` and `<body>` tags inside a `<xiv type="main">` block, and embeds it into a standard HTML5 boilerplate. It also injects the `xiv.js`runtime, which powers all the client-side interactive features.
113
69
70
+
**Example `main.xiv`:**
114
71
```html
115
-
<divx-data='{ "count": 0 }'>
116
-
<p>Count: <spanx-text="count"></span></p>
117
-
<buttonx-on:click="count++">Increment</button>
118
-
</div>
72
+
<xivtype="main">
73
+
<head>
74
+
<title>My Awesome App</title>
75
+
</head>
76
+
<body>
77
+
<h1>Welcome to XIV!</h1>
78
+
79
+
<!-- Interactive component handled by the runtime -->
80
+
<divx-data='{ "count": 0 }'>
81
+
<p>Count: <spanx-text="count"></span></p>
82
+
<buttonx-on:click="count++">Increment</button>
83
+
</div>
84
+
</body>
85
+
</xiv>
119
86
```
120
87
121
88
## License
122
89
123
-
This project is licensed under the ISC License. See the [LICENSE](./LICENSE) file for details.
90
+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
0 commit comments