-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Follow web components specs #18
Comments
What is |
I'm sorry, I mixed two concerns in my comment.
|
@lastmjs here is my two cents. Web Component SpecsKeep in mind that Web Components is 4 things
I am guessing that you refer ro the Custom Element piece of it. Anyway, I will talk from what we have right now and forget Rust for a moment because it doesn't really matter the language but the architecture of it. JSX vs Template LiteralJSX doesn't have to be React specific tool, in fact, you could use the same syntax for generate JSON structures, strings or any other data structure that is not React elements. Because JSX right now it is just a syntactic sugar code. I wouldn't use it, because if you use String instead of some syntactic sugar you will have to parse the string back to some data structures so you could do more advance operation with the AST. Keep in mind the whole spectrum of things around it, for example, now React uses JSON for do testing rather than render any HTML (super mega valuable) and so on. Working with Strings will makes harder to create tools, tools that save you time and improve your workflow, using standards or not do not matter because if that is the case projects like Babel (thanks God that we moved with it), Typescript, Flow, JSX and any of those non-standard tools would exists, right?! Even that, right now React/Vue/Angular Component vs Custom ElementsI don't see that a something fundamentally different, I am actually waiting for the day I will use Custom Elements + React/Angular or whichever one. The boilerplate required for it is too much, probably you are unaware if you use something like Polymer and those libs. Without those libs you will have to maintain setters and getters and DOM manipulation everywhere in your code. That is something really valuable, DOM manipulation is always hard to get it right specially when you talk about performance details that you get for free in libs like React. Right now the current model will work with anything from Web Components without any problem, because Web Components spec do not collide with anything from React/Angular/Vue or any other framework. I am still no understanding exactly what you mean, but if you refer to |
Good points, I'm just advocating the use of web components wherever plausible in this library to maintain maximum compatibility and modularity. I want to be able to use components written with yew in any framework or library |
Sounds like that is the plan? If so, awesome, and thank you for your thoughts |
Which part of Web Compornents?! If you are referring to Custom Elements that is not problem at all as it is, neither React or any other lib we do not use it in such of libs because Shadow DOM is not 100% and neither Custom Elements and HTML Import is on hold .... but that have nothing to do in how you write your components. I can use React based components inside my Custom Element |
Okay, thanks for all of the thoughts. Will Yew have first-class support for the custom elements spec? Custom elements is v1 stable, is implemented in Chrome, FireFox, Safari, and Edge is working on it. The polyfills are excellent for Edge in the meantime. Shadow DOM would be nice eventually, but I don't think it's as important to implement as custom elements, in terms of priority at least. Templates are already implemented essentially everywhere. There is no need for HTML imports, they're done, the community has moved on to ES modules and I believe that is working well for most everyone. So, will Yew support the following?
The most important thing to me is if I'll be able to author custom elements in Yew, and consume custom elements with Yew. |
IMO having custom elements with shadow DOM would be a killer feature, as it would allow for an effective data hiding with HTML classes and IDs. I'm still new to Rust, but I'd like to help implementing that if someone with more experience jumps on the issue. |
After doing some research on this I've found out this.
|
Missing label:
|
After reading through my earlier comments and thinking about this a bit, I would like to clarify my earlier points in case they weren't clear. IMO, I think it would be wise to consider exposing the base web components APIs as directly as possible, starting with and focusing on the custom elements API. A Yew component should be an HTML custom element, a DOM object. It should have all of the lifecycle methods of a custom element. It should be a DOM object under the hood. Any conveniences, like automatic getters and setters, can be built on top. This is what I would love to see. We probably need to wait on WebAssembly to mature a bit, especially waiting on access to the DOM from WebAssembly |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I think following the web components specs rather than JSX/React is a better long-term plan, something to look into. Take a look at projects like lit-html and hyperHTML. I'm not sure how well those will transfer over to Rust, since they depend on JS template strings.
Rather than implementing a Rust-specific component model, why not reuse the web component specs as much as possible? The component model has already been standardized in the web apis.
The text was updated successfully, but these errors were encountered: