✨ Adds
- Parametric directives: Allows setting parameters on directives keys.
- Function association: Allows associating function to elements.
Example that registers an event listener directive and sets a function as an event listener.
<!-- Define event listener directive -->
<script>
sb.directive(
'listen',
({ el, value, param }) => {
el.addEventListener(param, value);
},
true
);
</script>
<!-- Set parametric directive -->
<button sb-listen="clicHandler:click">Click</button>
<!-- Set Event listener onto element -->
<script>
data.clickHandler = () => () => console.log('button clicked');
</script>
🛠 Fixes
- Uses maps instead of regular objects to maintain directive, watcher execution order.
- Uses symbols instead of regular keys for internal properties.
- Use separate methods to register directives i.e.
sb.directive
. - Use separate method to change default prefix i.e.
sb.prefix
.
📜Documentation
New pages:
- API: lists all defined methods and directives.
Updated pages:
What's Changed
- enable parametric directives, function association by @18alantom in #27
- Change magic keys to symbols by @nateabele in #28
New Contributors
- @nateabele made their first contribution in #28
Full Changelog: v0.0.2-alpha.0...v0.0.3-alpha.0