All Projects â†’ mixpanel â†’ Webcomponent

mixpanel / Webcomponent

Lightweight utilities for constructing web components

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Webcomponent

Awesome Webcomponents
A curated list of awesome Web Components tools, articles and resources.
Stars: ✭ 337 (+5516.67%)
Mutual labels:  webcomponents
Vanilla Colorful
A tiny color picker custom element for modern web apps (2.7 KB) 🎨
Stars: ✭ 467 (+7683.33%)
Mutual labels:  webcomponents
Rendertron
A Headless Chrome rendering solution
Stars: ✭ 5,593 (+93116.67%)
Mutual labels:  webcomponents
Vaadin Core
An evolving set of free, open source web components for building mobile and desktop web applications in modern browsers.
Stars: ✭ 382 (+6266.67%)
Mutual labels:  webcomponents
Vaadin
An evolving set of open source web components for building mobile and desktop web applications in modern browsers.
Stars: ✭ 424 (+6966.67%)
Mutual labels:  webcomponents
Shoelace
A collection of professionally designed, every day UI components built on a framework-agnostic technology. 🥾
Stars: ✭ 5,904 (+98300%)
Mutual labels:  webcomponents
Snuggsi
snuggsi ツ - Easy Custom Elements in ~1kB
Stars: ✭ 288 (+4700%)
Mutual labels:  webcomponents
Nx
Smart, Fast and Extensible Build System
Stars: ✭ 9,737 (+162183.33%)
Mutual labels:  webcomponents
Framework
A modular front-end framework - inspired by the server-side and Web Components.
Stars: ✭ 448 (+7366.67%)
Mutual labels:  webcomponents
React Svg Pan Zoom
👀 A React component that adds pan and zoom features to SVG
Stars: ✭ 569 (+9383.33%)
Mutual labels:  webcomponents
Vaadin Grid
vaadin-grid is a free, high quality data grid / data table Web Component. Part of the Vaadin components.
Stars: ✭ 383 (+6283.33%)
Mutual labels:  webcomponents
Mosaic
🎨 A front-end JavaScript library for building user interfaces!
Stars: ✭ 390 (+6400%)
Mutual labels:  webcomponents
Resize Observer
Polyfills the ResizeObserver API.
Stars: ✭ 540 (+8900%)
Mutual labels:  webcomponents
Westore
更好的小程序项目架构
Stars: ✭ 3,897 (+64850%)
Mutual labels:  webcomponents
Reactive Elements
Allows to use React.js component as HTML element (web component)
Stars: ✭ 695 (+11483.33%)
Mutual labels:  webcomponents
Spectrum Web Components
Spectrum Web Components
Stars: ✭ 314 (+5133.33%)
Mutual labels:  webcomponents
Awesome Stenciljs
List of Awesome Web Components Built with StencilJS
Stars: ✭ 520 (+8566.67%)
Mutual labels:  webcomponents
Slim.js
Fast & Robust Front-End Micro-framework based on modern standards
Stars: ✭ 789 (+13050%)
Mutual labels:  webcomponents
Bounty
Javascript and SVG odometer effect library with motion blur
Stars: ✭ 724 (+11966.67%)
Mutual labels:  webcomponents
Elix
High-quality, customizable web components for common user interface patterns
Stars: ✭ 546 (+9000%)
Mutual labels:  webcomponents

webcomponent

Build Status

Sauce Test Status

Lightweight utilities for constructing Web Components

Installation

Install via npm, for packaging with a bundler such as Webpack or Browserify:

npm install --save webcomponent

If your target environment does not have native support for Web Components, you should include a separate polyfill such as webcomponents.js.

Usage

Register web components by extending the WebComponent class instead of HTMLElement:

import WebComponent from 'webcomponent';
class MyWidget extends WebComponent {
  connectedCallback() {
    // ...
  }

  get myprop() {
    // ...
  }
  // etc
}
customElements.define('my-widget', MyWidget);

WebComponent is a thin wrapper around HTMLElement which

Built-in helper methods

getJSONAttribute(attrName [, errorHandler])

Parse an attribute which has been serialized as JSON, e.g.,

<my-widget data-magic-numbers="[1,2,3]">
this.getJSONAttribute('data-magic-numbers') // [1, 2, 3]

If no errorHandler is passed, JSON-parsing errors will result in null being returned.

getNumberAttribute(attrName)

Parse a numeric attribute, e.g.,

<my-widget-list num-widgets="15">
this.getNumberAttribute('num-widgets') // 15

Non-numeric values will return null.

isAttributeEnabled(attrName)

Check whether a boolean-like attribute is 'enabled', taking into account usages such as:

<my-widget awesome="true">     <!-- enabled -->
<my-widget awesome>            <!-- enabled -->
<my-widget awesome="awesome">  <!-- enabled -->
<my-widget awesome="false">    <!-- disabled -->
<my-widget>                    <!-- disabled -->

Development

Install dependencies: npm install

Run local demo:

Running tests

Browser tests run with Selenium through web-component-tester.

Run with locally installed browsers

npm test

Tunnel to Sauce Labs

npm run build-test && npm run test-browser-sauce

Set credentials with environment variables SAUCE_USERNAME and SAUCE_ACCESS_KEY. The default browser/OS matrix is defined in wct.conf.json.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].