Live data from Hacker News

Stencil – A reusable web component generator

stenciljs.com

101–107 of 107 posts

Re: Stencil – A reusable web component generator

#101

What is the browser support for web components? I worry that tools like this are only targeting the last two versions of the major vendors.

IE11+ will work and everything modern. If you don't have native support things get polyfilled. Youtube nowdays runs on Polymer, web components and they support older browsers.

Re: Stencil – A reusable web component generator

#102
post #97

I see two problems with stenciljs at the moment, but perhaps they can be fixed? 1, going back and forth in browser history, there is a flash of the footer being displayed before the actual content is loaded - it's just 1-2 frames, but very noticeable and disturbing. 2, scroll position is lost when visiting another page and going back. Those are typical single page app problems, but they will probably not matter when…

> scroll position is lost when visiting another page and going back

Who ever thought that keeping scroll position was a good idea anyway?

Use #s if the position is relevant.

Re: Stencil – A reusable web component generator

#103

Earlier quoted context omitted.

Here an engineer at Ionic. You don't need to integrate typescript to use a "widget" generated with Stencil. Stencil is a compiler that generates vanilla web components in javascript. You can just import the generated .js and use the component just like a "button" or native "input".

I think you should consider disassociating the TypeScript requirement in the compiler. You'll alienate developers (like me) who prefer Vanilla™ JavaScript. It's one of the things I love about Svelte (which you claim heritage to), in that they really try to conform to vanilla everything, i.e., HTML, CSS, JS. Everything else sounds terrific, though, especially the ability to do SSR.

It isn't really true that Svelte is just "vanilla" Javascript. For example, the compiler looks at the argument names of your computed properties to determine which data they depend on, which breaks with the semantics of Javascript. This means that Svelte only allows you to use function literals for computed properties.

Re: Stencil – A reusable web component generator

#105

As kind of an old dog, I can't help but think of Active X controls from back in the day. That's what this reminds me of. Kinda. Are there some guidelines and standardization of the kinds of events components emit, and what data is passed with the event? So that I don't have to look up all the variants of event names and data.

A custom element is just an HTML element, so it is a part of the HTML standard. If you log the object you can see it has all of the same properties as an HTML element, plus whatever you've extended it with. So all emitting events and event callbacks will behave the same as a standard element (except for any custom event listeners and emitters that you add).

Re: Stencil – A reusable web component generator

#106
post #77

Earlier quoted context omitted.

...and Safari? Which is actually a pretty popular browser (with good reason).

Safari 10.1 = 2.64% Safari 10.0 = 0.64% Safari 8.0 = 0.33% Safari 9.1 = 0.27% =================== Total = 3.88% For July 2017 according to NetMarketshare. I wouldn't call a 3.88% install base "pretty popular". It's also offers a terrible developer experience cf: https://www.netmarketshare.com/browser-market-share.aspx?qpr...

"desktop market share" != "market share"

Re: Stencil – A reusable web component generator

#107

Earlier quoted context omitted.

Okay, that is definitely needed if we want to build serious components. Else it's gonna go crazy heavy!

A simple solution today would be to put the shared, heavy code in it's own component and call methods directly on that component. That's how we're share code across components in Ionic.

Could you please add an example of this in the documentation? It looks great BTW.
Post reply on HN