eleva 1.0.0-rc.13 โ 1.0.0-rc.14
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 +20 -75
- package/dist/eleva-plugins.cjs.js +4 -653
- package/dist/eleva-plugins.cjs.js.map +1 -1
- package/dist/eleva-plugins.esm.js +5 -653
- package/dist/eleva-plugins.esm.js.map +1 -1
- package/dist/eleva-plugins.umd.js +4 -653
- package/dist/eleva-plugins.umd.js.map +1 -1
- package/dist/eleva-plugins.umd.min.js +1 -1
- package/dist/eleva-plugins.umd.min.js.map +1 -1
- package/dist/eleva.cjs.js +52 -110
- package/dist/eleva.cjs.js.map +1 -1
- package/dist/eleva.d.ts +47 -109
- package/dist/eleva.esm.js +52 -110
- package/dist/eleva.esm.js.map +1 -1
- package/dist/eleva.umd.js +52 -110
- package/dist/eleva.umd.js.map +1 -1
- package/dist/eleva.umd.min.js +1 -1
- package/dist/eleva.umd.min.js.map +1 -1
- package/dist/plugins/attr.umd.js +2 -2
- package/dist/plugins/attr.umd.js.map +1 -1
- package/dist/plugins/attr.umd.min.js +1 -1
- package/dist/plugins/attr.umd.min.js.map +1 -1
- package/dist/plugins/router.umd.js +1 -1
- package/dist/plugins/router.umd.js.map +1 -1
- package/dist/plugins/router.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/core/Eleva.js +21 -15
- package/src/modules/TemplateEngine.js +36 -104
- package/src/plugins/Attr.js +2 -2
- package/src/plugins/Router.js +1 -1
- package/src/plugins/index.js +1 -1
- package/types/core/Eleva.d.ts +9 -5
- package/types/core/Eleva.d.ts.map +1 -1
- package/types/modules/TemplateEngine.d.ts +38 -104
- package/types/modules/TemplateEngine.d.ts.map +1 -1
- package/types/plugins/Router.d.ts +1 -1
- package/types/plugins/index.d.ts +0 -1
- package/dist/plugins/props.umd.js +0 -660
- package/dist/plugins/props.umd.js.map +0 -1
- package/dist/plugins/props.umd.min.js +0 -2
- package/dist/plugins/props.umd.min.js.map +0 -1
- package/src/plugins/Props.js +0 -602
- package/types/plugins/Props.d.ts +0 -49
- package/types/plugins/Props.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Eleva.js ๐
|
|
2
2
|
|
|
3
|
-
> **Version:** `1.0.0-rc.
|
|
3
|
+
> **Version:** `1.0.0-rc.14` | **Size:** ~6KB min (~2.3KB gzip) | **Dependencies:** Zero | **TypeScript:** Yes
|
|
4
4
|
|
|
5
5
|
**Best DX for Building the Best UX** โ Pure JavaScript, Pure Performance, Simply Elegant.
|
|
6
6
|
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
**A minimalist, lightweight, pure vanilla JavaScript frontend runtime framework.**
|
|
43
43
|
_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
44
|
|
|
45
|
-
> **Stability Notice**: This is `v1.0.0-rc.
|
|
45
|
+
> **Stability Notice**: This is `v1.0.0-rc.14` - The core functionality is stable. Seeking community feedback before the final v1.0.0 release.
|
|
46
46
|
|
|
47
|
-
**Version:** `1.0.0-rc.
|
|
47
|
+
**Version:** `1.0.0-rc.14`
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -98,7 +98,6 @@ Eleva is ideal for developers building lightweight web applications, prototypes,
|
|
|
98
98
|
- [Core Framework Only (Lightweight)](#core-framework-only-lightweight)
|
|
99
99
|
- [Attr Plugin](#attr-plugin)
|
|
100
100
|
- [Router Plugin](#router-plugin)
|
|
101
|
-
- [Props Plugin](#props-plugin)
|
|
102
101
|
- [Store Plugin](#store-plugin)
|
|
103
102
|
- [Development](#development)
|
|
104
103
|
- [Testing](#testing)
|
|
@@ -138,14 +137,15 @@ app.mount(document.getElementById("app"), "Counter");
|
|
|
138
137
|
|
|
139
138
|
### Template Syntax
|
|
140
139
|
|
|
141
|
-
> **Quick Rule:** `${}` needs `ctx.` โ `
|
|
140
|
+
> **Quick Rule:** `${}` needs `ctx.` โ `@events` and `:props` don't.
|
|
142
141
|
|
|
143
142
|
| Syntax | Use | `ctx.`? |
|
|
144
143
|
|--------|-----|:-------:|
|
|
145
|
-
| `${expr}` |
|
|
146
|
-
| `{{ expr }}` | Reactive value | โ |
|
|
144
|
+
| `${expr}` | JS value interpolation | โ |
|
|
147
145
|
| `@click` | Event handler | โ |
|
|
148
|
-
| `:prop` | Pass to child |
|
|
146
|
+
| `:prop` | Pass to child | โ |
|
|
147
|
+
|
|
148
|
+
> **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}"`.
|
|
149
149
|
|
|
150
150
|
---
|
|
151
151
|
|
|
@@ -214,7 +214,7 @@ Eleva is built on a simple principle: **great DX leads to great UX**. When devel
|
|
|
214
214
|
- **๐ Lifecycle Hooks:** Complete lifecycle management with before/after mount and update hooks
|
|
215
215
|
- **๐งน Automatic Cleanup:** Proper cleanup of resources, watchers, and child components on unmount
|
|
216
216
|
- **๐ Plugin System:** Extensible architecture with a simple plugin API
|
|
217
|
-
- **๐ฏ Built-in Plugins:** Attr for advanced attributes,
|
|
217
|
+
- **๐ฏ Built-in Plugins:** Attr for advanced attributes, Router for client-side routing, and Store for reactive state management
|
|
218
218
|
- **๐ฆ UMD & ES Module Builds:** Supports modern build tools and browser environments
|
|
219
219
|
- **๐ค Friendly API:** A gentle learning curve for both beginners and seasoned developers
|
|
220
220
|
- **๐ Tiny Footprint & TypeScript Support:** Approximately ~6 KB minified with built-in TypeScript declarations
|
|
@@ -242,7 +242,7 @@ Eleva is ideal for developers seeking a lightweight, flexible, and high-performa
|
|
|
242
242
|
|
|
243
243
|
I believe in clear versioning that reflects the maturity of the project:
|
|
244
244
|
|
|
245
|
-
- **Pre-release Versions (RC):** Release candidate versions like `1.0.0-rc.
|
|
245
|
+
- **Pre-release Versions (RC):** Release candidate versions like `1.0.0-rc.14` indicate the API is stable but still gathering community feedback before the final release.
|
|
246
246
|
- **Semantic Versioning:** Once stable, I'll follow semantic versioning strictly to clearly communicate any breaking changes.
|
|
247
247
|
|
|
248
248
|
---
|
|
@@ -277,16 +277,16 @@ Benchmarks using [js-framework-benchmark](https://krausest.github.io/js-framewor
|
|
|
277
277
|
|
|
278
278
|
| **Framework** | **Bundle Size (min+gzip)** | **Create 1K Rows** (ms) | **Partial Update** (ms) | **Memory** (MB) |
|
|
279
279
|
| ----------------------------- | -------------------------- | ----------------------- | ----------------------- | --------------- |
|
|
280
|
-
| **Eleva
|
|
280
|
+
| **Eleva** (Direct DOM) | **~2.3 KB** | **~23** | ~82* | ~15 |
|
|
281
281
|
| **React 19** (Virtual DOM) | ~44 KB | 40-70 | 10-20 | 2-5 |
|
|
282
|
-
| **Vue 3.5** (Reactive) | ~
|
|
282
|
+
| **Vue 3.5** (Reactive) | ~35 KB | 25-45 | 5-15 | 2-4 |
|
|
283
283
|
| **Angular 19** (Signals) | ~90 KB | 50-80 | 15-25 | 3-6 |
|
|
284
284
|
|
|
285
285
|
_*Eleva uses DOM diffing & patching, but templates generate HTML strings that require parsing. For large frequently-updating lists, use granular components or the `key` attribute for optimal diffing._
|
|
286
286
|
|
|
287
287
|
**Eleva's Strengths:**
|
|
288
|
-
- **Smallest bundle size** (~2.3 KB vs
|
|
289
|
-
- **Competitive initial render** (~
|
|
288
|
+
- **Smallest bundle size** (~2.3 KB vs 35-90 KB)
|
|
289
|
+
- **Competitive initial render** (~23ms for 1K rows)
|
|
290
290
|
- **Zero dependencies** and minimal runtime overhead
|
|
291
291
|
- **Direct DOM diffing** without virtual DOM overhead
|
|
292
292
|
|
|
@@ -315,7 +315,7 @@ How does Eleva compare to popular JavaScript frameworks like React, Vue, Svelte,
|
|
|
315
315
|
| **Build Required** | No | Yes | Optional | Yes | Yes |
|
|
316
316
|
| **Learning Curve** | Low | Medium | Medium | Low | High |
|
|
317
317
|
|
|
318
|
-
_*Svelte
|
|
318
|
+
_*Svelte compiles away, so runtime is minimal but build step is required._
|
|
319
319
|
|
|
320
320
|
Eleva offers a refreshing alternative to frameworks like React, Vue, and Angular:
|
|
321
321
|
|
|
@@ -458,10 +458,8 @@ Interactive Demo: [CodePen](https://codepen.io/tarekraafat/pen/jEOyzYN?editors=1
|
|
|
458
458
|
|
|
459
459
|
### TemplateEngine
|
|
460
460
|
|
|
461
|
-
- **`TemplateEngine.parse(template, data)`**
|
|
462
|
-
Replaces `{{ expression }}` patterns in the template with evaluated values.
|
|
463
461
|
- **`TemplateEngine.evaluate(expr, data)`**
|
|
464
|
-
Safely evaluates JavaScript expressions within a given context.
|
|
462
|
+
Safely evaluates JavaScript expressions within a given context. Used internally for `@events` and `:props` attribute processing.
|
|
465
463
|
|
|
466
464
|
### Signal
|
|
467
465
|
|
|
@@ -512,7 +510,7 @@ Eleva's plugin system allows you to extend functionality as needed. Plugins are
|
|
|
512
510
|
| **Core Plugins** | Bundled with Eleva | `import { X } from "eleva/plugins"` |
|
|
513
511
|
| **External Plugins** | Community/Ecosystem | `npm install eleva-plugin-x` |
|
|
514
512
|
|
|
515
|
-
> **Core plugins** (Attr,
|
|
513
|
+
> **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.
|
|
516
514
|
|
|
517
515
|
#### Core Framework Only (Lightweight)
|
|
518
516
|
|
|
@@ -617,54 +615,6 @@ router.navigate('/users/123', { replace: true });
|
|
|
617
615
|
|
|
618
616
|
๐ **[Full Router Documentation โ](docs/plugins/router.md)** - Comprehensive guide with 13 events, 7 reactive signals, navigation guards, scroll management, and more.
|
|
619
617
|
|
|
620
|
-
#### Props Plugin
|
|
621
|
-
|
|
622
|
-
๐ฏ **Advanced props handling** with automatic type detection, parsing, and reactivity for complex data structures:
|
|
623
|
-
|
|
624
|
-
```javascript
|
|
625
|
-
import Eleva from 'eleva';
|
|
626
|
-
import { Props } from 'eleva/plugins';
|
|
627
|
-
|
|
628
|
-
const app = new Eleva("myApp");
|
|
629
|
-
app.use(Props, {
|
|
630
|
-
enableAutoParsing: true, // Enable automatic type detection
|
|
631
|
-
enableReactivity: true, // Enable reactive prop updates
|
|
632
|
-
onError: (error, value) => {
|
|
633
|
-
console.error('Props parsing error:', error, value);
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
// Use complex props in components
|
|
638
|
-
app.component("UserCard", {
|
|
639
|
-
template: (ctx) => `
|
|
640
|
-
<div class="user-container"
|
|
641
|
-
:user='${JSON.stringify(ctx.user.value)}'
|
|
642
|
-
:permissions='${JSON.stringify(ctx.permissions.value)}'>
|
|
643
|
-
</div>
|
|
644
|
-
`,
|
|
645
|
-
children: {
|
|
646
|
-
'.user-container': 'UserInfo'
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
app.component("UserInfo", {
|
|
651
|
-
setup({ props }) {
|
|
652
|
-
return {
|
|
653
|
-
user: props.user, // Automatically parsed object
|
|
654
|
-
permissions: props.permissions // Automatically parsed array
|
|
655
|
-
};
|
|
656
|
-
},
|
|
657
|
-
template: (ctx) => `
|
|
658
|
-
<div class="user-info">
|
|
659
|
-
<h3>${ctx.user.value.name}</h3>
|
|
660
|
-
<p>Role: ${ctx.user.value.role}</p>
|
|
661
|
-
</div>
|
|
662
|
-
`
|
|
663
|
-
});
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
๐ **[Full Props Documentation โ](docs/plugins/props.md)** - Comprehensive guide with type parsing, reactive props, signal linking, complex data structures, and error handling.
|
|
667
|
-
|
|
668
618
|
#### Store Plugin
|
|
669
619
|
|
|
670
620
|
๐ช **Reactive state management** with centralized data store, persistence, namespacing, and cross-component reactive updates:
|
|
@@ -793,37 +743,32 @@ app.dispatch("increment"); // Dispatch actions globally
|
|
|
793
743
|
**Bundle Sizes:**
|
|
794
744
|
- Core framework only: ~6KB (minified)
|
|
795
745
|
- Core + Attr: ~8KB (minified)
|
|
796
|
-
- Core + Props: ~10KB (minified)
|
|
797
746
|
- Core + Router: ~21KB (minified)
|
|
798
747
|
- Core + Store: ~12KB (minified)
|
|
799
|
-
- Core + All plugins: ~
|
|
748
|
+
- Core + All plugins: ~21KB (minified)
|
|
800
749
|
|
|
801
750
|
**Individual Plugin Sizes:**
|
|
802
751
|
- Attr: ~2.2KB (minified)
|
|
803
|
-
- Props: ~4.2KB (minified)
|
|
804
752
|
- Router: ~15KB (minified)
|
|
805
753
|
- Store: ~6KB (minified)
|
|
806
754
|
|
|
807
755
|
**Available Plugin Formats:**
|
|
808
756
|
|
|
809
757
|
**For Bundlers (Tree-Shaking Supported):**
|
|
810
|
-
- ESM: `import { Attr,
|
|
811
|
-
- CJS: `const { Attr,
|
|
758
|
+
- ESM: `import { Attr, Router, Store } from 'eleva/plugins'`
|
|
759
|
+
- CJS: `const { Attr, Router, Store } = require('eleva/plugins')`
|
|
812
760
|
|
|
813
761
|
**For CDN (Individual Plugins - Smaller Bundle Size):**
|
|
814
762
|
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/eleva.umd.min.js"></script>`
|
|
815
763
|
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/attr.umd.min.js"></script>`
|
|
816
|
-
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/props.umd.min.js"></script>`
|
|
817
764
|
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/router.umd.min.js"></script>`
|
|
818
765
|
- UMD: `<script src="https://cdn.jsdelivr.net/npm/eleva@latest/dist/plugins/store.umd.min.js"></script>`
|
|
819
766
|
|
|
820
767
|
**Individual Plugin Imports (Best for Tree-Shaking):**
|
|
821
768
|
- ESM: `import { Attr } from 'eleva/plugins/attr'`
|
|
822
|
-
- ESM: `import { Props } from 'eleva/plugins/props'`
|
|
823
769
|
- ESM: `import { Router } from 'eleva/plugins/router'`
|
|
824
770
|
- ESM: `import { Store } from 'eleva/plugins/store'`
|
|
825
771
|
- CJS: `const { Attr } = require('eleva/plugins/attr')`
|
|
826
|
-
- CJS: `const { Props } = require('eleva/plugins/props')`
|
|
827
772
|
- CJS: `const { Router } = require('eleva/plugins/router')`
|
|
828
773
|
- CJS: `const { Store } = require('eleva/plugins/store')`
|
|
829
774
|
|