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

For discussion: Web components generation #1016

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

AlexMikhalev
Copy link
Collaborator

This PR is for discussion and not merging:
The idea is that it's quite easy to generate web components from atomic data classes by extending the ontology cli command—maybe via an additional flag and saving each web component as a separate file.
The user can use it:

<!-- Example usage -->
<atomic-bookmark 
  subject="https://atomicdata.dev/bookmarks/1">
</atomic-bookmark>

I used data browser as ontology.

@joepio
Copy link
Member

joepio commented Nov 20, 2024

I like this idea! Really interesting workflow.

@RoelLeijser could be relevant to your project.

@Polleps
Copy link
Member

Polleps commented Nov 20, 2024

Interesting Idea but I don't see why you would create a component for each class. You could make a form component that generates the form based on the resources class at runtime. We would also need a way to access the store inside the component. I believe attributes can only hold serializable values (so no class instances).
If there is just one form component there would also be no need to generate it with cli as we could just export it from @tomic/lib

@Polleps Polleps marked this pull request as draft November 20, 2024 13:49
@AlexMikhalev
Copy link
Collaborator Author

Form components can be a useful addition to @tomic/lib regardless of the proposed solution, but storing pre-built web components locally allows us to modify styles and UI presentation. At the same time, to maintain consistency between data model and interface we can leverage git to ensure versions of UI and data model/typescript types match.

@AlexMikhalev
Copy link
Collaborator Author

@Polleps, that's not far from generating templates for other frameworks. IMHO, the right way to use an atomic server isn't to start with code but with creating a domain ontology. Then, you can generate typescript bindings and corresponding web components, and you can add a flag to generate components for Astro/React/Svelte.

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.

4 participants