rasti 3.0.0-alpha.3 → 3.0.1

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 CHANGED
@@ -20,23 +20,23 @@
20
20
  ## Key Features
21
21
 
22
22
  - **Declarative Components** 🌟
23
- Build dynamic UI components using intuitive template literals.
23
+ Build dynamic UI components using intuitive template literals.
24
24
  - **Event Delegation** 🎯
25
- Simplify event handling with built-in delegation.
25
+ Simplify event handling with built-in delegation.
26
26
  - **Model-View Binding** 🔗
27
- Keep your UI and data in sync with ease.
27
+ Keep your UI and data in sync with ease.
28
28
  - **Server-Side Rendering** 🌐
29
- Render as plain text for server-side use or static builds.
29
+ Render as plain text for server-side use or static builds.
30
30
  - **Lightweight and Fast** ⚡
31
- Minimal overhead with efficient rendering.
31
+ Minimal overhead with efficient rendering.
32
32
  - **Legacy Compatibility** 🕰️
33
- Seamlessly integrates into existing **Backbone.js** projects.
33
+ Seamlessly integrates into existing **Backbone.js** projects.
34
34
  - **Standards-Based** 📐
35
- Built on modern web standards, no tooling required.
35
+ Built on modern web standards, no tooling required.
36
36
 
37
37
  ## Getting Started
38
38
 
39
- ### Using npm
39
+ ### Installing via npm
40
40
 
41
41
  ```bash
42
42
  $ npm install rasti
@@ -52,7 +52,7 @@ import { Model, Component } from 'rasti';
52
52
  import { Model, Component } from 'https://esm.run/rasti';
53
53
  ```
54
54
 
55
- ### Using `<script>` tag
55
+ ### Using a `<script>` tag
56
56
 
57
57
  ```html
58
58
  <script src="https://cdn.jsdelivr.net/npm/rasti/dist/rasti.min.js"></script>
@@ -97,27 +97,27 @@ const routes = [
97
97
  // Create a Link component for navigation items.
98
98
  const Link = Component.create`
99
99
  <a href="${({ options }) => options.href}">
100
- ${({ options }) => options.label}
100
+ ${({ options }) => options.renderChildren()}
101
101
  </a>
102
102
  `;
103
103
 
104
104
  // Create a Navigation component that renders Link components for each route.
105
105
  const Navigation = Component.create`
106
106
  <nav>
107
- ${self => self.options.routes.map(
108
- ({ label, href }) => self.partial`<${Link} ${{ label, href }} />`
107
+ ${({ options, partial }) => options.routes.map(
108
+ ({ label, href }) => partial`<${Link} href="${href}">${label}</${Link}>`
109
109
  )}
110
110
  </nav>
111
111
  `;
112
112
 
113
- // Create a Page component that includes the Navigation and displays the current route's label as the title.
114
- const Page = Component.create`
113
+ // Create a Main component that includes the Navigation and displays the current route's label as the title.
114
+ const Main = Component.create`
115
115
  <main>
116
116
  <${Navigation} routes=${({ options }) => options.routes} />
117
117
  <section>
118
118
  <h1>
119
- ${({ state, options }) => options.routes.find(
120
- ({ href }) => href === (state.location || '#')
119
+ ${({ model, options }) => options.routes.find(
120
+ ({ href }) => href === (model.location || '#')
121
121
  ).label}
122
122
  </h1>
123
123
  </section>
@@ -130,24 +130,26 @@ const model = new Model({ location: document.location.hash });
130
130
  // Update the model's location state when the browser's history changes.
131
131
  window.addEventListener('popstate', () => model.location = document.location.hash);
132
132
 
133
- // Mount the Page component to the body, passing the routes and model as options.
134
- Page.mount({ routes, model }, document.body);
133
+ // Mount the Main component to the body, passing the routes and model as options.
134
+ Main.mount({ routes, model }, document.body);
135
135
  ```
136
136
 
137
137
  [Try it on CodePen](https://codepen.io/8tentaculos/pen/dyBMNbq?editors=0010)
138
138
 
139
139
  ## Why Choose **Rasti**?
140
140
 
141
- ### Why Choose Rasti?
142
-
143
- - **Lightweight Applications**: Designed for streamlined apps, free from unnecessary overhead or tooling.
144
- - **High-Performance Rendering**: Optimized for scenarios where speed matters, delivering fast updates and efficient rendering—ideal for large dynamic tables or datasets without needing virtual scrolling.
145
- - **Seamless Legacy Integration**: Modernize your **Backbone.js** views progressively, enabling incremental improvements without a full rewrite.
141
+ **Rasti** is built for developers who want a simple yet powerful way to create UI components without the complexity of heavy frameworks. Whether you're building a high-performance dashboard, or embedding a lightweight widget, **Rasti** lets you:
146
142
 
143
+ - **Skip the Setup**
144
+ No installations, no build tools—just load it and start coding.
145
+ - **Lightweight and Efficient**
146
+ Minimal footprint with optimized performance, ensuring smooth updates.
147
+ - **Just the Right Abstraction**
148
+ Keeps you close to the DOM with no over-engineering. Fully hackable—if you're curious about how something works, just check the source code.
147
149
 
148
150
  ## Example
149
151
 
150
- The rasti [GitHub repository](https://github.com/8tentaculos/rasti) includes, in the [example folder](https://github.com/8tentaculos/rasti/tree/master/example/todo), an example [TODO application](https://rasti.js.org/example/todo/index.html) that can be used as starter project.
152
+ You can find a sample **TODO application** in the [example folder](https://github.com/8tentaculos/rasti/tree/master/example/todo) of the **Rasti** [GitHub repository](https://github.com/8tentaculos/rasti). This example serves as a great starting point for your own projects. Try it live [here](https://rasti.js.org/example/todo/index.html).
151
153
 
152
154
  ## API Documentation
153
155