Releases: atomicojs/hooks
Improves the behavior of a useRouter
Now useRouter uses the object as a reference to useEffect, allowing dynamic changes on the routes object.
With certain special behaviors:
Before each revision useRouter will check the object and cache the response according to the path.
The first state is only defined after useEffect.
Dependencies point to latest
The latest version of Atomico is fixed
Add the useParent hook
useParent
This hook searches the parent node according to a selector, allowing a communication from child to parent.
Import
`js import { useParent } from "@atomico/kit/use-parent";
''
Syntax
`js const ref = useParent (matches);
''
Where:
ref
: Reference whose current is the captured node according tomatches
.matches
: Selector to identify the parent, Check api Element.matches
2.1.0
Summary
The useListener hook is removed and useCssLightDom is added.
Changes
useListener
It is removed as a hook given the complexity of keeping events memorized.
Upgrades
useCssLightDom
hook that allows associating styles in lightDOM situations
Syntax
const css = useCssLightDom();
Where:
css
: Callback generated by the className..
Example
import { useCssLightDom } from "@atomico/kit/use-css-light-dom";
function component() {
const css = useCssLightDom();
return (
<host>
<input
type="checkbox"
class={css`
:host {
transform: scale(2);
}
:checked {
transform: scale(3);
}
`}
/>
</host>
);
}
Warning this version breaks support for a series of submodules.
Warning this version breaks support for a series of sub-modules in favor of better maintenance.
Now @atomico/kit will focus only on distributing hooks that give a real utility.
Changes
The following hooks are removed.
- useCss: To keep the css in lightDOM we recommend using
:slotted
. - useDelegateFocus: The delegation of the focus event can be made from the virtualDOM..
- useCssShadow: Now exists natively in
atomico/css
. - useQueue: Unnecessary utility.
- useSyncEvent: An event-based effect on the virtualDOM is preferable for component synchronization.
Upgrades
- Support for package.json#exports
- Elimination of Typescript, like Atomico now submodules are distributed without the need to go through a packager.