rip-lang 3.13.29 → 3.13.31
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 +1 -1
- package/docs/RIP-LANG.md +19 -0
- package/docs/dist/rip.js +97 -41
- package/docs/dist/rip.min.js +162 -157
- package/docs/dist/rip.min.js.br +0 -0
- package/package.json +1 -1
- package/src/components.js +62 -4
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.
|
|
12
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-3.13.31-blue.svg" alt="Version"></a>
|
|
13
13
|
<a href="#zero-dependencies"><img src="https://img.shields.io/badge/dependencies-ZERO-brightgreen.svg" alt="Dependencies"></a>
|
|
14
14
|
<a href="#"><img src="https://img.shields.io/badge/tests-1%2C300%2F1%2C300-brightgreen.svg" alt="Tests"></a>
|
|
15
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg" alt="License"></a>
|
package/docs/RIP-LANG.md
CHANGED
|
@@ -1440,6 +1440,25 @@ App = component
|
|
|
1440
1440
|
"Click me"
|
|
1441
1441
|
```
|
|
1442
1442
|
|
|
1443
|
+
**Auto-Wired Event Handlers:**
|
|
1444
|
+
|
|
1445
|
+
Methods named `on` + capitalized event name are automatically bound to the component's root element:
|
|
1446
|
+
|
|
1447
|
+
```coffee
|
|
1448
|
+
Checkbox = component
|
|
1449
|
+
@checked := false
|
|
1450
|
+
onClick: -> @checked = not @checked
|
|
1451
|
+
onKeydown: (e) ->
|
|
1452
|
+
if e.key in ['Enter', ' ']
|
|
1453
|
+
e.preventDefault()
|
|
1454
|
+
@onClick()
|
|
1455
|
+
render
|
|
1456
|
+
button role: 'checkbox', aria-checked: !!@checked
|
|
1457
|
+
slot
|
|
1458
|
+
```
|
|
1459
|
+
|
|
1460
|
+
The compiler wires `addEventListener('click', ...)` and `addEventListener('keydown', ...)` to the root `button`. To override for a specific event, write an explicit binding on the root: `button @click: someOtherHandler`. Lifecycle hooks (`onError`) are not auto-wired.
|
|
1461
|
+
|
|
1443
1462
|
**Conditional Rendering:**
|
|
1444
1463
|
|
|
1445
1464
|
```coffee
|