Property | Type | Effect |
---|---|---|
By default, the render is configured to be used within the webcomponent by reading the return of the function, but it can be used outside of Atomico, example:
Render rule "The first node of the render must always be the host tag".
This technique allows you to use any registered custom element without the need to know its tag-name
for its use, example:
Advantage :
Remove leverage from tag-name
Infer the types of the props and autocomplete only if you use JSX and Atomico.
Atomico allows the use of the DOM, for this it establishes its created or recovered node as a constructor, example:
Atomico associates the variable associated with the instance as a constructor, example:
allows to declare a node within the scope of the function as static, this will optimize the diff process between render, achieving better performance in cases of high stress of the UI, example:
the biggest advantage of this is that the node accesses the scope of the webcomponent
Allows to clone a node from the virtualDOM, example:
The objective of this feature is to retrieve slot and use it as a template from the webcomponent.
Atomico allows reusing existing DOM in the document. This is done during the webcomponent instatiation, by setting a special property in the tag to mark it for hydration.
This can be done for shadowDom too:
These code samples are not part of the standard yet, so polyfills must be used to ensure that it works in all browsers. Read more about Google Chrome's proposal here https://web.dev/declarative-shadow-dom/.
Atomic creates a customElement from a function, Atomico will take the name of the function and associate it as the name of the CustomElement in CamelCase format, example:
This results in the class name being equal to Button. This feature is useful for tools like Storybook, when serializing the JSX.
Atomico's virtualDOM is designed to enhance the use of webcomponents.
Atomico supports jsx-runtime, alternatively you can import the h
function to declare manual of the JSX pragma, eg:
An important rule of Atomico's virtualDOM is that every webcomponent must return the <host/>
tag since it represents the state of the webcomponent's DOM, such as:
Enable the use of the shadowDOM by declaring the shadowDom
property.
Association of events, attributes or properties.
Template of the webcomponent.
Atomico considers that a property must be associated as an event if it is of the function type and begins with the prefix 'on', eg:
the key property can receive values of the type of any type that allows generating a reference to the node, eg:
A technique inherited from React, it allows obtaining the reference of the node to which the Ref object is associated through the ref property, example:
This property allows you to declare the use of the shadowDom, eg:
You can declare a method by declaring a function in the host tag without using the prefix on in its name, eg:
If when creating or updating the DOM it does not detect the use of the property, it will be associated as a method of this, thus allowing it to be accessed from the DOM, eg:
Atomico supports the use of template-string thanks to the use of the package .
The references must be immutable objects, to create it there is the hook that creates a reference for each instance of the webcomponent.
To access the DOM safely wait for the resolution of the updated property created by the .
shadowDom
Boolean
Enables the use of the shadowDOM on the node.
staticNode
Boolean
Render the node only once, this optimizes the update process as the node is ignored between updates.
cloneNode
Boolean
clone a node of type Element
$<name>
any
the $ prefix allows defining as an attribute in all cases.