tbroyer, to webdev
@tbroyer@piaille.fr avatar

Announcing Platformer: a set of libraries to help implement:

• attribute reflection in web components following the HTML specification
• WebIDL type coercions for your public JS APIs (including web component properties)

https://github.com/tbroyer/platformer

Comes with ECMAScript decorators (compatible with TypeScript 5.2+ and Babel) for vanilla custom elements and Lit elements.

Currently not published on NPM (as I'm still evaluating whether all of this is a good thing worth pursuing 😂 feedback welcome!)

tbroyer, to random
@tbroyer@piaille.fr avatar

For those interested, I just published on GitHub a series of tests for reflecting attributes in web components (see https://blog.ltgt.net/web-component-properties/ for the rationale, I'll update it soon following those tests), reusing the same tests as used by browsers for built-in elements.
Tests include (for now) vanilla custom elements and Lit custom elements.

https://github.com/tbroyer/custom-elements-reflection-tests

tbroyer,
@tbroyer@piaille.fr avatar

⬆️
Updated my post following those tests, as some code samples were wrong and I learned a few new things writing the tests:

https://blog.ltgt.net/web-component-properties/

BTW, also added FAST implementations to the test.

tbroyer, to webdev
@tbroyer@piaille.fr avatar

Built-in HTML elements' properties all share similar behaviors, that don't come for free when you write your own custom elements. Let's see what those behaviors are, why you'd want to implement them in your web components, and how to do it, including how some web component libraries actually don't allow you to mimic those behaviors.

https://blog.ltgt.net/web-component-properties/

molily, to javascript
@molily@mastodon.social avatar

Micro-library for building vanilla web components:

https://github.com/SirPepe/ornament by @sir_pepe

I think such libraries are the missing link of Web Components. Declarative attribute/prop handling instead of manual boilerplate. React to changes. Less opinionated, more flexible than libraries like Lit. Can be used with a template language or operate on the existing DOM. Light or shadow DOM.

Blog post in German: https://peterkroener.de/ornament/

tbroyer,
@tbroyer@piaille.fr avatar

@molily @sir_pepe Fwiw, this actually looks a lot like Lit's ReactiveElement: @property and @state properties become reactive and trigger a call to the update() method where you can update your element the way you want it.
LitElement extends ReactiveElement to render using lit-html, but ReactiveElement can be used standalone.

Btw, ReactiveElement also supports reactive controllers that are slowly spreading to other libraries: https://github.com/webcomponents-cg/community-protocols/issues/27

poke @justinfagnani

schizanon, to javascript
@schizanon@mas.to avatar

It's super cool that is supporting standard , but I'm still not going to use them!

Maybe one day when they don't need to be transpiled anymore.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • DreamBathrooms
  • cisconetworking
  • magazineikmin
  • InstantRegret
  • everett
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • khanakhh
  • Durango
  • mdbf
  • JUstTest
  • ethstaker
  • anitta
  • modclub
  • osvaldo12
  • normalnudes
  • ngwrru68w68
  • GTA5RPClips
  • tacticalgear
  • provamag3
  • tester
  • Leos
  • cubers
  • lostlight
  • All magazines