Skip to content
Compare
Choose a tag to compare
@UpperCod UpperCod released this 30 Jul 06:42
· 774 commits to master since this release
66de337

[email protected]

This new version stabilizes the api by introducing various changes and tests to guarantee the future stability of Atomico.

Break!

custom Element is replaced by the c function.

the c function is only limited just create the Element to be registered by customElements.define, example:

import { h, c } from "atomico";

const MyComponent = () => <host />;

const HTMLMyComponent = c(MyComponent);

customElements.define("my-component", HTMLMyComponent);

This function also allows modifying the class to be used as the basis for the Atomico component, example:

const HTMLMyComponent = c(MyComponent, HTMLAnchorElement);

Improvements

Support is added to methods.

Using the host tag you can define methods that work with the scope of the web component, example:

const MyComponent = () => {
  const myMethod = () => console.log("hi!");
  return <host myMethod={myMethod}>...</host>;
};

// After registration

let myComponent = document.querySelector("my-component");

await myComponent.updated;

myComponent.myMethod();

Security

  1. The nodes of the style tag are grouped and sanitized.
  2. The vdom nodes now have an origin marker to avoid injecting objects.
    eate the Element to be registered by customElements.define, example: