@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 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', (ctx) => html`
30
- <button
31
- class="px-4 py-2 bg-blue-500 text-white rounded"
32
- @click="${() => ctx.count++}"
33
- >Count: ${ctx.count}</button>
34
- `, { state: { count: 0 } });
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></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 full documentation for every runtime feature:
45
-
46
- ### 🏗️ Core Concepts
47
- - [Component Config](./docs/component-config.md)
48
- - [Component](./docs/component.md)
49
- - [Render](./docs/render.md)
50
- - [Props](./docs/props.md)
51
- - [State](./docs/state.md)
52
- - [Computed](./docs/computed.md)
53
- - [Watch](./docs/watch.md)
54
- - [Store](./docs/store.md)
55
- - [Router](./docs/router.md)
56
- - [Event Bus](./docs/event-bus.md)
57
- - [Template](./docs/template.md)
58
-
59
- ### 🧩 Reactivity & Patterns
60
- - [Directives](./docs/directives.md)
61
- - [Directive Enhancements Guide](./docs/directive-enhancements.md)
62
- - [Bindings](./docs/bindings.md)
63
- - [Events](./docs/events-deep-dive.md)
64
- - [Slot](./docs/slot.md)
65
- - [Typing Components](./docs/typing-components.md)
66
- - [Advanced Usage Patterns](./docs/advanced-usage-patterns.md)
67
- - [Cross-Component Communication](./docs/cross-component-communication.md)
68
-
69
- ### 🎨 Styling
70
- - [Style](./docs/style.md)
71
- - [Deep Dive: JIT CSS](./docs/jit-css.md)
72
-
73
- ### Performance & Architecture
74
- - [Virtual DOM](./docs/virtual-dom.md)
75
- - [HMR](./docs/hmr.md)
76
- - [SSR](./docs/ssr.md)
77
-
78
- ### 🛡️ Error Handling & Lifecycle
79
- - [Error](./docs/error.md)
80
- - [Hooks](./docs/hooks.md)
81
- - [Method Injection](./docs/method-injection.md)
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)