Atomico Versions Save

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.

1.79.2

3 weeks ago
  1. Fix first argument to useState at type level, example:
// BEFORE
const [state, setState] = useState<string>(()=>"welcome"); // ❌Typescript announces error
// BEFORE
const [state, setState] = useState<string>(()=>"welcome"); // ✅Typescript announces success
  1. Context synchronization

While version 1.79 fixed cases where HTML-based synchronization is privileged, this fix fixes synchronization when using JSX, avoiding 2 renders when connecting to contexts 💪, example:

<MyParent>
    <MyContext>
       <MyChild/>
    </MyContext>
</MyParent>

Using JSX/TSX has better performance when synchronizing contexts,thanks to the fact that MyChild will be receiving the status at the time of mount.

1.79.1

4 weeks ago

This version applies fixes to improve component unmounting when using useSuspense and code reductions for the context API.

  1. Internal fixes for the context API, reducing the code and logic.
  2. Internal fixes for the suspense API, properly cleaning up the state upon unmounting.

1.79.0

1 month ago

This version has 2 core changes:

  1. Improvements in the context API to achieve state synchronization in extreme and collaborative cases (When using Atomico within other libraries like React, Vue or Angular).
  2. Enhancements in the suspense API, now allowing to properly observe and clean up promises resolved in nested components.

1.78.2

1 month ago

1.78.1

1 month ago

1.78.0

1 month ago

New Features

Now usePromise is also observed by the useSuspense Hook.

With this, you can create interfaces that react from the parent component to the asynchrony of its children.

New hook useProvider

With this new hook, you can set the context instance, for example:

const Theme = createContext({ mode: "light" });

const App = c(() => {
    useProvider(Theme, { mode: "dark" });
});

Internal improvements

  1. The context api is improved to synchronize states according to the HTML.

1.77.2

1 month ago

Fixes a bug when using contexts in SSR environments. Thanks to @WickyNilliams for reporting the issue https://github.com/atomicojs/astro/issues/1.

1.77.1

2 months ago

This allows fixing the filter by instanceof a nidel of typescript types, example:

import { Mark } from "atomico";

Array.from(element.childNodes).filter(
    (el) => !(el instanceof Mark)
);

1.77.0

2 months ago

This new property allows working with slots in manual assignment mode in an agile way. For example:

import { c } from "atomico";
import { useChildNodes } from "@atomico/use-child-nodes";

const MyComponent = c(() => {
	const childNodes = useChildNodes();
	return (
		<host shadowDom={{ slotAssignment: "manual" }}>
			{childNodes
				.filter((el) => el instanceof HTMLElement)
				.map((child: HTMLElement) => (
					<slot assignNode={child}></slot>
				))}
		</host>
	);
});

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

1.76.4

2 months ago

Now the type exists as a module at the TS level