@jasonshimmy/custom-elements-runtime 0.3.1 → 1.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 +69 -58
- package/dist/custom-elements-runtime.cjs.js +36 -30
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +2481 -1616
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +36 -30
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/runtime/component.d.ts +39 -2
- package/dist/runtime/event-manager.d.ts +58 -0
- package/dist/runtime/helpers.d.ts +18 -2
- package/dist/runtime/hooks.d.ts +113 -0
- package/dist/runtime/props.d.ts +13 -1
- package/dist/runtime/reactive-proxy-cache.d.ts +51 -0
- package/dist/runtime/reactive.d.ts +123 -0
- package/dist/runtime/render.d.ts +2 -2
- package/dist/runtime/secure-expression-evaluator.d.ts +30 -0
- package/dist/runtime/style.d.ts +1 -1
- package/dist/runtime/template-compiler.d.ts +4 -0
- package/dist/runtime/types.d.ts +2 -10
- package/dist/runtime/vdom.d.ts +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,72 +24,83 @@ Build modern components with strict TypeScript, zero dependencies, and a clean f
|
|
|
24
24
|
1. **Install:** `npm install @jasonshimmy/custom-elements-runtime`
|
|
25
25
|
2. **Create a Component:**
|
|
26
26
|
```ts
|
|
27
|
-
import { component, html } from '@jasonshimmy/custom-elements-runtime';
|
|
28
|
-
|
|
29
|
-
component('my-counter', (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
import { component, ref, html, useEmit } from '@jasonshimmy/custom-elements-runtime';
|
|
28
|
+
|
|
29
|
+
component('my-counter', ({ initialCount = 0 }) => {
|
|
30
|
+
const count = ref(initialCount);
|
|
31
|
+
const emit = useEmit();
|
|
32
|
+
|
|
33
|
+
const handleClick = () => {
|
|
34
|
+
count.value++;
|
|
35
|
+
emit('update:initial-count', { count: count.value });
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return html`
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
class="px-4 py-2 bg-blue-500 text-white rounded"
|
|
42
|
+
@click.prevent="${handleClick}"
|
|
43
|
+
>
|
|
44
|
+
Count: ${count.value}
|
|
45
|
+
</button>
|
|
46
|
+
`;
|
|
47
|
+
});
|
|
35
48
|
```
|
|
36
49
|
3. **Use in HTML:**
|
|
37
50
|
```html
|
|
38
|
-
<my-counter
|
|
51
|
+
<my-counter
|
|
52
|
+
initial-count="5"
|
|
53
|
+
@update:initial-count="handleCountUpdate"
|
|
54
|
+
></my-counter>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
function handleCountUpdate(event) {
|
|
58
|
+
console.log('Count updated to:', event.detail.count);
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
39
61
|
```
|
|
40
62
|
4. **Enjoy instant reactivity and type safety!**
|
|
41
63
|
|
|
42
64
|
## 📖 Documentation Index
|
|
43
65
|
|
|
44
|
-
Explore the
|
|
45
|
-
|
|
46
|
-
###
|
|
47
|
-
- [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- [
|
|
58
|
-
|
|
59
|
-
###
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- [
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
|
|
78
|
-
###
|
|
79
|
-
- [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### 🧰 Utilities & Troubleshooting
|
|
84
|
-
- [Troubleshooting](./docs/troubleshooting.md)
|
|
85
|
-
|
|
86
|
-
### 🔗 Framework Integration
|
|
87
|
-
- [Vue Integration](./docs/vue-integration.md)
|
|
88
|
-
- [React Integration](./docs/react-integration.md)
|
|
89
|
-
- [Svelte Integration](./docs/svelte-integration.md)
|
|
90
|
-
- [Angular Integration](./docs/angular-integration.md)
|
|
91
|
-
|
|
92
|
-
For deep dives, see each guide above or browse the source code in `src/lib/`.
|
|
66
|
+
Explore the complete documentation for every runtime feature:
|
|
67
|
+
|
|
68
|
+
### 🚀 **Getting Started**
|
|
69
|
+
- [**🎯 Functional API**](./docs/functional-api.md) - **Start here!** Complete guide to the modern functional component API
|
|
70
|
+
|
|
71
|
+
### 🏗️ **Core Features**
|
|
72
|
+
- [🧩 Template](./docs/template.md) - Template syntax and html function
|
|
73
|
+
- [🧭 Directives](./docs/directives.md) - Conditional rendering with `when`, `each`, and `match`
|
|
74
|
+
- [🛠️ Directive Enhancements](./docs/directive-enhancements.md) - Advanced directive utilities (`unless`, `whenEmpty`, etc.)
|
|
75
|
+
- [🔗 Bindings](./docs/bindings.md) - Data binding with `:prop`, `@event`, `:model`, `:class`, `:style`
|
|
76
|
+
- [🔔 Events Deep Dive](./docs/events-deep-dive.md) - Custom event emission and handling patterns
|
|
77
|
+
|
|
78
|
+
### 🎨 **Styling**
|
|
79
|
+
- [🎨 JIT CSS](./docs/jit-css.md) - On-demand utility-first styling system
|
|
80
|
+
|
|
81
|
+
### 🔗 **Communication & State**
|
|
82
|
+
- [📢 Event Bus](./docs/event-bus.md) - Global event system for cross-component communication
|
|
83
|
+
- [🗄️ Store](./docs/store.md) - Global state management
|
|
84
|
+
- [🚦 Router](./docs/router.md) - Client-side routing
|
|
85
|
+
- [🤝 Cross-Component Communication](./docs/cross-component-communication.md) - Patterns for component interaction
|
|
86
|
+
|
|
87
|
+
### ⚡ **Advanced Features**
|
|
88
|
+
- [🔮 Virtual DOM](./docs/virtual-dom.md) - VDOM implementation and performance details
|
|
89
|
+
- [🌐 SSR](./docs/ssr.md) - Server-side rendering support
|
|
90
|
+
- [♻️ HMR](./docs/hmr.md) - Hot module replacement
|
|
91
|
+
- [🛡️ Infinite Loop Protection](./docs/infinite-loop-protection.md) - Runtime safeguards against infinite loops
|
|
92
|
+
- [🔒 Secure Expression Evaluator](./docs/secure-expression-evaluator.md) - Safe evaluation of dynamic expressions in templates
|
|
93
|
+
|
|
94
|
+
### 🔧 **Integration Guides**
|
|
95
|
+
- [⚛️ React Integration](./docs/react-integration.md) - Using components in React apps
|
|
96
|
+
- [🦊 Vue Integration](./docs/vue-integration.md) - Using components in Vue apps
|
|
97
|
+
- [🅰️ Angular Integration](./docs/angular-integration.md) - Using components in Angular apps
|
|
98
|
+
- [🔥 Svelte Integration](./docs/svelte-integration.md) - Using components in Svelte apps
|
|
99
|
+
|
|
100
|
+
### 🛠️ **Troubleshooting**
|
|
101
|
+
- [🔧 Troubleshooting](./docs/troubleshooting.md) - Common issues and solutions
|
|
102
|
+
|
|
103
|
+
For examples and implementation details, explore the source code in `src/lib/`.
|
|
93
104
|
|
|
94
105
|
## 🧑🔬 Real-World Examples
|
|
95
106
|
- [Form Input & Validation](./src/components/examples/FormInputValidation.ts)
|