atomicojs / atomico

Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
https://atomicojs.dev
MIT License
1.15k stars 43 forks source link

Support setting a Host return type in Component contract #82

Closed efoken closed 2 years ago

efoken commented 2 years ago

IMO the Component type should also support defining a ReturnType, like we can do when using function componentName(props: Props<typeof props>): Host<{}>

Should be something like this:

export type Component<props = null, meta = any> = props extends null
  ? {
      (props: FillObject): Host<meta>;
      props?: SchemaProps;
      styles?: Sheets;
    }
  : {
      (props: DOMProps<props>): Host<meta>;
      props: SchemaInfer<props> & MetaProps<Partial<props>>;
      styles?: Sheets;
    };
UpperCod commented 2 years ago

Thanks @efoken , Good idea, now in atomico@1.61.0 setting meta props is supported in the way you comment https://github.com/atomicojs/atomico/releases/tag/1.61.0

I am attentive if the shared version solves your issue.


By the way, on the Atomico site I plan to add the following block:

Web 1280 – 14

I would be very happy if you have any project, ideal or Company in which you have applied Atomico (Only if it can be public) with this I hope to further encourage the use of Atomico 😊

efoken commented 2 years ago

Thanks for changing this, but now I have another problem: For all components that use the Component contract, all other DOM properties (like aria-*, onclick, onkeydown, etc.) are missing in type definitions.

Screenshot 2022-07-18 at 18 06 55
efoken commented 2 years ago

By the way, on the Atomico site I plan to add the following block:

Web 1280 – 14

I would be very happy if you have any project, ideal or Company in which you have applied Atomico (Only if it can be public) with this I hope to further encourage the use of Atomico 😊

I'm working at IBM iX and we are using Atomico for the client Barmer for building everything new from the ground up. We have React Native (Web) components and also WebComponents using Atomico and share a lot of code like styles, helpers and hooks, and we already launched the new app, based on React Native – new website is following @ some day, which will be based on WebComponents πŸ™‚

We are also currently working on a public website for the Design System

UpperCod commented 2 years ago

regarding the bug

Ready fixed in version 1.61.1.

regarding the use case

I am really happy with the news😊, I hope to be able to share all this on the Atomico site, can I reference your use case on the Atomico site?

efoken commented 2 years ago

Issue is fixed now, thank you πŸ™

Of course you can reference our usecase, that would be really great 😊