.

HD Mp4 3gp Video
Live Update Video
Play/Download
Live 3D App
Search.Pencarian Menu

Add text send email to rh3252705.adda@blogger.com or Click this (Text porn Will delete) | Tambah teks kirim email ke rh3252705.adda@blogger.com atau Klik ini (Teks porno akan dihapus)
Total pos : 19157+

[Go Make Things] An HTML Web Component library

Today, I've been thinking about how the industry could use a progressively enhanced HTML Web Component library. Something that's less a whole framework and more like Legos you can mix-and-match as needed.

Let's dig in!

The idea

I'm imagining a system that includes…

  • Base styles for all of the common HTML elements.
  • Loads of utility classes for nudging and tweaking things.
  • Group classes for styling more complex UI elements without a million little classes.
  • Easy customization with CSS variables.
  • Web Components to progressively add interactivity to functional HTML.
  • All of the Web Component HTML lives in the light DOM, so its easy to style and reason about.

I'm imagining something that can be loaded directly from a CDN, downloaded locally, or imported if you want to roll your own build.

I'm imagining something where you can use just the bits you need, and leave out the stuff you don't.

Mostly HTML and a few classes

When I write HTML, I like to be able to use HTML elements without having to slap classes on things by default.

<h2>I want this to work...</h2>  <p>Without classes to make things look like my design system.</p>

I like using utility classes to nudge and tweak layouts differently than the defaults.

<h2 class="no-margin-bottom">This heading has no bottom margin</h2>

And I like using group classes to avoid using groups of utility classes for common patterns.

<ul>  	<li>This is normal list...</li>  	<!-- ... -->  </ul>    <ul class="list-inline">  	<li>This is an inline list...</li>  	<!-- ... -->  </ul>

I call this approach HUG CSS.

Progressively enhanced HTML Web Components

When I use Web Components, I usually use them to enhance some already functional HTML.

For example, I might have a <form> element on the page, and use a Web Component to make JavaScript fetch() calls with it.

<ajax-form>  	<form action="/path/to/api" method="POST">  		<!-- ... -->  	</form>  </ajax-form>

Or I might use a Web Component to turn some headings into an accordion group

<accordion-group headings="h2">  	<h2>Question 1</h2>  	<div>Answer...</div>    	<h2>Question 2</h2>  	<div>Another answer...</div>  </accordion-group>

This is different from how a system like, say, Web Awesome works. In that library, a <button> starts it's life out as a non-interactive snippet of text, and only becomes a button after JavaScript loads.

<!--   	Web Awesome Buttons   	These are useless without JS  -->  <wa-button>Active Me</wa-button>

I get why some folks like this. It's very React-like.

But I also think it defeats so much of the power of Web Components.

Other ideas

I love that Web Components self-instantiate…

<!-- Renders as $1,295 for US visitors after JS loads -->  <convert-to-money>1295</convert-to-money>    <script src="/path/to/convert-to-money.js"></script>

But I would also love an option to let folks bind Web Components to their own custom elements if they'd prefer…

import { ConvertToMoney } from './path/to/convert-to-money.js';  customElements.define('money-format', ConvertToMoney);  

I could also imagine a CDN that returns just the stuff you need, without you ever having to run a build.

<script src="/wc-library.js?include=ConvertToMoney+AjaxForm+Accordion+group"></script>

Or a web builder where you can select the stuff you want to include, and it spits out a build for you (both minified and unminified).

I'd like to build this!

I've already got a lot of the pieces.

  • I've been using my own CSS library, Kraken, for years on personal and professional projects.
  • I maintain a collection of standalone HTML Web Components over in my membership garden.
  • I've maintained various open source projects for years.
  • I love writing good documentation and teaching people.

Would a freemium open source project like this be interesting to you?

I'm not sure what the free vs. pro setup would look like yet, but I'd like to keep as much of the core functionality as possible free, with some advanced components, the builder, and/or personal support as part of a pro purchase.

I'd love to hear your thoughts!

Like this? A Go Make Things membership is the best way to support my work and help me create more free content.

Cheers,
Chris

Want to share this with others or read it later? View it in a browser.

Share :

Facebook Twitter Google+ Lintasme

Related Post:

0 Komentar untuk "[Go Make Things] An HTML Web Component library"

Back To Top