eleva 1.0.0-alpha → 1.0.0-rc.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Tarek
3
+ Copyright (c) 2025 Eleva
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,24 +1,58 @@
1
- # Eleva
1
+ # eleva.js 🚀
2
2
 
3
- **A minimalist, lightweight, pure vanilla JavaScript frontend runtime framework.**
4
- _Built with love for native JavaScript—because sometimes, less really is more!_ 😊
3
+ Pure JavaScript, Pure Performance, Simply Elegant.
5
4
 
5
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![GitHub package.json version](https://img.shields.io/github/package-json/v/tarekraafat/eleva?label=github)](https://github.com/TarekRaafat/eleva)
6
7
  [![Version](https://img.shields.io/npm/v/eleva.svg?style=flat)](https://www.npmjs.com/package/eleva)
7
- [![License](https://img.shields.io/npm/l/eleva.svg?style=flat)](LICENSE)
8
- [![Build Status](https://img.shields.io/travis/TarekRaafat/eleva.svg?style=flat)](https://travis-ci.org/TarekRaafat/eleva)
8
+ ![100% Javascript](https://img.shields.io/github/languages/top/TarekRaafat/eleva?color=yellow)
9
+ ![Zero Dependencies](https://img.shields.io/badge/dependencies-0-green.svg)
10
+ [![codecov](https://codecov.io/gh/TarekRaafat/eleva/branch/master/graph/badge.svg?token=LFA6KENM24)](https://codecov.io/gh/TarekRaafat/eleva)
11
+ [![Minified Size](https://badgen.net/bundlephobia/min/eleva@latest)](https://bundlephobia.com/package/eleva@latest)
12
+ [![Gzipped Size](https://badgen.net/bundlephobia/minzip/eleva@latest)](https://bundlephobia.com/package/eleva@latest)
13
+ [![](https://data.jsdelivr.com/v1/package/npm/eleva/badge?style=rounded)](https://www.jsdelivr.com/package/npm/eleva)
14
+ [![Supported by Canonical](https://img.shields.io/badge/Supported%20by-Canonical-E95420?logo=ubuntu&logoColor=white)](https://canonical.com)
15
+
16
+ <br>
17
+
18
+ <p align="center">
19
+ <a href="https://tarekraafat.github.io/eleva/"><img src="./docs/imgs/eleva.js Full Logo.png" alt="eleva.js Full Logo" width="50%"></a>
20
+ </p>
21
+
22
+ <p align="center">
23
+ <a href="https://canonical.com" target="_blank" rel="noopener">
24
+ <img src="https://raw.githubusercontent.com/SebastJava/Ubuntu-logo/649d55eca403302fb06281d9dd94798bb0568e8d/logo-v2025-plain-450x708.svg" alt="Canonical Logo" width="80"/>
25
+ </a>
26
+ </p>
27
+
28
+ <p align="center">
29
+ <em>Eleva.js is proudly supported by Canonical - the company behind Ubuntu.</em>
30
+ </p>
31
+
32
+ <p align="center">
33
+ <a href="https://www.producthunt.com/posts/eleva?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-eleva" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=938663&theme=light&t=1741247713068" alt="eleva.js - A&#0032;minimalist&#0044;&#0032;pure&#0032;vanilla&#0032;javascript&#0032;frontend&#0032;framework&#0046; | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
34
+ </p>
35
+
36
+ <br>
37
+ <br>
38
+ <br>
39
+
40
+ **A minimalist, lightweight, pure vanilla JavaScript frontend runtime framework.**
41
+ _Built with love for native JavaScript and designed with a minimal core that can be extended through a powerful plugin system-because sometimes, less really is more!_ 😊
42
+
43
+ > **Stability Notice**: This is `v1.0.0-rc.2` - The core functionality is stable. Seeking community feedback before the final v1.0.0 release.
9
44
 
10
- > **Stability Notice**: This is `v1.0.0-alpha` - APIs may change significantly until stable release.
11
- > Not recommended for production use yet. Follow the [versioning guide](#versioning) for updates.
45
+ **Version:** `1.0.0-rc.2`
12
46
 
13
- **Version:** `1.0.0-alpha`
14
47
 
15
- Welcome to Eleva! This is my humble, experimental playground for a fresh approach to frontend development. Eleva was born out of my genuine passion for pure vanilla JavaScript—no frameworks, no bloat, just the power of native code. I hope you'll have fun exploring, testing, and contributing to make Eleva even better. 🚀
48
+
49
+ Welcome to Eleva! This is my humble, experimental playground for a fresh approach to frontend development. Eleva was born out of my genuine passion for pure vanilla JavaScript-no frameworks, no bloat, just the power of native code. I hope you'll have fun exploring, testing, and contributing to make Eleva even better. 🚀
16
50
 
17
51
  ---
18
52
 
19
53
  ## Table of Contents
20
54
 
21
- - [Eleva](#eleva)
55
+ - [eleva.js 🚀](#elevajs-)
22
56
  - [Table of Contents](#table-of-contents)
23
57
  - [Introduction](#introduction)
24
58
  - [Design Philosophy](#design-philosophy)
@@ -50,50 +84,43 @@ Welcome to Eleva! This is my humble, experimental playground for a fresh approac
50
84
 
51
85
  ## Introduction
52
86
 
53
- Eleva is a lightweight, no-nonsense runtime framework for frontend applications. Built with love for **pure vanilla JavaScript**, Eleva lets you create highly modular and scalable applications without the overhead of large frameworks. I built Eleva to prove that you don't need to rely on heavy libraries to build amazing user interfacessometimes, the simplest approach is the most powerful.
87
+ Eleva is a lightweight, no-nonsense runtime framework for frontend applications. Built with love for **pure vanilla JavaScript**, Eleva features a minimal core with essential functionality that can be extended through a powerful plugin system. This approach lets you create highly modular and scalable applications without the overhead of large frameworks. I built Eleva to prove that you don't need heavy frameworks or libraries to build amazing user interfaces-sometimes, the simplest approach is the most powerful.
54
88
 
55
89
  **My Inspiration:**
56
- The idea and concept behind Eleva came from my deep appreciation for native JavaScript. I wanted to create a tool that stays true to the language without introducing new syntax or complexity, making it easy for you to integrate into your projects without a steep learning curve.
90
+ The idea behind Eleva comes from a deep appreciation for native JavaScript. I wanted to create a tool that stays true to the language without introducing new syntax or complexity, making it easy to integrate into your projects.
57
91
 
58
92
  **Core Principles:**
59
93
 
60
- - **🌱 Minimalism:** Only the essentials, so you can build without the clutter.
61
- - **🔌 Extensibility:** Plug in your own ideascustom state management, routing, and more.
94
+ - **🌱 Minimalism:** Only essential features in the core, keeping the framework lean and focused.
95
+ - **🔌 Extensibility:** Extend functionality by plugging in your own ideas, such as custom state management, routing, and more.
62
96
  - **🚀 Performance:** Fast, efficient, and designed with modern browsers in mind.
63
- - **🍦 Pure Vanilla:** No dependencies, no magicjust plain JavaScript.
97
+ - **🍦 Pure Vanilla:** No dependencies, no magic-just plain JavaScript.
64
98
 
65
99
  ---
66
100
 
67
101
  ## Design Philosophy
68
102
 
69
- **Eleva is an unopinionated library.**
103
+ **Eleva is an unopinionated framework with a minimal core philosophy.**
70
104
 
71
- Unlike many frameworks that enforce a specific project structure or coding paradigm, Eleva provides a minimal core with a flexible plugin system. This means:
105
+ Unlike monolithic frameworks that include everything out-of-the-box, Eleva intentionally provides only essential features in its core, relying on a powerful plugin system for extensibility. This architectural choice means:
72
106
 
73
- - **🔄 Flexibility:** You’re free to architect your application as you see fit, without being forced into a rigid structure.
74
- - **🎯 Native JavaScript:** Eleva is built using pure vanilla JavaScript, so it integrates seamlessly with your existing code without introducing unfamiliar syntax.
75
- - **⚙️ Configurability:** With a simple API and optional plugins, you can extend Eleva's functionality to suit your project's unique requirements.
76
- - **🆓 Freedom:** You decide the best way to implement features, allowing for both simple and complex applications without unnecessary constraints.
107
+ - **🔄 Flexibility:** Architect your application your way-no rigid structure required.
108
+ - **🎯 Native JavaScript:** Built using pure vanilla JavaScript, Eleva integrates seamlessly with your existing code without unfamiliar syntax.
109
+ - **⚙️ Configurability:** Extend Eleva's functionality with a simple API and optional plugins.
110
+ - **🆓 Freedom:** Decide the best way to implement features without unnecessary constraints.
77
111
 
78
- This unopinionated approach makes Eleva versatile and ideal for developers who prefer to have full control over their application's design.
112
+ This unopinionated approach makes Eleva versatile and ideal for developers who want full control over their application's design.
79
113
 
80
114
  ---
81
115
 
82
116
  ## Handcrafted & Developer-Centric Design
83
117
 
84
- Eleva is built with a meticulous attention to detail and a deep passion for pure vanilla JavaScript. Every aspect of its design and architecture has been carefully handcrafted with the developer in mind. This approach makes Eleva not only a fresh and innovative choice but also a solid foundation for your projects.
85
-
86
- - **🎨 Craftsmanship:**
87
- Every line of code in Eleva is written with care, ensuring that the library remains lightweight, efficient, and easy to understand.
88
-
89
- - **🛠️ Developer-Centric:**
90
- Eleva is designed for you—the developer. Its intuitive API and minimalistic core mean you spend less time wrestling with the framework and more time building your application.
91
-
92
- - **🌟 Innovative & Fresh:**
93
- By sticking to pure vanilla JavaScript and avoiding unnecessary abstractions, Eleva offers a refreshing alternative to the complex and opinionated frameworks out there.
118
+ Eleva is built with meticulous attention to detail and a deep passion for pure vanilla JavaScript. Every aspect of its design and architecture is handcrafted with the developer in mind. This makes Eleva not only innovative but also a solid foundation for your projects.
94
119
 
95
- - **🏗️ Solid & Reliable:**
96
- With a focus on performance and modularity, Eleva provides a robust yet flexible platform that scales with your project's needs.
120
+ - **🎨 Craftsmanship:** Every line of code is written with care, keeping the framework lightweight, efficient, and easy to understand.
121
+ - **🛠️ Developer-Centric:** Its intuitive API and minimal core mean you spend less time wrestling with the framework and more time building your application.
122
+ - **🌟 Innovative & Fresh:** Stick to pure vanilla JavaScript and avoid unnecessary abstractions.
123
+ - **🏗️ Solid & Reliable:** Focused on performance and modularity, Eleva scales with your project's needs.
97
124
 
98
125
  This unique, developer-first approach makes Eleva a standout choice for building high-performance frontend applications without compromising on simplicity or control.
99
126
 
@@ -101,40 +128,31 @@ This unique, developer-first approach makes Eleva a standout choice for building
101
128
 
102
129
  ## Features
103
130
 
104
- - **🧩 Component-Based Architecture:** Create reusable UI components effortlessly.
105
- - **⚡ Signal-Based Reactivity:** Fine-grained reactivity that updates only whats needed.
106
- - **🔔 Event Handling:** Built-in event emitter for robust inter-component communication.
107
- - **📝 Template Parsing:** Secure and dynamic interpolation with a custom TemplateEngine.
108
- - **🔄 DOM Diffing & Patching:** High-performance updates without a virtual DOM.
109
- - **📦 UMD & ES Module Builds:** Designed for the browser, with modern build tool support.
110
- - **🤝 Friendly API:** A gentle learning curve for both beginners and seasoned developers.
111
- - **💎 Tiny Footprint & TypeScript Support:** At a fraction of the size of many mainstream frameworks (~4 KB minified) and with built-in TypeScript declarations, Eleva keeps your bundle lean and your codebase strongly typed.
131
+ - **🧩 Component-Based Architecture:** Create reusable UI components with a rich context API
132
+ - **⚡ Signal-Based Reactivity:** Fine-grained reactivity that updates only what's needed
133
+ - **🔔 Event Handling:** Built-in event emitter for robust inter-component communication
134
+ - **📝 Template Parsing:** Secure and dynamic interpolation with a custom TemplateEngine
135
+ - **🔄 DOM Diffing & Patching:** High-performance updates without a virtual DOM
136
+ - **🔄 Lifecycle Hooks:** Complete lifecycle management with before/after mount and update hooks
137
+ - **🧹 Automatic Cleanup:** Proper cleanup of resources, watchers, and child components on unmount
138
+ - **🔌 Plugin System:** Extensible architecture with a simple plugin API
139
+ - **📦 UMD & ES Module Builds:** Supports modern build tools and browser environments
140
+ - **🤝 Friendly API:** A gentle learning curve for both beginners and seasoned developers
141
+ - **💎 Tiny Footprint & TypeScript Support:** Approximately ~6 KB minified with built-in TypeScript declarations
112
142
 
113
143
  ---
114
144
 
115
145
  ## When to Use Eleva
116
146
 
117
- Eleva is designed for developers who want a lightweight, flexible, and high-performance solution for building frontend applications. Here are some scenarios where Eleva shines:
147
+ Eleva is ideal for developers seeking a lightweight, flexible, and high-performance solution for building frontend applications. Here are some scenarios where Eleva shines:
118
148
 
119
- - **🚀 Small to Medium Projects:**
120
- If you're building a web app or website that doesn't require the overhead of a full-fledged framework, Eleva’s minimal footprint (~4 KB minified) keeps your project fast and efficient.
121
-
122
- - **⚡ Performance-Critical Applications:**
123
- For projects where speed and low bundle size are paramount, Eleva's optimized reactivity and DOM diffing ensure your app runs smoothly without unnecessary bloat.
124
-
125
- - **🔄 Unopinionated and Flexible Design:**
126
- Eleva is unopinionated, meaning it doesn't force you into a rigid structure. You can architect your application your way while enjoying a straightforward API and a flexible plugin system.
127
-
128
- - **🎯 Developer-Friendly & Native JavaScript:**
129
- If you prefer working with pure vanilla JavaScript without the need to learn new syntax or complex abstractions, Eleva is built with you in mind. Plus, it comes with built-in TypeScript declarations for strong type support.
130
-
131
- - **🧪 Rapid Prototyping & Experimentation:**
132
- Eleva's simplicity and ease of integration make it a great choice for prototyping ideas quickly. Its modular architecture means you can start small and extend the functionality as your project evolves.
133
-
134
- - **🔌 Extensibility through Plugins:**
135
- With a robust plugin system, Eleva can be easily extended to include features like routing, state management, or custom behaviors, making it suitable for both simple and complex applications.
136
-
137
- In short, if you're looking for a solid, developer-centric framework that provides high performance, simplicity, and the freedom to build your application your way, Eleva is an excellent choice.
149
+ - **🚀 Small to Medium Projects:** Perfect for web apps or websites that don't require the overhead of a full-fledged framework.
150
+ - **⚡ Performance-Critical Applications:** Optimized reactivity and DOM diffing ensure smooth performance without bloat.
151
+ - **🔄 Unopinionated & Flexible:** Architect your application your way with a straightforward API and plugin system.
152
+ - **🎯 Developer-Friendly:** Stick to pure vanilla JavaScript with familiar syntax and built-in TypeScript support.
153
+ - **🧪 Rapid Prototyping:** Quickly prototype ideas with a minimal and extendable framework.
154
+ - **🔌 Extensible:** Easily add features like routing or state management through plugins.
155
+ - **📦 Module Format Flexibility:** Choose from ESM, CommonJS, or UMD formats based on your project's needs.
138
156
 
139
157
  ---
140
158
 
@@ -142,80 +160,86 @@ In short, if you're looking for a solid, developer-centric framework that provid
142
160
 
143
161
  I believe in clear versioning that reflects the maturity of the project:
144
162
 
145
- - **Pre-release Versions (Alpha/Beta):** Early versions like `1.0.0-alpha` signal that the API is still evolving. Expect frequent updates, and please share your feedback!
146
- - **Semantic Versioning:** Once the API stabilizes, I'll follow semantic versioning strictly so that any breaking changes are clearly communicated.
147
- - **Fresh Start:** Since this is a complete overhaul and a fresh start, `1.0.0-alpha` represents my first major step forward.
163
+ - **Pre-release Versions (Alpha/Beta):** Early versions like `1.2.0-alpha` indicate the API is still evolving. Expect frequent updates and share your feedback!
164
+ - **Semantic Versioning:** Once stable, I'll follow semantic versioning strictly to clearly communicate any breaking changes.
165
+ - **Fresh Start:** This release (`1.2.0-alpha`) marks a significant update with enhanced inline documentation, improved JSDoc annotations, and a refined mounting context that now includes an `emitter` property.
148
166
 
149
167
  ---
150
168
 
151
169
  ## Version Guide
152
170
 
153
- I follow [Semantic Versioning (SemVer)](https://semver.org/) to manage Eleva's releases. Here's a quick guide to help you understand the version numbers:
154
-
155
- - **🔢 Major Version:**
156
- A change in the first digit (e.g., from `1.0.0` to `2.0.0`) indicates breaking changes or a major overhaul of the framework.
157
- - **🔢 Minor Version:**
158
- A change in the second digit (e.g., from `1.0.0` to `1.1.0`) signifies the addition of new features in a backward-compatible manner.
159
- - **🔢 Patch Version:**
160
- A change in the third digit (e.g., from `1.0.0` to `1.0.1`) reflects backward-compatible bug fixes and minor improvements.
161
- - **📌 Pre-release Identifiers:**
162
- Suffixes like `-alpha`, `-beta`, or `-rc` indicate that the release is not yet stable. For example, `1.0.0-alpha` means this is an experimental version of the upcoming stable `1.0.0` release.
171
+ I follow [Semantic Versioning (SemVer)](https://semver.org/):
163
172
 
164
- This guide is intended to help you understand what to expect with each release and how Eleva is evolving over time.
173
+ - **🔢 Major Version:** Breaking changes or major overhauls (e.g., from `1.0.0` to `2.0.0`).
174
+ - **🔢 Minor Version:** New features in a backward-compatible manner (e.g., from `1.1.0` to `1.2.0`).
175
+ - **🔢 Patch Version:** Backward-compatible bug fixes and minor improvements (e.g., `1.0.1`).
176
+ - **📌 Pre-release Identifiers:** Suffixes like `-alpha`, `-beta`, or `-rc` denote unstable releases (e.g., `1.2.0-alpha`).
165
177
 
166
178
  ---
167
179
 
168
180
  ## Performance
169
181
 
170
- Eleva is crafted with performance in mind:
182
+ Eleva is crafted for performance:
171
183
 
172
- - **Lightweight:** Designed to be ~4 KB minified so your app stays nimble.
173
- - **Efficient Reactivity:** Signal-based updates ensure only the necessary parts of the DOM are re-rendered.
174
- - **Optimized Diffing:** The Renderer efficiently patches changes without the overhead of a virtual DOM.
175
- - **No Bloat:** Pure vanilla JavaScript means no unnecessary dependencies slowing you down.
184
+ - **Lightweight:** Approximately ~6 KB minified and ~2 KB gzipped.
185
+ - **Efficient Reactivity:** Signal-based updates ensure only necessary DOM parts are updated.
186
+ - **Optimized Diffing:** Renderer efficiently patches changes without the overhead of a virtual DOM.
187
+ - **No Bloat:** Pure vanilla JavaScript with zero dependencies keeps your project nimble.
188
+ - **Tree-Shakable:** ESM format allows bundlers to eliminate unused code.
189
+ - **Format-Specific Optimizations:** Each module format is optimized for its target environment.
176
190
 
177
191
  ---
178
192
 
179
193
  ## Performance Benchmarks
180
194
 
181
- I've run some preliminary benchmarks to give you a rough idea of how Eleva stacks up against some popular frontend frameworks. These tests focus on bundle size, initial load time, and DOM update performance using a simple counter component scenario.
195
+ Preliminary benchmarks illustrate Eleva's efficiency compared to popular frameworks:
182
196
 
183
- | Framework | Bundle Size (minified) | Initial Load Time | DOM Update Speed |
184
- | --------- | ---------------------- | ----------------- | ---------------- |
185
- | **Eleva** | ~4 KB | ~35 ms | ~2 ms |
186
- | React | ~110 KB | ~100 ms | ~4 ms |
187
- | Vue | ~80 KB | ~80 ms | ~3 ms |
188
- | Angular | ~500 KB | ~250 ms | ~6 ms |
197
+ | **Framework** | **Bundle Size** (KB) | **Initial Load Time** (ms) | **DOM Update Speed** (s) | **Peak Memory Usage** (KB) | **Overall Performance Score** (lower is better) |
198
+ | ----------------------------- | -------------------- | -------------------------- | ------------------------ | -------------------------- | ----------------------------------------------- |
199
+ | **Eleva** (Direct DOM) | **2** | **0.05** | **0.002** | **0.25** | **0.58 (Best)** |
200
+ | **React** (Virtual DOM) | 4.1 | 5.34 | 0.020 | 0.25 | 9.71 |
201
+ | **Vue** (Reactive State) | 45 | 4.72 | 0.021 | 3.10 | 13.21 |
202
+ | **Angular** (Two-way Binding) | 62 | 5.26 | 0.021 | 0.25 | 16.88 (Slowest) |
189
203
 
190
- > ⚠️ **Disclaimer:** These benchmarks are based on internal tests with a minimalistic counter component and may vary depending on project specifics and environments. They serve as a general indicator of Eleva’s lightweight and high-performance design.
204
+ Detailed [Benchmark Metrics Report](BENCHMARK.md)
205
+
206
+ > ⚠️ **Disclaimer:** Benchmarks are based on internal tests and may vary by project and environment.
191
207
 
192
208
  ---
193
209
 
194
210
  ## Eleva vs. Popular Frameworks
195
211
 
196
- While frameworks like React, Vue, and Angular are powerful, Eleva offers a refreshing alternative:
212
+ Eleva offers a refreshing alternative to frameworks like React, Vue, and Angular:
197
213
 
198
- - **Simplicity:** No virtual DOM, no JSX, and no complex state managementjust plain JavaScript.
199
- - **Modularity:** Easily extend Eleva with plugins to fit your project's needs.
200
- - **Size:** At a fraction of the size of many mainstream frameworks, Eleva is perfect for projects where performance is key.
201
- - **Learning Curve:** With a familiar syntax and a clear API, Eleva is ideal for developers of all levels.
214
+ - **Simplicity:** No virtual DOM, JSX, or complex state management-just plain JavaScript.
215
+ - **Modularity:** Easily extend via plugins to suit your project's needs.
216
+ - **Size:** A fraction of the size of mainstream frameworks.
217
+ - **Learning Curve:** Familiar syntax and a clear API make it accessible to all developers.
202
218
 
203
- **Important:** Eleva is not trying to replace these giants but rather offers a lightweight option when you want to keep things simple and fast without introducing new syntax or unnecessary complexity. 🌟
219
+ _Note:_ Eleva isn't trying to replace these giants but provides a lightweight option when you want simplicity and speed. 🌟
204
220
 
205
221
  ---
206
222
 
207
223
  ## Installation
208
224
 
209
- Eleva is available on npm. Since it's in alpha, I'm excited to have you try it out and share your thoughts!
225
+ Eleva is available on npm. Try it out and share your thoughts!
210
226
 
211
227
  ```bash
212
228
  npm install eleva
213
229
  ```
214
230
 
215
- Or include it directly in your HTML via CDN:
231
+ Or include it directly via CDN:
216
232
 
217
233
  ```html
218
- <script src="https://unpkg.com/eleva/dist/eleva.min.js"></script>
234
+ <!-- jsDelivr (Recommended) -->
235
+ <script src="https://cdn.jsdelivr.net/npm/eleva"></script>
236
+ ```
237
+
238
+ or
239
+
240
+ ```html
241
+ <!-- unpkg -->
242
+ <script src="https://unpkg.com/eleva"></script>
219
243
  ```
220
244
 
221
245
  ---
@@ -226,33 +250,46 @@ Or include it directly in your HTML via CDN:
226
250
 
227
251
  ```js
228
252
  // Import Eleva (using ES modules)
229
- import { Eleva } from "eleva";
253
+ import Eleva from "eleva";
230
254
 
231
255
  // Create a new Eleva instance
232
256
  const app = new Eleva("MyApp");
233
257
 
234
258
  // Define a component
235
259
  app.component("HelloWorld", {
260
+ // The setup method is optional; if omitted, an empty state is used.
236
261
  setup({ signal }) {
237
262
  const count = signal(0);
238
- return { count };
263
+ return {
264
+ count,
265
+ onMount: ({ container, context }) => {
266
+ console.log('Component mounted!');
267
+ }
268
+ };
239
269
  },
240
270
  template: ({ count }) => `
241
271
  <div>
242
272
  <h1>Hello, Eleva! 👋</h1>
243
- <p>Count: ${count}</p>
244
- <button @click="() => count++">Increment</button>
273
+ <p>Count: ${count.value}</p>
274
+ <button @click="() => count.value++">Increment</button>
245
275
  </div>
246
- `,
276
+ `
247
277
  });
248
278
 
249
- // Mount the component to a DOM element with the id 'app'
250
- app.mount("#app", "HelloWorld");
279
+ // Mount the component and handle the Promise
280
+ app.mount(document.getElementById("app"), "HelloWorld")
281
+ .then(instance => {
282
+ console.log("Component mounted:", instance);
283
+ // Later...
284
+ // instance.unmount();
285
+ });
251
286
  ```
252
287
 
288
+ Interactive Demo: [CodePen](https://codepen.io/tarekraafat/pen/GgRrxdY?editors=1010)
289
+
253
290
  ### UMD Example
254
291
 
255
- Include Eleva via a script tag, and it will be available as a global variable:
292
+ Include Eleva via a script tag and use the global variable:
256
293
 
257
294
  ```html
258
295
  <!DOCTYPE html>
@@ -263,7 +300,7 @@ Include Eleva via a script tag, and it will be available as a global variable:
263
300
  </head>
264
301
  <body>
265
302
  <div id="app"></div>
266
- <script src="https://unpkg.com/eleva/dist/eleva.min.js"></script>
303
+ <script src="https://cdn.jsdelivr.net/npm/eleva"></script>
267
304
  <script>
268
305
  const app = new Eleva("MyApp");
269
306
  app.component("HelloWorld", {
@@ -272,56 +309,58 @@ Include Eleva via a script tag, and it will be available as a global variable:
272
309
  return { count };
273
310
  },
274
311
  template: ({ count }) => `
275
- <div>
276
- <h1>Hello, Eleva! 👋</h1>
277
- <p>Count: ${count}</p>
278
- <button @click="() => count++">Increment</button>
279
- </div>
280
- `,
312
+ <div>
313
+ <h1>Hello, Eleva! 👋</h1>
314
+ <p>Count: ${count.value}</p>
315
+ <button @click="() => count.value++">Increment</button>
316
+ </div>
317
+ `,
281
318
  });
282
- app.mount("#app", "HelloWorld");
319
+ app.mount(document.getElementById("app"), "HelloWorld");
283
320
  </script>
284
321
  </body>
285
322
  </html>
286
323
  ```
287
324
 
325
+ Interactive Demo: [CodePen](https://codepen.io/tarekraafat/pen/jEOyzYN?editors=1010)
326
+
288
327
  ---
289
328
 
290
329
  ## API Reference
291
330
 
292
331
  ### TemplateEngine
293
332
 
294
- - **`TemplateEngine.parse(template, data)`**
333
+ - **`TemplateEngine.parse(template, data)`**
295
334
  Replaces `{{ expression }}` patterns in the template with evaluated values.
296
- - **`TemplateEngine.evaluate(expr, data)`**
335
+ - **`TemplateEngine.evaluate(expr, data)`**
297
336
  Safely evaluates JavaScript expressions within a given context.
298
337
 
299
338
  ### Signal
300
339
 
301
- - **`new Signal(value)`**
340
+ - **`new Signal(initialValue)`**
302
341
  Creates a reactive data holder.
303
- - **`.value` (getter/setter)**
342
+ - **`.value` (getter/setter)**
304
343
  Get or update the current value and trigger watchers.
305
- - **`.watch(fn)`**
344
+ - **`.watch(callback)`**
306
345
  Registers a function to run when the value updates.
307
346
 
308
347
  ### Emitter
309
348
 
310
- - **`.on(event, handler)`**
349
+ - **`new Emitter()`**
350
+ Creates an Emitter instance.
351
+ - **`.on(event, handler)`**
311
352
  Listen to events.
312
- - **`.off(event, handler)`**
353
+ - **`.off(event, handler)`**
313
354
  Remove event listeners.
314
- - **`.emit(event, ...args)`**
355
+ - **`.emit(event, ...args)`**
315
356
  Trigger events with additional arguments.
316
357
 
317
358
  ### Renderer
318
359
 
319
- - **`patchDOM(container, newHtml)`**
320
- Efficiently update the DOM.
321
- - **`diff(oldParent, newParent)`**
322
- Compare and update DOM trees.
323
- - **`updateAttributes(oldEl, newEl)`**
324
- Sync element attributes.
360
+ - **`new Renderer()`**
361
+ Creates a Renderer instance.
362
+ - **`.patchDOM(container, newHtml)`**:
363
+ Updates container content with the new HTML.
325
364
 
326
365
  ### Eleva (Core)
327
366
 
@@ -331,16 +370,16 @@ Include Eleva via a script tag, and it will be available as a global variable:
331
370
  Install plugins.
332
371
  - **`.component(name, definition)`**
333
372
  Register a component.
334
- - **`.mount(selectorOrElement, compName, props)`**
373
+ - **`.mount(container, compName, props)`**
335
374
  Mount a component to the DOM.
336
375
 
337
- For detailed API documentation, please check the [docs](docs/) folder.
376
+ For detailed API documentation, please check the [docs](docs/index.md) folder.
338
377
 
339
378
  ---
340
379
 
341
380
  ## Development
342
381
 
343
- I welcome developers to dive in and play around with Eleva! Here's how you can get started locally:
382
+ I welcome developers to dive in and experiment with Eleva! Here's how to get started locally:
344
383
 
345
384
  1. **Clone the Repository:**
346
385
 
@@ -361,7 +400,7 @@ I welcome developers to dive in and play around with Eleva! Here's how you can g
361
400
  npm run dev
362
401
  ```
363
402
 
364
- 4. **Build for Production:**
403
+ 4. **Build for Production without TypeScript Declarations:**
365
404
 
366
405
  ```bash
367
406
  npm run build
@@ -374,23 +413,29 @@ I welcome developers to dive in and play around with Eleva! Here's how you can g
374
413
  npm run build:types:bundle
375
414
  ```
376
415
 
416
+ 6. **Build for Production with TypeScript Declarations:**
417
+
418
+ ```bash
419
+ npm run build:all
420
+ ```
421
+
377
422
  ---
378
423
 
379
424
  ## Testing
380
425
 
381
- I use Jest for tests. Run the test suite with:
426
+ I use Jest for testing. Run the test suite with:
382
427
 
383
428
  ```bash
384
429
  npm test
385
430
  ```
386
431
 
387
- Your contributions to tests are very welcome! 🧪
432
+ Contributions to tests are very welcome! 🧪
388
433
 
389
434
  ---
390
435
 
391
436
  ## Contributing
392
437
 
393
- Id love to have you onboard as a contributor! Whether youre adding new features, squashing bugs, or sharing ideas, your input is invaluable. Please check out [CONTRIBUTING](CONTRIBUTING.md) for details on how to get started.
438
+ I'd love to have you onboard as a contributor! Whether you're adding new features, squashing bugs, or sharing ideas, your input is invaluable. Please check out [CONTRIBUTING](CONTRIBUTING.md) for guidelines on getting started.
394
439
 
395
440
  ---
396
441
 
@@ -408,11 +453,15 @@ Eleva is open-source and available under the [MIT License](LICENSE).
408
453
 
409
454
  ---
410
455
 
411
- **Note:** This is an alpha release. I'm still polishing things up, so expect some bumps along the way. Your feedback and contributions will help shape Eleva into something truly amazing. Lets build something great together! 💪✨
456
+ **Note:** This is a beta release. I'm still polishing things up, so expect some bumps along the way. Your feedback and contributions will help shape Eleva into something truly amazing. Let's build something great together! 💪✨
457
+
458
+ ---
459
+
460
+ [![NPM](https://nodei.co/npm/eleva.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/eleva/)
412
461
 
413
462
  ---
414
463
 
415
464
  [Documentation](/docs/index.md) |
416
465
  [Examples](/examples) |
417
- [Changelog](https://github.com/TarekRaafat/eleva/changelog) |
466
+ [Changelog](/CHANGELOG.md) |
418
467
  [GitHub Discussions](https://github.com/TarekRaafat/eleva/discussions)