Live data from Hacker News

Ways to make a web component

webcomponents.dev

131–140 of 200 posts

Re: Ways to make a web component

#131

It infuriates me that the concept of composable web pages using small templates/components is not baked into the html spec and supported by browsers. Every bit of code that we write in any programming language is made of composable bits which can be imported into other bits of code. But we cannot do anything similar with html. every time any attempt at having composable component based html is made, it gets mired dow…

I would 100% be in favour of an alternative to the DOM designed specifically for building rich application UIs. With upcoming features like portals it could even be embedded within existing HTML documents, or vice versa.

I’ve griped about this before, but I firmly believe that the trope of JavaScript developers needing a million dependencies and constantly reinventing the wheel stems from the fact that you have to do every damn thing yourself (else install a package or 50). The platform provides almost nothing (except, of course, the most remarkable distribution platform we’ve ever seen). The amount of hoops we all jump through to make building web app UIs tolerable is insane.

Want a filterable select that doesn’t make you type the first exact n characters really fast to find what you’re looking for? Gotta build it yourself. Hope you remembered to make it accessible and responsive!

There isn’t even an in-built option for pop-out menus, a feature of GUIs as old as GUIs themselves.

At the end of day the web is now as much an application platform as it is a hypermedia platform. We need better tools.

Re: Ways to make a web component

#132

It infuriates me that the concept of composable web pages using small templates/components is not baked into the html spec and supported by browsers. Every bit of code that we write in any programming language is made of composable bits which can be imported into other bits of code. But we cannot do anything similar with html. every time any attempt at having composable component based html is made, it gets mired dow…

Doing this with Adobe's Flex, was very easy. And at least for some time, fully integrated in their Flex Builder.

But flash died, so did flex. (that means, the apache foundation still tries to reanimate flex with a js/html exporter, but I doubt it ever gets stable)

Re: Ways to make a web component

#133
post #115

I've rewrote the frontend of one of my personal apps from react to webcomponents lately. For me, the most interesting aspect was that it's part of standards, requiring no dependency, so it means that I can use this app for decades without having to maintain it. For the same reason, only the first example in this page would do for me (the one based on standard without using any library). But I suppose that for actuall…

> For me, the most interesting aspect was that it's part of standards, requiring no dependency, so it means that I can use this app for decades without having to maintain it. I mean, you can also do that with React. Just don't update the library. The reason a web-component for decades without maintenance is because you won't be using all the new features— same thing.

I think the difference is that when you design a full React app, everything sit on the same "React base". If you want to move to upgrade to a new React version everything needs to upgrade. And if you need to migrate to Vue or Ember or Svelte... everything needs to migrate (or move to some sort of microfrontend strategy. But given the javascript cost of some of these frameworks, it's not cheap to go this route).

Web Components have a longer life span as they can be used in another app or another version with another technology without been migrated. Makes more sense for expensive component that have been battle tested. You don't want to rewrite them.

Re: Ways to make a web component

#134
post #89
post #62

Earlier quoted context omitted.

SVG has the concept of re-usable components. Maybe in 10 years we can replace HTML with SVG. hides I'm sure that would make it much, much harder for people with accessible needs.

Reusing SVG elements isn't as easy as they claim either, and they seem to have taken some of the options away in SVG 2.0

Also SVG has also some very ugly things in the spec. And you would have to build up every UI-Element by yourself. It would have nothing to do with SVG, if it would be like HTML.

Re: Ways to make a web component

#135

It infuriates me that the concept of composable web pages using small templates/components is not baked into the html spec and supported by browsers. Every bit of code that we write in any programming language is made of composable bits which can be imported into other bits of code. But we cannot do anything similar with html. every time any attempt at having composable component based html is made, it gets mired dow…

In other words, HTML is unabstractable. I've been wishing to be able to type this since 1997.

my tag!

Same with css. There are workarounds we use because abstraction is a requirement to code. Somehow the web components spec even seems like a workaround, for which we have many workarounds... and around and around we go :)

Re: Ways to make a web component

#136

I have a server-side rendering approach that can get instantaneous paint of arbitrarily-complex views after pulling down index.html and exchanging a single pair of websocket messages. Once the initial page is loaded, redraws are as fast as you can get packets between the machines plus 2-3ms for decoding. It involves some very unorthodox methodologies and has latency constraints (similar to Google Stadia hosting model…

I'd be very interested in hearing more about your work on this technology.

Re: Ways to make a web component

#137

I have a server-side rendering approach that can get instantaneous paint of arbitrarily-complex views after pulling down index.html and exchanging a single pair of websocket messages. Once the initial page is loaded, redraws are as fast as you can get packets between the machines plus 2-3ms for decoding. It involves some very unorthodox methodologies and has latency constraints (similar to Google Stadia hosting model…

> as fast as you can get packets between the machines

This seems like a really big limitation

Re: Ways to make a web component

#138

It infuriates me that the concept of composable web pages using small templates/components is not baked into the html spec and supported by browsers. Every bit of code that we write in any programming language is made of composable bits which can be imported into other bits of code. But we cannot do anything similar with html. every time any attempt at having composable component based html is made, it gets mired dow…

Your frustration is understandable, but so too is why they never were -- HTML was never intended to be a programming language or component-based. HTML was originally meant to be page-based. And pretty much everything added to it (CSS, JavaScript) is scoped to the page. (Some data storage like cookies is scoped to the domain.) So shoehorning a "component" model to what is fundamentally page-based is essentially an imp…

This is not true. It does not matter that HTML is page-based to be able to provide an abstraction for components of elements of the page.

Re: Ways to make a web component

#139

Earlier quoted context omitted.

I could have sworn several years ago, before React, Vue, Angular X started to pick up, that WebComponents were supposed to be that. That people were talking about how browsers would have built-in support for WebclComponents. I could be remembering wrong though.

Browsers do have built-in support for web components. You can extend HTMLElement in every current major browser.

And such extension is a major PITA to do. The API is atrocious, like most of the DOM API is.

Re: Ways to make a web component

#140

I have a server-side rendering approach that can get instantaneous paint of arbitrarily-complex views after pulling down index.html and exchanging a single pair of websocket messages. Once the initial page is loaded, redraws are as fast as you can get packets between the machines plus 2-3ms for decoding. It involves some very unorthodox methodologies and has latency constraints (similar to Google Stadia hosting model…

That sounds a bit like Vaadin: https://vaadin.com/
Post reply on HN