@jasonshimmy/custom-elements-runtime 0.0.5-beta.0 → 0.0.6-beta.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 +79 -82
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
# 🧩 Custom Elements Runtime
|
|
2
2
|
|
|
3
|
-
> **Ultra-
|
|
3
|
+
> **Ultra-light, type-safe runtime for fast, reactive web components.**
|
|
4
4
|
|
|
5
|
-
Build modern
|
|
5
|
+
Build modern components with strict TypeScript, zero dependencies, and a clean functional API. Designed for speed, standards compliance, and productivity.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Quick Start
|
|
8
10
|
|
|
9
11
|
### Install
|
|
10
12
|
|
|
11
|
-
```
|
|
13
|
+
```
|
|
12
14
|
npm install @jasonshimmy/custom-elements-runtime
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
###
|
|
17
|
+
### Example Usage
|
|
16
18
|
|
|
17
|
-
```
|
|
19
|
+
```ts
|
|
18
20
|
import { component, html } from '@jasonshimmy/custom-elements-runtime';
|
|
19
21
|
|
|
20
22
|
component('my-counter', {
|
|
@@ -26,107 +28,102 @@ component('my-counter', {
|
|
|
26
28
|
});
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
All types and interfaces are available for auto-completion and strict typing in code editors. No extra configuration is needed.
|
|
31
|
+
No config needed — TypeScript support is built-in.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
👉 Explore [Advanced Usage](docs/api-reference.md)
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
---
|
|
36
36
|
|
|
37
|
+
## ✨ Why Use It?
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
- **Stateful or Stateless:** Flexible components with or without internal state
|
|
40
|
+
- **Reactive & Declarative:** Auto updates, attribute sync, and data binding
|
|
41
|
+
- **Functional Templates:** Tagged helpers (`html`, `compile`), Promises, and styles
|
|
42
|
+
- **Refs & Computed:** Access elements or create derived state easily
|
|
43
|
+
- **Built-in Store & Events:** Global state and event bus included
|
|
44
|
+
- **SSR & Hydration:** Universal rendering with opt-in hydration
|
|
45
|
+
- **Error Handling & Focus Retention:** Smooth updates without breaking UX
|
|
46
|
+
- **Plugin System:** Hooks like `onInit`, `onRender`, `onError`
|
|
47
|
+
- **Lightweight Router:** SSR-ready with `<router-view>` and programmatic navigation
|
|
48
|
+
- **Tiny & Fast:** Tree-shakable, modular, no dependencies
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
- **Reactive State & Attribute Sync:** Automatic re-renders and attribute reflection for primitive keys. Direct assignment triggers batched updates.
|
|
42
|
-
- **Functional Templates & Styling:** Use functions, tagged helpers (`html`, `compile`), or async Promises. Supports static and dynamic styles.
|
|
43
|
-
- **Refs & Computed Properties:** Direct DOM access via `data-ref` and derived state with `computed`.
|
|
44
|
-
- **Declarative Event & Input Binding:** Use `data-on-*`, `data-model`, and `data-bind` for type-safe event and input sync, including deep and nested state.
|
|
45
|
-
- **Global Store & Event Bus:** Built-in reactive store and event bus for cross-component state and communication.
|
|
46
|
-
- **SSR & Hydration:** Universal rendering, opt-in hydration, and template matching. SSR excludes refs, event listeners, and lifecycle hooks.
|
|
47
|
-
- **Error Boundaries & Focus Preservation:** Robust error handling and input focus retention during updates.
|
|
48
|
-
- **Plugin System:** Extend runtime with hooks (`onInit`, `onRender`, `onError`) for global/component logic.
|
|
49
|
-
- **Router:** Lightweight, functional router with SSR/static site support, `<router-view>`, route params, and programmatic navigation.
|
|
50
|
-
- **Performance & Modularity:** Smart DOM batching, tree-shakable exports, strict TypeScript, and modular functional API.
|
|
50
|
+
---
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
## ⚠️ Things to Know
|
|
53
53
|
|
|
54
|
-
- Templates
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
- SSR hydration is opt-in
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
- Router requires template matching for SSR hydration; navigation is programmatic and declarative.
|
|
54
|
+
- Templates need a single root node (fragments allowed with keys)
|
|
55
|
+
- One handler per event type per element
|
|
56
|
+
- User input takes priority over programmatic changes
|
|
57
|
+
- SSR hydration is opt-in (`data-hydrate`)
|
|
58
|
+
- Only documented features are officially supported
|
|
59
|
+
- Plugins must be pure and side-effect free
|
|
60
|
+
- Router requires matching templates for SSR hydration
|
|
62
61
|
|
|
62
|
+
---
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## 🔧 Use Cases
|
|
65
65
|
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
66
|
+
- Micro-frontends
|
|
67
|
+
- Progressive enhancement
|
|
68
|
+
- Design systems
|
|
69
|
+
- SSR apps
|
|
70
|
+
- Performance-critical projects
|
|
71
|
+
- Standards-based development
|
|
72
|
+
- Static site generation
|
|
73
|
+
- Plugin-extendable architectures
|
|
74
74
|
|
|
75
|
+
---
|
|
75
76
|
|
|
76
77
|
## 🖥️ SSR Highlights
|
|
77
78
|
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
- **SSR Router Support:** Match routes server-side for static site generation and universal rendering.
|
|
79
|
+
- SEO-friendly HTML/CSS out of the box
|
|
80
|
+
- Hydrate only what you need
|
|
81
|
+
- Robust support for fragments, keyed nodes, and error handling
|
|
82
|
+
- Compatible with routing and static site generation
|
|
83
83
|
|
|
84
|
+
---
|
|
84
85
|
|
|
85
|
-
## 🛡️ Production
|
|
86
|
+
## 🛡️ Production Ready
|
|
86
87
|
|
|
87
|
-
- Strict TypeScript
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- Regression-tested features and API
|
|
88
|
+
- Strict TypeScript and modular design
|
|
89
|
+
- No dependencies
|
|
90
|
+
- Clean error handling and validation
|
|
91
|
+
- Secure: sanitizes user input
|
|
92
|
+
- Fully tested
|
|
93
93
|
|
|
94
|
+
---
|
|
94
95
|
|
|
95
|
-
## ⚡ Performance
|
|
96
|
+
## ⚡ Performance Perks
|
|
96
97
|
|
|
97
|
-
-
|
|
98
|
-
- Tree-shakable exports
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
- Input focus and selection preservation
|
|
103
|
-
- Efficient attribute-state sync and event handling
|
|
98
|
+
- DOM batching and minimal re-renders
|
|
99
|
+
- Tree-shakable exports
|
|
100
|
+
- Focus preservation and efficient DOM updates
|
|
101
|
+
- Async rendering with Promises
|
|
102
|
+
- Smart memory cleanup
|
|
104
103
|
|
|
105
104
|
---
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
- **Memory Management:** Automatic cleanup prevents leaks.
|
|
109
|
-
- **Focus & DOM Efficiency:** Input focus is preserved; only changed DOM nodes are updated for optimal UX.
|
|
110
|
-
- **Async & Selective Rendering:** Promises supported in templates; hydrate only marked regions for efficient SSR.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## 📚 Documentation
|
|
106
|
+
## 📚 Learn More
|
|
114
107
|
|
|
115
|
-
- [Advanced Use Cases](docs/advanced-use-cases.md)
|
|
116
|
-
- [API Reference](docs/api-reference.md)
|
|
117
|
-
- [Core Concepts](docs/core-concepts.md)
|
|
118
|
-
- [Data Model vs Data Bind](docs/data-model-vs-data-bind.md)
|
|
119
|
-
- [Examples](docs/examples.md)
|
|
120
|
-
- [Form Input Bindings](docs/form-input-bindings.md)
|
|
121
|
-
- [Framework Comparison](docs/framework-comparison.md)
|
|
122
|
-
- [Framework Integration](docs/framework-integration.md)
|
|
123
|
-
- [Routing](docs/routing.md)
|
|
124
|
-
- [SSR](docs/ssr.md)
|
|
108
|
+
- [⚙️ Advanced Use Cases](docs/advanced-use-cases.md)
|
|
109
|
+
- [🛠 API Reference](docs/api-reference.md)
|
|
110
|
+
- [🌱 Core Concepts](docs/core-concepts.md)
|
|
111
|
+
- [🥊 Data Model vs Data Bind](docs/data-model-vs-data-bind.md)
|
|
112
|
+
- [📦 Examples](docs/examples.md)
|
|
113
|
+
- [🎛️ Form Input Bindings](docs/form-input-bindings.md)
|
|
114
|
+
- [🎯 Framework Comparison](docs/framework-comparison.md)
|
|
115
|
+
- [🔗 Framework Integration](docs/framework-integration.md)
|
|
116
|
+
- [🚦 Routing](docs/routing.md)
|
|
117
|
+
- [🌐 SSR Guide](docs/ssr.md)
|
|
125
118
|
|
|
119
|
+
---
|
|
126
120
|
|
|
127
|
-
|
|
121
|
+
## 🛠 Local Dev
|
|
128
122
|
|
|
129
|
-
|
|
123
|
+
```
|
|
124
|
+
# Clone the repo
|
|
125
|
+
git clone <repo-url>
|
|
130
126
|
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
# Run examples
|
|
128
|
+
npm run dev
|
|
129
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jasonshimmy/custom-elements-runtime",
|
|
3
3
|
"description": "A powerful, modern, and lightweight runtime for creating reactive web components with TypeScript",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|