import { addTo } from 'deleight/dom/components'
import { apply } from 'deleight/dom/apply'
document.body.innerHTML = `
<div>I am a div</div>
<p>I am a paragraph</p>
<section>I am a section <button>Btn1</button></section>
<article>I am an article <button>Btn2</button></article>
`;
const obj = { }; // a reactive object
apply({
section: { button: addTo(obj, text) },
article: { button: addTo(obj, text) }
});
A component that adds the element (or a value derived from it) to an object used with primitives from the object/shared module.
The optional wrapper is a function or key used to derive another value from the element. If a function, it takes the element, optional matcher and optional extra args as arg and returns the derived value. If a key, fetches the element's property with the key.