eleva 1.0.0-rc.9 โ 1.0.0
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 +199 -68
- package/dist/eleva-plugins.cjs.js +1862 -2108
- package/dist/eleva-plugins.cjs.js.map +1 -1
- package/dist/eleva-plugins.esm.js +1863 -2108
- package/dist/eleva-plugins.esm.js.map +1 -1
- package/dist/eleva-plugins.umd.js +1862 -2108
- package/dist/eleva-plugins.umd.js.map +1 -1
- package/dist/eleva-plugins.umd.min.js +1 -2
- package/dist/eleva-plugins.umd.min.js.map +1 -1
- package/dist/eleva.cjs.js +930 -642
- package/dist/eleva.cjs.js.map +1 -1
- package/dist/eleva.d.ts +580 -151
- package/dist/eleva.esm.js +930 -642
- package/dist/eleva.esm.js.map +1 -1
- package/dist/eleva.umd.js +930 -642
- package/dist/eleva.umd.js.map +1 -1
- package/dist/eleva.umd.min.js +1 -2
- package/dist/eleva.umd.min.js.map +1 -1
- package/dist/plugins/attr.umd.js +118 -153
- package/dist/plugins/attr.umd.js.map +1 -1
- package/dist/plugins/attr.umd.min.js +1 -2
- package/dist/plugins/attr.umd.min.js.map +1 -1
- package/dist/plugins/router.umd.js +1320 -852
- package/dist/plugins/router.umd.js.map +1 -1
- package/dist/plugins/router.umd.min.js +1 -2
- package/dist/plugins/router.umd.min.js.map +1 -1
- package/dist/plugins/store.umd.js +414 -497
- package/dist/plugins/store.umd.js.map +1 -1
- package/dist/plugins/store.umd.min.js +1 -2
- package/dist/plugins/store.umd.min.js.map +1 -1
- package/package.json +56 -33
- package/src/core/Eleva.js +238 -49
- package/src/modules/Emitter.js +103 -14
- package/src/modules/Renderer.js +214 -132
- package/src/modules/Signal.js +94 -29
- package/src/modules/TemplateEngine.js +93 -34
- package/src/plugins/Attr.js +10 -12
- package/src/plugins/Router.js +775 -70
- package/src/plugins/Store.js +5 -2
- package/src/plugins/index.js +1 -1
- package/types/core/Eleva.d.ts +212 -53
- package/types/core/Eleva.d.ts.map +1 -1
- package/types/modules/Emitter.d.ts +111 -12
- package/types/modules/Emitter.d.ts.map +1 -1
- package/types/modules/Renderer.d.ts +101 -39
- package/types/modules/Renderer.d.ts.map +1 -1
- package/types/modules/Signal.d.ts +96 -19
- package/types/modules/Signal.d.ts.map +1 -1
- package/types/modules/TemplateEngine.d.ts +87 -28
- package/types/modules/TemplateEngine.d.ts.map +1 -1
- package/types/plugins/Attr.d.ts +1 -0
- package/types/plugins/Attr.d.ts.map +1 -1
- package/types/plugins/Router.d.ts +627 -127
- package/types/plugins/Router.d.ts.map +1 -1
- package/types/plugins/Store.d.ts +1 -0
- package/types/plugins/index.d.ts +0 -1
- package/dist/plugins/props.umd.js +0 -603
- package/dist/plugins/props.umd.js.map +0 -1
- package/dist/plugins/props.umd.min.js +0 -3
- package/dist/plugins/props.umd.min.js.map +0 -1
- package/src/plugins/Props.js +0 -590
- package/types/plugins/Props.d.ts +0 -48
- package/types/plugins/Props.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Eleva.js ๐
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Version:** `1.0.0` | **Size:** ~6KB min (~2.3KB gzip) | **Dependencies:** Zero | **TypeScript:** Yes
|
|
4
|
+
|
|
5
|
+
**Best DX for Building the Best UX** โ Pure JavaScript, Pure Performance, Simply Elegant.
|
|
4
6
|
|
|
5
7
|
[](https://opensource.org/licenses/MIT)
|
|
6
8
|
[](https://github.com/TarekRaafat/eleva)
|
|
@@ -11,22 +13,11 @@ Pure JavaScript, Pure Performance, Simply Elegant.
|
|
|
11
13
|
[](https://bundlephobia.com/package/eleva@latest)
|
|
12
14
|
[](https://bundlephobia.com/package/eleva@latest)
|
|
13
15
|
[](https://www.jsdelivr.com/package/npm/eleva)
|
|
14
|
-
[](https://canonical.com)
|
|
15
16
|
|
|
16
17
|
<br>
|
|
17
18
|
|
|
18
19
|
<p align="center">
|
|
19
|
-
<a href="https://tarekraafat.github.io/eleva/"><img src="./docs/imgs/eleva.js Full Logo.png" alt="
|
|
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>
|
|
20
|
+
<a href="https://tarekraafat.github.io/eleva/"><img src="./docs/imgs/eleva.js Full Logo.png" alt="Eleva.js - Lightweight JavaScript Framework Logo" width="50%"></a>
|
|
30
21
|
</p>
|
|
31
22
|
|
|
32
23
|
<p align="center">
|
|
@@ -37,12 +28,10 @@ Pure JavaScript, Pure Performance, Simply Elegant.
|
|
|
37
28
|
<br>
|
|
38
29
|
<br>
|
|
39
30
|
|
|
40
|
-
**A minimalist, lightweight, pure vanilla JavaScript frontend runtime framework.**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
> **Stability Notice**: This is `v1.0.0-rc.9` - The core functionality is stable. Seeking community feedback before the final v1.0.0 release.
|
|
31
|
+
**A minimalist, lightweight, pure vanilla JavaScript frontend runtime framework.**
|
|
32
|
+
_Designed for the best Developer Experience (DX) to help you build exceptional User Experiences (UX). Built with love for native JavaScript and a minimal core that can be extended through a powerful plugin system โ because sometimes, less really is more!_ ๐
|
|
44
33
|
|
|
45
|
-
**
|
|
34
|
+
> **Stable Release**: This is `v1.0.0` - The first official stable release of Eleva.js!
|
|
46
35
|
|
|
47
36
|
|
|
48
37
|
|
|
@@ -50,13 +39,30 @@ Welcome to Eleva! This is my humble, experimental playground for a fresh approac
|
|
|
50
39
|
|
|
51
40
|
---
|
|
52
41
|
|
|
42
|
+
## What is Eleva.js?
|
|
43
|
+
|
|
44
|
+
**Eleva** is a minimalist, lightweight (6KB), pure vanilla JavaScript frontend framework crafted for **exceptional Developer Experience (DX)**. When developers enjoy building, users enjoy using โ Eleva makes it effortless to create beautiful, responsive, and performant User Interfaces (UI) without the complexity, bundle size, or build tool requirements of traditional frameworks.
|
|
45
|
+
|
|
46
|
+
Unlike React, Vue, or Angular, Eleva:
|
|
47
|
+
- **Has zero dependencies** - No node_modules bloat
|
|
48
|
+
- **Requires no build step** - Works directly in browsers via CDN
|
|
49
|
+
- **Uses real DOM** - No virtual DOM overhead for simple apps
|
|
50
|
+
- **Provides signal-based reactivity** - Fine-grained updates like Solid.js
|
|
51
|
+
- **Includes TypeScript support** - Built-in type declarations
|
|
52
|
+
|
|
53
|
+
Eleva is ideal for developers building lightweight web applications, prototypes, micro-frontends, or anyone seeking a simpler alternative to React, Vue, or Angular.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
53
57
|
## Table of Contents
|
|
54
58
|
|
|
55
|
-
- [
|
|
59
|
+
- [Eleva.js ๐](#elevajs-)
|
|
60
|
+
- [What is Eleva.js?](#what-is-elevajs)
|
|
56
61
|
- [Table of Contents](#table-of-contents)
|
|
62
|
+
- [Quick Reference](#quick-reference)
|
|
57
63
|
- [Introduction](#introduction)
|
|
58
64
|
- [Design Philosophy](#design-philosophy)
|
|
59
|
-
- [
|
|
65
|
+
- [Best-in-Class Developer Experience (DX)](#best-in-class-developer-experience-dx)
|
|
60
66
|
- [Features](#features)
|
|
61
67
|
- [When to Use Eleva](#when-to-use-eleva)
|
|
62
68
|
- [Version Strategy](#version-strategy)
|
|
@@ -64,6 +70,7 @@ Welcome to Eleva! This is my humble, experimental playground for a fresh approac
|
|
|
64
70
|
- [Performance](#performance)
|
|
65
71
|
- [Performance Benchmarks](#performance-benchmarks)
|
|
66
72
|
- [Eleva vs. Popular Frameworks](#eleva-vs-popular-frameworks)
|
|
73
|
+
- [Browser Support](#browser-support)
|
|
67
74
|
- [Installation](#installation)
|
|
68
75
|
- [Usage](#usage)
|
|
69
76
|
- [ES Module Example](#es-module-example)
|
|
@@ -76,9 +83,9 @@ Welcome to Eleva! This is my humble, experimental playground for a fresh approac
|
|
|
76
83
|
- [Eleva (Core)](#eleva-core)
|
|
77
84
|
- [Plugins](#plugins)
|
|
78
85
|
- [Core Framework Only (Lightweight)](#core-framework-only-lightweight)
|
|
79
|
-
- [
|
|
80
|
-
- [
|
|
81
|
-
- [
|
|
86
|
+
- [Attr Plugin](#attr-plugin)
|
|
87
|
+
- [Router Plugin](#router-plugin)
|
|
88
|
+
- [Store Plugin](#store-plugin)
|
|
82
89
|
- [Development](#development)
|
|
83
90
|
- [Testing](#testing)
|
|
84
91
|
- [Contributing](#contributing)
|
|
@@ -87,6 +94,48 @@ Welcome to Eleva! This is my humble, experimental playground for a fresh approac
|
|
|
87
94
|
|
|
88
95
|
---
|
|
89
96
|
|
|
97
|
+
## Quick Reference
|
|
98
|
+
|
|
99
|
+
### Minimal Setup (30 seconds)
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
import Eleva from "eleva";
|
|
103
|
+
|
|
104
|
+
const app = new Eleva("MyApp");
|
|
105
|
+
|
|
106
|
+
app.component("Counter", {
|
|
107
|
+
setup: ({ signal }) => ({ count: signal(0) }),
|
|
108
|
+
template: (ctx) => `<button @click="() => count.value++">${ctx.count.value}</button>`
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
app.mount(document.getElementById("app"), "Counter");
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### API at a Glance
|
|
115
|
+
|
|
116
|
+
| Method | Purpose |
|
|
117
|
+
|--------|---------|
|
|
118
|
+
| `new Eleva(name)` | Create app |
|
|
119
|
+
| `app.component(name, def)` | Register component |
|
|
120
|
+
| `app.mount(el, name)` | Mount to DOM |
|
|
121
|
+
| `app.use(plugin)` | Add plugin |
|
|
122
|
+
| `signal(value)` | Reactive state |
|
|
123
|
+
| `emitter.on/emit` | Events |
|
|
124
|
+
|
|
125
|
+
### Template Syntax
|
|
126
|
+
|
|
127
|
+
> **Quick Rule:** `${}` needs `ctx.` โ `@events` and `:props` don't.
|
|
128
|
+
|
|
129
|
+
| Syntax | Use | `ctx.`? |
|
|
130
|
+
|--------|-----|:-------:|
|
|
131
|
+
| `${expr}` | JS value interpolation | โ |
|
|
132
|
+
| `@click` | Event handler | โ |
|
|
133
|
+
| `:prop` | Pass to child | โ |
|
|
134
|
+
|
|
135
|
+
> **How it works:** Use `${ctx.value}` to interpolate values into your template. For `@events` and `:props`, expressions are evaluated against the component context directly โ no `ctx.` prefix needed. This allows cleaner syntax like `:user="userData"` instead of `:user="${ctx.userData}"`.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
90
139
|
## Introduction
|
|
91
140
|
|
|
92
141
|
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.
|
|
@@ -118,16 +167,27 @@ This unopinionated approach makes Eleva versatile and ideal for developers who w
|
|
|
118
167
|
|
|
119
168
|
---
|
|
120
169
|
|
|
121
|
-
##
|
|
170
|
+
## Best-in-Class Developer Experience (DX)
|
|
171
|
+
|
|
172
|
+
Eleva is built on a simple principle: **great DX leads to great UX**. When developers have intuitive tools, they build better interfaces. Every aspect of Eleva's design prioritizes your productivity and enjoyment.
|
|
173
|
+
|
|
174
|
+
**Why Eleva's DX Stands Out:**
|
|
122
175
|
|
|
123
|
-
|
|
176
|
+
| DX Feature | How It Helps You Build Better UX |
|
|
177
|
+
|------------|----------------------------------|
|
|
178
|
+
| **Zero Config** | Start building immediately โ no webpack, no bundlers, no setup |
|
|
179
|
+
| **Intuitive API** | Learn in minutes, master in hours โ more time for polishing UI |
|
|
180
|
+
| **Pure JavaScript** | No JSX, no compilation โ what you write is what runs |
|
|
181
|
+
| **Instant Feedback** | Signal-based reactivity shows changes immediately |
|
|
182
|
+
| **TypeScript Built-in** | Full autocomplete and type safety out of the box |
|
|
183
|
+
| **Tiny Bundle** | ~2.3KB gzipped means instant page loads for your users |
|
|
124
184
|
|
|
125
185
|
- **๐จ Craftsmanship:** Every line of code is written with care, keeping the framework lightweight, efficient, and easy to understand.
|
|
126
|
-
- **๐ ๏ธ Developer-
|
|
127
|
-
- **๐
|
|
128
|
-
- **๐๏ธ
|
|
186
|
+
- **๐ ๏ธ Developer-First:** Intuitive API and minimal core mean you spend less time wrestling with the framework and more time perfecting your UI.
|
|
187
|
+
- **๐ No Magic:** Pure vanilla JavaScript with no hidden abstractions โ debug easily, ship confidently.
|
|
188
|
+
- **๐๏ธ Scales With You:** From prototype to production, Eleva grows with your project without added complexity.
|
|
129
189
|
|
|
130
|
-
|
|
190
|
+
> _"The best UX comes from developers who love their tools."_ โ Eleva's DX philosophy
|
|
131
191
|
|
|
132
192
|
---
|
|
133
193
|
|
|
@@ -141,7 +201,7 @@ This unique, developer-first approach makes Eleva a standout choice for building
|
|
|
141
201
|
- **๐ Lifecycle Hooks:** Complete lifecycle management with before/after mount and update hooks
|
|
142
202
|
- **๐งน Automatic Cleanup:** Proper cleanup of resources, watchers, and child components on unmount
|
|
143
203
|
- **๐ Plugin System:** Extensible architecture with a simple plugin API
|
|
144
|
-
- **๐ฏ Built-in Plugins:**
|
|
204
|
+
- **๐ฏ Built-in Plugins:** Attr for advanced attributes, Router for client-side routing, and Store for reactive state management
|
|
145
205
|
- **๐ฆ UMD & ES Module Builds:** Supports modern build tools and browser environments
|
|
146
206
|
- **๐ค Friendly API:** A gentle learning curve for both beginners and seasoned developers
|
|
147
207
|
- **๐ Tiny Footprint & TypeScript Support:** Approximately ~6 KB minified with built-in TypeScript declarations
|
|
@@ -158,9 +218,9 @@ Eleva is ideal for developers seeking a lightweight, flexible, and high-performa
|
|
|
158
218
|
- **๐ฏ Developer-Friendly:** Stick to pure vanilla JavaScript with familiar syntax and built-in TypeScript support.
|
|
159
219
|
- **๐งช Rapid Prototyping:** Quickly prototype ideas with a minimal and extendable framework.
|
|
160
220
|
- **๐ Extensible:** Easily add features like routing or state management through plugins.
|
|
161
|
-
- **๐ Built-in Routing:** Advanced client-side routing with navigation guards and reactive state via
|
|
162
|
-
- **๐ฏ Advanced Attributes:** Sophisticated attribute handling with ARIA support via
|
|
163
|
-
- **๐ช Reactive State Management:** Centralized, reactive data store with persistence and namespacing via
|
|
221
|
+
- **๐ Built-in Routing:** Advanced client-side routing with navigation guards and reactive state via Router plugin.
|
|
222
|
+
- **๐ฏ Advanced Attributes:** Sophisticated attribute handling with ARIA support via Attr plugin.
|
|
223
|
+
- **๐ช Reactive State Management:** Centralized, reactive data store with persistence and namespacing via Store plugin.
|
|
164
224
|
- **๐ฆ Module Format Flexibility:** Choose from ESM, CommonJS, or UMD formats based on your project's needs.
|
|
165
225
|
|
|
166
226
|
---
|
|
@@ -169,9 +229,8 @@ Eleva is ideal for developers seeking a lightweight, flexible, and high-performa
|
|
|
169
229
|
|
|
170
230
|
I believe in clear versioning that reflects the maturity of the project:
|
|
171
231
|
|
|
172
|
-
- **
|
|
173
|
-
- **Semantic Versioning:**
|
|
174
|
-
- **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.
|
|
232
|
+
- **Stable Versions:** Version `1.0.0` and above follow semantic versioning with full backward compatibility guarantees within major versions.
|
|
233
|
+
- **Semantic Versioning:** Eleva follows semantic versioning strictly to clearly communicate any breaking changes.
|
|
175
234
|
|
|
176
235
|
---
|
|
177
236
|
|
|
@@ -190,7 +249,7 @@ I follow [Semantic Versioning (SemVer)](https://semver.org/):
|
|
|
190
249
|
|
|
191
250
|
Eleva is crafted for performance:
|
|
192
251
|
|
|
193
|
-
- **Lightweight:** Approximately ~6 KB minified and ~2 KB gzipped.
|
|
252
|
+
- **Lightweight:** Approximately ~6 KB minified and ~2.3 KB gzipped.
|
|
194
253
|
- **Efficient Reactivity:** Signal-based updates ensure only necessary DOM parts are updated.
|
|
195
254
|
- **Optimized Diffing:** Renderer efficiently patches changes without the overhead of a virtual DOM.
|
|
196
255
|
- **No Bloat:** Pure vanilla JavaScript with zero dependencies keeps your project nimble.
|
|
@@ -201,23 +260,47 @@ Eleva is crafted for performance:
|
|
|
201
260
|
|
|
202
261
|
## Performance Benchmarks
|
|
203
262
|
|
|
204
|
-
|
|
263
|
+
Benchmarks using [js-framework-benchmark](https://krausest.github.io/js-framework-benchmark/) methodology (1,000 rows):
|
|
205
264
|
|
|
206
|
-
| **Framework** | **Bundle Size
|
|
207
|
-
| ----------------------------- |
|
|
208
|
-
| **Eleva** (Direct DOM) |
|
|
209
|
-
| **React** (Virtual DOM)
|
|
210
|
-
| **Vue** (Reactive
|
|
211
|
-
| **Angular** (
|
|
265
|
+
| **Framework** | **Bundle Size (min+gzip)** | **Create 1K Rows** (ms) | **Partial Update** (ms) | **Memory** (MB)* |
|
|
266
|
+
| ----------------------------- | -------------------------- | ----------------------- | ----------------------- | ---------------- |
|
|
267
|
+
| **Eleva** (Direct DOM) | **~2.3 KB** | **~25** | ~86 | **~0.5** (Chrome) |
|
|
268
|
+
| **React 19** (Virtual DOM) | ~44 KB | 40-70 | 10-20 | 2-5 |
|
|
269
|
+
| **Vue 3.5** (Reactive) | ~35 KB | 25-45 | 5-15 | 2-4 |
|
|
270
|
+
| **Angular 19** (Signals) | ~90 KB | 50-80 | 15-25 | 3-6 |
|
|
212
271
|
|
|
213
|
-
|
|
272
|
+
**Eleva's Strengths:**
|
|
273
|
+
- **Smallest bundle size** (~2.3 KB vs 35-90 KB)
|
|
274
|
+
- **Competitive initial render** (~25ms for 1K rows)
|
|
275
|
+
- **Zero dependencies** and minimal runtime overhead
|
|
276
|
+
- **Direct DOM diffing** without virtual DOM overhead
|
|
214
277
|
|
|
215
|
-
|
|
278
|
+
**Performance Tips:**
|
|
279
|
+
- Use `key` attribute on list items for optimal diffing
|
|
280
|
+
- Eleva excels at initial renders and memory efficiency
|
|
281
|
+
- For large lists (10K+ rows), use [virtual scrolling](./docs/examples/patterns/lists.md#virtual-scrolling) for **5.5x less memory** and **10x faster creation**
|
|
282
|
+
- See [Large List Performance](./docs/examples/patterns/best-practices.md#large-list-performance) for detailed patterns and benchmarks
|
|
283
|
+
|
|
284
|
+
> ๐ก **Run benchmarks yourself:** `bun run test:benchmark` | [Detailed benchmark results](./test/__results__/performance/BENCHMARKS.md)
|
|
216
285
|
|
|
217
286
|
---
|
|
218
287
|
|
|
219
288
|
## Eleva vs. Popular Frameworks
|
|
220
289
|
|
|
290
|
+
How does Eleva compare to popular JavaScript frameworks like React, Vue, Svelte, and Angular?
|
|
291
|
+
|
|
292
|
+
| Feature | Eleva 1.0 | React 19 | Vue 3.5 | Svelte 5 | Angular 19 |
|
|
293
|
+
|---------|-----------|----------|---------|----------|------------|
|
|
294
|
+
| **Bundle Size** | ~6KB | ~44KB | ~45KB | ~3KB* | ~90KB |
|
|
295
|
+
| **Dependencies** | 0 | 3+ | 0 | 0 | 10+ |
|
|
296
|
+
| **Virtual DOM** | No | Yes | Yes | No | No |
|
|
297
|
+
| **Reactivity** | Signals | useState/Hooks | Refs/Reactive | Compiler | Zone.js |
|
|
298
|
+
| **TypeScript** | Built-in | Optional | Optional | Built-in | Built-in |
|
|
299
|
+
| **Build Required** | No | Yes | Optional | Yes | Yes |
|
|
300
|
+
| **Learning Curve** | Low | Medium | Medium | Low | High |
|
|
301
|
+
|
|
302
|
+
_*Svelte compiles away, so runtime is minimal but build step is required._
|
|
303
|
+
|
|
221
304
|
Eleva offers a refreshing alternative to frameworks like React, Vue, and Angular:
|
|
222
305
|
|
|
223
306
|
- **Simplicity:** No virtual DOM, JSX, or complex state management-just plain JavaScript.
|
|
@@ -229,6 +312,26 @@ _Note:_ Eleva isn't trying to replace these giants but provides a lightweight op
|
|
|
229
312
|
|
|
230
313
|
---
|
|
231
314
|
|
|
315
|
+
## Browser Support
|
|
316
|
+
|
|
317
|
+
Eleva targets **modern evergreen browsers** and requires no polyfills.
|
|
318
|
+
|
|
319
|
+
| Browser | Minimum Version |
|
|
320
|
+
|---------|-----------------|
|
|
321
|
+
| Chrome | 71+ |
|
|
322
|
+
| Firefox | 69+ |
|
|
323
|
+
| Safari | 12.1+ |
|
|
324
|
+
| Edge | 79+ (Chromium) |
|
|
325
|
+
| iOS Safari | 12.2+ |
|
|
326
|
+
|
|
327
|
+
**Not Supported:** Internet Explorer, Legacy Edge (< 79)
|
|
328
|
+
|
|
329
|
+
**Why?** Eleva uses modern JavaScript features (`queueMicrotask`, ES6 Classes, async/await) to maintain its tiny footprint. These browsers cover **96%+ of global web traffic**.
|
|
330
|
+
|
|
331
|
+
> ๐ก For legacy browser support, use Babel with appropriate polyfills.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
232
335
|
## Installation
|
|
233
336
|
|
|
234
337
|
Eleva is available on npm. Try it out and share your thoughts!
|
|
@@ -276,10 +379,10 @@ app.component("HelloWorld", {
|
|
|
276
379
|
}
|
|
277
380
|
};
|
|
278
381
|
},
|
|
279
|
-
template: (
|
|
382
|
+
template: (ctx) => `
|
|
280
383
|
<div>
|
|
281
384
|
<h1>Hello, Eleva! ๐</h1>
|
|
282
|
-
<p>Count: ${count.value}</p>
|
|
385
|
+
<p>Count: ${ctx.count.value}</p>
|
|
283
386
|
<button @click="() => count.value++">Increment</button>
|
|
284
387
|
</div>
|
|
285
388
|
`
|
|
@@ -317,10 +420,10 @@ Include Eleva via a script tag and use the global variable:
|
|
|
317
420
|
const count = signal(0);
|
|
318
421
|
return { count };
|
|
319
422
|
},
|
|
320
|
-
template: (
|
|
423
|
+
template: (ctx) => `
|
|
321
424
|
<div>
|
|
322
425
|
<h1>Hello, Eleva! ๐</h1>
|
|
323
|
-
<p>Count: ${count.value}</p>
|
|
426
|
+
<p>Count: ${ctx.count.value}</p>
|
|
324
427
|
<button @click="() => count.value++">Increment</button>
|
|
325
428
|
</div>
|
|
326
429
|
`,
|
|
@@ -339,10 +442,8 @@ Interactive Demo: [CodePen](https://codepen.io/tarekraafat/pen/jEOyzYN?editors=1
|
|
|
339
442
|
|
|
340
443
|
### TemplateEngine
|
|
341
444
|
|
|
342
|
-
- **`TemplateEngine.parse(template, data)`**
|
|
343
|
-
Replaces `{{ expression }}` patterns in the template with evaluated values.
|
|
344
445
|
- **`TemplateEngine.evaluate(expr, data)`**
|
|
345
|
-
Safely evaluates JavaScript expressions within a given context.
|
|
446
|
+
Safely evaluates JavaScript expressions within a given context. Used internally for `@events` and `:props` attribute processing.
|
|
346
447
|
|
|
347
448
|
### Signal
|
|
348
449
|
|
|
@@ -386,6 +487,15 @@ Interactive Demo: [CodePen](https://codepen.io/tarekraafat/pen/jEOyzYN?editors=1
|
|
|
386
487
|
|
|
387
488
|
Eleva's plugin system allows you to extend functionality as needed. Plugins are **separately bundled** from the core framework, ensuring optimal tree-shaking and minimal bundle sizes.
|
|
388
489
|
|
|
490
|
+
**Plugin Types:**
|
|
491
|
+
|
|
492
|
+
| Type | Source | Installation |
|
|
493
|
+
|------|--------|--------------|
|
|
494
|
+
| **Core Plugins** | Bundled with Eleva | `import { X } from "eleva/plugins"` |
|
|
495
|
+
| **External Plugins** | Community/Ecosystem | `npm install eleva-plugin-x` |
|
|
496
|
+
|
|
497
|
+
> **Core plugins** (Attr, Router, Store) are official, tested, and documented. **External plugins** are community-created and installed separately. See [Plugin Documentation](docs/plugins/index.md) for details.
|
|
498
|
+
|
|
389
499
|
#### Core Framework Only (Lightweight)
|
|
390
500
|
|
|
391
501
|
```javascript
|
|
@@ -395,7 +505,7 @@ const app = new Eleva("myApp");
|
|
|
395
505
|
// Core framework only - ~6KB minified
|
|
396
506
|
```
|
|
397
507
|
|
|
398
|
-
####
|
|
508
|
+
#### Attr Plugin
|
|
399
509
|
|
|
400
510
|
Advanced attribute handling for ARIA, data attributes, boolean properties, and dynamic property detection:
|
|
401
511
|
|
|
@@ -426,7 +536,9 @@ app.component("myComponent", {
|
|
|
426
536
|
});
|
|
427
537
|
```
|
|
428
538
|
|
|
429
|
-
|
|
539
|
+
๐ **[Full Attr Documentation โ](docs/plugins/attr.md)** - Comprehensive guide with ARIA attributes, data attributes, boolean handling, and dynamic properties.
|
|
540
|
+
|
|
541
|
+
#### Router Plugin
|
|
430
542
|
|
|
431
543
|
๐ **Advanced client-side routing** with multiple modes, navigation guards, reactive state, and component resolution:
|
|
432
544
|
|
|
@@ -485,7 +597,9 @@ router.currentRoute.subscribe(route => {
|
|
|
485
597
|
router.navigate('/users/123', { replace: true });
|
|
486
598
|
```
|
|
487
599
|
|
|
488
|
-
|
|
600
|
+
๐ **[Full Router Documentation โ](docs/plugins/router.md)** - Comprehensive guide with 13 events, 7 reactive signals, navigation guards, scroll management, and more.
|
|
601
|
+
|
|
602
|
+
#### Store Plugin
|
|
489
603
|
|
|
490
604
|
๐ช **Reactive state management** with centralized data store, persistence, namespacing, and cross-component reactive updates:
|
|
491
605
|
|
|
@@ -608,12 +722,19 @@ console.log(app.store.getState()); // Get current state values
|
|
|
608
722
|
app.dispatch("increment"); // Dispatch actions globally
|
|
609
723
|
```
|
|
610
724
|
|
|
725
|
+
๐ **[Full Store Documentation โ](docs/plugins/store.md)** - Comprehensive guide with 10 API methods, persistence options, namespaces, subscriptions, and migration guides.
|
|
726
|
+
|
|
611
727
|
**Bundle Sizes:**
|
|
612
728
|
- Core framework only: ~6KB (minified)
|
|
613
|
-
- Core +
|
|
614
|
-
- Core +
|
|
615
|
-
- Core +
|
|
616
|
-
- Core + All plugins: ~
|
|
729
|
+
- Core + Attr: ~8KB (minified)
|
|
730
|
+
- Core + Router: ~21KB (minified)
|
|
731
|
+
- Core + Store: ~12KB (minified)
|
|
732
|
+
- Core + All plugins: ~21KB (minified)
|
|
733
|
+
|
|
734
|
+
**Individual Plugin Sizes:**
|
|
735
|
+
- Attr: ~2.2KB (minified)
|
|
736
|
+
- Router: ~15KB (minified)
|
|
737
|
+
- Store: ~6KB (minified)
|
|
617
738
|
|
|
618
739
|
**Available Plugin Formats:**
|
|
619
740
|
|
|
@@ -622,10 +743,10 @@ app.dispatch("increment"); // Dispatch actions globally
|
|
|
622
743
|
- CJS: `const { Attr, Router, Store } = require('eleva/plugins')`
|
|
623
744
|
|
|
624
745
|
**For CDN (Individual Plugins - Smaller Bundle Size):**
|
|
625
|
-
- UMD: `<script src="https://
|
|
626
|
-
- UMD: `<script src="https://
|
|
627
|
-
- UMD: `<script src="https://
|
|
628
|
-
- UMD: `<script src="https://
|
|
746
|
+
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/eleva.umd.min.js"></script>`
|
|
747
|
+
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/attr.umd.min.js"></script>`
|
|
748
|
+
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/router.umd.min.js"></script>`
|
|
749
|
+
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/store.umd.min.js"></script>`
|
|
629
750
|
|
|
630
751
|
**Individual Plugin Imports (Best for Tree-Shaking):**
|
|
631
752
|
- ESM: `import { Attr } from 'eleva/plugins/attr'`
|
|
@@ -685,10 +806,20 @@ I welcome developers to dive in and experiment with Eleva! Here's how to get sta
|
|
|
685
806
|
|
|
686
807
|
## Testing
|
|
687
808
|
|
|
688
|
-
|
|
809
|
+
Eleva has a comprehensive test suite with **100% line coverage**:
|
|
810
|
+
|
|
811
|
+
| Metric | Value |
|
|
812
|
+
|--------|-------|
|
|
813
|
+
| **Total Tests** | 273 |
|
|
814
|
+
| **Line Coverage** | 100% |
|
|
815
|
+
| **Test Runner** | Bun |
|
|
816
|
+
|
|
817
|
+
Run the test suite:
|
|
689
818
|
|
|
690
819
|
```bash
|
|
691
|
-
|
|
820
|
+
bun test # Run all tests
|
|
821
|
+
bun test:coverage # Run with coverage report
|
|
822
|
+
bun test:benchmark # Run performance benchmarks
|
|
692
823
|
```
|
|
693
824
|
|
|
694
825
|
Contributions to tests are very welcome! ๐งช
|
|
@@ -715,7 +846,7 @@ Eleva is open-source and available under the [MIT License](LICENSE).
|
|
|
715
846
|
|
|
716
847
|
---
|
|
717
848
|
|
|
718
|
-
**Note:** This is
|
|
849
|
+
**Note:** This is the first official stable release of Eleva.js! The framework is production-ready with a stable API. Your feedback and contributions will help make Eleva even better. Let's build something great together! ๐ชโจ
|
|
719
850
|
|
|
720
851
|
---
|
|
721
852
|
|