@jasonshimmy/custom-elements-runtime 2.6.0 → 2.6.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 +8 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,20 +27,15 @@ Build modern components with strict TypeScript, zero dependencies, and a clean f
|
|
|
27
27
|
```ts
|
|
28
28
|
import {
|
|
29
29
|
component,
|
|
30
|
-
|
|
30
|
+
defineModel,
|
|
31
31
|
html,
|
|
32
|
-
useEmit,
|
|
33
|
-
useProps,
|
|
34
32
|
} from '@jasonshimmy/custom-elements-runtime';
|
|
35
33
|
|
|
36
34
|
component('my-counter', () => {
|
|
37
|
-
const
|
|
38
|
-
const count = ref(props.initialCount);
|
|
39
|
-
const emit = useEmit();
|
|
35
|
+
const count = defineModel('count', 0);
|
|
40
36
|
|
|
41
37
|
const handleClick = () => {
|
|
42
38
|
count.value++;
|
|
43
|
-
emit('update:initial-count', { count: count.value });
|
|
44
39
|
};
|
|
45
40
|
|
|
46
41
|
return html`
|
|
@@ -58,15 +53,14 @@ component('my-counter', () => {
|
|
|
58
53
|
3. **Use in HTML:**
|
|
59
54
|
|
|
60
55
|
```html
|
|
61
|
-
<my-counter
|
|
62
|
-
initial-count="5"
|
|
63
|
-
@update:initial-count="handleCountUpdate"
|
|
64
|
-
></my-counter>
|
|
56
|
+
<my-counter count="5"></my-counter>
|
|
65
57
|
|
|
66
58
|
<script>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
const myCounter = document.querySelector('my-counter');
|
|
60
|
+
myCounter.addEventListener('update:count', (event) => {
|
|
61
|
+
myCounter.setAttribute('count', event.detail);
|
|
62
|
+
console.log('Count updated to:', event.detail);
|
|
63
|
+
});
|
|
70
64
|
</script>
|
|
71
65
|
```
|
|
72
66
|
|
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": "2.6.
|
|
4
|
+
"version": "2.6.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|