Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared | Autogen: Adding support for standalone components #372

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

reb-dev
Copy link
Collaborator

@reb-dev reb-dev commented Apr 20, 2024

This PR updates component autogeneration logic so that all Unovis components (not containers) can be automatically generated when running npm run generate. Previously, our standalone components BulletLegend, LeafletMap and LeafletFlowMap had to be updated manually in the React and Angular wrappers.

In addition to autogen, another motivation for this change is to ensure our list in shared/integrations/components is complete. This allows the list be used for multiple purposes across the codebase (docs, commitlint, etc).

closes: unovis/issues-only#41

Copy link
Contributor

@rokotyan rokotyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this @reb-dev!

I'm also planning to allow stand-alone components like Bullet Legend to be appended straight to the provided DOM node to simplify styling when used with UI frameworks like React. Currently we have double divs — one comes from the framework (e.g. via a ref), and another one is created by a component.

For example, here's a Bullet Legend change that I've already tested with a published beta:

constructor (element: HTMLElement, config?: BulletLegendConfigInterface) {
    this._container = element
    this.div = config?.renderIntoProvidedDomNode ? select(this._container) : select(this._container).append<HTMLElement>('div')
...

And the the React wrapper the initialization looks like this:

const c = new BulletLegend(container.current as HTMLDivElement, { ...props, renderIntoProvidedDomNode: true })

If I create a Pull Request with these changes, will you be able to incorporate them in this autogen update too?

packages/react/autogen/component.ts Outdated Show resolved Hide resolved
@reb-dev
Copy link
Collaborator Author

reb-dev commented Apr 23, 2024

If I create a Pull Request with these changes, will you be able to incorporate them in this autogen update too?

@rokotyan Sure 👍

@reb-dev reb-dev merged commit 8f71e4d into main Apr 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants