Skip to content

Releases: atomicojs/hooks

Fix useSlot

11 Apr 03:06
Compare
Choose a tag to compare

Correctly regenerates the reference

update only for [email protected]

09 Nov 22:11
Compare
Choose a tag to compare

Improved typing for useSlot and useProxySlot

11 Oct 15:10
Compare
Choose a tag to compare

Atomico components do not require the use of InstanceType for useSlot and useProxySlot

Before

const myElements = useSlot<InstanceType<typeof MyElement>>(ref);

After

const myElements = useSlot<typeof MyElement>(ref);

new parameter for useSlot

13 Sep 16:59
Compare
Choose a tag to compare

useSlot

useSlot is a really useful hook since it allows us to capture the ChildNodes associated with the slot, sometimes we filter these nodes on the return of this hook, to improve the performance of useSlot we have added a second parameter that will only be called if the slots change, this second parameter has the purpose of filtering the ChildNodes, example:

const InputElements = useSlot<HTMLInputElement>(refSlot, (node)=>node instanceof HTMLInputElement );

fix for export types for TS

01 Sep 15:03
Compare
Choose a tag to compare

The Ts configuration had ignored subpaths to generate class type declarations.

add useDragResize hook

07 Aug 16:52
Compare
Choose a tag to compare

useDragResize

allows to capture the drag and drop of an element in order to execute its resizing, the return of X and Y corresponds to the percentage of the cartesian quadrant coordinate 4, (0...1, 0...1)

Module

import { useDragResize } from "@atomico/hooks/use-drag-resize";

Syntax

const ref = useRef();
const optionalInitialState= [ 1, 1]; // X, Y;
const [ isDragging, Xcoordinate, Ycoordinate ] = useDragResize(ref,optionalInitialState);

Resets the coordinate to the observed frequency

21 Jun 15:19
Compare
Choose a tag to compare

This modification alters the return of x and y, depending on the reference to be observed as a container.

Update @atomico/exports and add use-parallax

20 Jun 14:45
Compare
Choose a tag to compare

Update @atomico/exports

Before the @atomico/exports configuration did not generate compilation of the files, since the code of atomico/hooks was only JS, now the compilation step has been added to allow the use of TS, this does not generate side effects if your project export the hooks according to the package.json#exports.

use-parallax

returns the mouse coordinates based on a 4 quadrant cartesian plane, this allows to achieve mouse position sensitive effects, this hook is optimized to work only if the hook is intercepted.

const { x, y } = useParallax(refHost);

where:

  1. refHost: reference to the container to observe the movement of the mouse
  2. { x, y }: coordinates, from 0 to 1 according to the location of the Cartesian quadrant

fix use-responsive-state allowing regenerate state

25 May 04:02
Compare
Choose a tag to compare
3.43.1

fix use-responsive-state

enhancement for useRedirect

22 May 21:37
Compare
Choose a tag to compare

Now the target attribute, allows useRedirect to ignore the redirect.