Skip to content

Releases: atomicojs/atomico

Add support for fragments and improve the use of props

14 Sep 15:41
Compare
Choose a tag to compare

Add support for fragments

You can now use the <></> fragment tag through jsx-runtime.

Improve the use of props

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

Fix TS types for useProp

01 Sep 16:07
Compare
Choose a tag to compare
1.62.4

Fix TS types for useProp

Fix at typescript level for setState and useProp

31 Aug 14:00
Compare
Choose a tag to compare

Fix type errors at Ts level for useProp and useCallback

29 Aug 04:12
Compare
Choose a tag to compare

Fixes types for TS with erroneous behavior from version 1.62.0. Bug reference: #90

Fix context synchronization by non-parallel mount

24 Aug 15:12
Compare
Choose a tag to compare

This context synchronization error occurs when mounting the components directly in the HTML, now atomico synchronizes the contexts in non-parallel mounting situations.

[email protected] 🎉, welcome to the new context api

21 Aug 18:02
Compare
Choose a tag to compare

The new Context api is introduced and internal and external improvements are added at the type level

  1. rewrite Atomico virtualDOM and hook types for better internal maintainability: Now Atomico's internal api shares the exposed type api, which improves maintainability as they are now directly related.
  2. Now the pipeline before test validates Atomico typing internally, externally and tsx through Typescript.
  3. Add context as part of the core.

New context api

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>;

Fix meta props when using Component type (TS)

18 Jul 19:44
Compare
Choose a tag to compare

This fixes type validation when using the Component type, correctly completing meta props

#82 (comment)

New feature for TS

16 Jul 03:54
Compare
Choose a tag to compare

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
}}/>

fix ssr mode detection

04 Jul 02:40
Compare
Choose a tag to compare
1.60.3

fix ssr mode detection

Fix path SSR

03 Jul 06:14
Compare
Choose a tag to compare
1.60.2

fix path