-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for component names (#120)
## Proposed changes ~Change the API, to remove the necessity of a wrapper for `gsx.Component`. It is still useful to reference either the `gsx.Component` type or the `gsx.ComponentProps` type, but they are technically optional if your component does not accept children.~ Cleaned up the execution model (removes the extra nested function). ~I opted not to remove `gsx.StreamComponent`. It is possible, but requires that `jsx` infer whether it is a stream component or not by the fact that the result is a `Streamable`. This gets a bit strange because Arrays are technically `IterableIterators`, so it can be ambiguous to distinguish between an array result (which should not be collapsed) and an iterator (with should be collapsed) when `props.stream` is undefined. So by keeping the `StreamComponent` wrapper, the developer makes it very clear what their intention is.~ ~I'm on the fence as to whether this is an overall improvement to the framework or not. On one hand, it enables slightly simpler component definition, but on the other, if you forget to use `gsx.ComponentProps` or `gsx.Component` type, the compiler will not allow you to pass children to the component. As far as I can tell, there is no typing magic we can use to make the compiler function otherwise. So this introduces a foot gun, with limited benefit (still need to use `gsx.Component` anywhere you define a component, but its just a type now).~ After a bunch of discussion we opted to keep the `gsx.Component` wrapper, and add a `name` parameter. Still fixed up the execution model to remove the unnecessary nested function.
- Loading branch information
Showing
26 changed files
with
620 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.