Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
MIT License
Bot releases are hidden (Show)
Published by UpperCod about 2 years ago
You can now use the <></>
fragment tag through jsx-runtime.
Previously null values were kept as null, this did not favor the use of default parameters when destructing the props object or defining a default prop when using a callback as a value reducer, example:
function component({ value = 100 }: Props<typeof component>) {
return <host>{value}</host>;
}
component.props = { value: Number };
If prop is defined as null, value will be equal to null. but since [email protected] any value declared as null will be defined as undefined in the component's prop object, so value will be defined as undefined
Published by UpperCod about 2 years ago
Published by UpperCod about 2 years ago
Published by UpperCod about 2 years ago
Fixes types for TS with erroneous behavior from version 1.62.0. Bug reference: https://github.com/atomicojs/atomico/issues/90
Published by UpperCod about 2 years ago
This context synchronization error occurs when mounting the components directly in the HTML, now atomico synchronizes the contexts in non-parallel mounting situations.
Published by UpperCod about 2 years ago
This new api facilitates communication between components, example:
Paso 1: declarar el contexto y consumirlo.
import { createContext, useContext, c } from "atomico";
export const Provider = createContext({ value: 0 });
function component() {
const { value } = useContext(Provider);
return <host>{value}</host>;
}
export const Component = c(component);
Paso 2: Instantiate the context, The <Provider>
component allows to define the value for the components nested inside the <Provider/>
import { Provider, Component } from "./component";
<Provider value={{ value: "New value!" }}>
<div>
<div>
<Component></Component>
</div>
</div>
</Provider>;
Published by UpperCod over 2 years ago
This fixes type validation when using the Component type, correctly completing meta props
https://github.com/atomicojs/atomico/issues/82#issuecomment-1187687609
Published by UpperCod over 2 years ago
Now the Component type allows, through a second parameter, to define meta types, such as methods and events:
import { Component, useEvent } from "atomico";
interface Props {
checked: boolean;
}
interface MetaProps {
onChange: Event;
}
const myComponent: Component<Props, MetaProps> = ({ checked }) => {
const dispatchChange = useEvent("Change");
return (
<host>
<input checked={checked} onchange={dispatchChange} />
</host>
);
};
myComponent.props = {
checked: Boolean,
};
export const MyComponent = c(myComponent);
Meta Props are only declared for JSX(Atomico, Preact and React), example:
<MyComponent onChange={(event)=>{
event.currentTarget.checked // TS: boolean
}}/>
Published by UpperCod over 2 years ago
Published by UpperCod over 2 years ago
Published by UpperCod over 2 years ago
Published by UpperCod over 2 years ago
This allows for light verification, before including the SSR script
Published by UpperCod over 2 years ago
Published by UpperCod over 2 years ago
now the return of the instance is correctly inferred
const element = fixture<typeof MyElement>(<MyElement/>)
adaptability in npm is improved and more sponsors are added
Published by UpperCod over 2 years ago
this changes the rendering process of Atomico, Atomico used to individualize the text nodes, now it concatenates them to facilitate hydration from the SSR.
this allows improvements at the level of DOM analysis, since now Atomico reduces the DOM nodes of the Text type, example:
// Before, in this case atomic generated 6 nodes
[1,2,3,4] // Mark,Text(1), Text(2), Text(3), Text(4), Mark
// After, Now atomico spawns only 3 nodes
[1,2,3,4] // Mark,Text(1234), Mark
Published by UpperCod over 2 years ago
This hook is used internally to know the render cycle state of the hooks, this update exposes this hook to be used by third parties. The usage references are in the same Atomico core in the following hooks, useState, useMemo, useEffect, useLayouteEffect and useRef
Published by UpperCod over 2 years ago
This enhancement exposes on return as String, the type, attributes, and innerHTML properties.
this is meta information needed to extend SSR to other environments, example Next js
Published by UpperCod over 2 years ago
Published by UpperCod over 2 years ago
This new mode allows you to not rely on options.render to detect SSR, instead atomico/ssr will set options.ssr
to true.
Published by UpperCod over 2 years ago