npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@design.estate/dees-wcctools

v1.0.90

Published

A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.

Downloads

32

Readme

@design.estate/dees-wcctools

wcc tools for creating element catalogues

Install

To install @design.estate/dees-wcctools, you can use npm:

npm install @design.estate/dees-wcctools --save

Usage

The @design.estate/dees-wcctools package provides a set of tools for creating element catalogues using Web Components. It leverages LitElement for creating custom elements and provides a structured way to showcase and test these elements in various environments and themes.

Setting Up

First, ensure that your project is set up to use TypeScript and ESM syntax. This guide assumes you have a basic understanding of TypeScript and modern JavaScript development practices.

Start by importing the necessary tools from @design.estate/dees-wcctools in your main TypeScript file.

import { setupWccTools } from '@design.estate/dees-wcctools';

Defining Custom Elements

Define your custom elements using LitElement. Here's a simple example of an element:

import { LitElement, html, customElement } from 'lit';

@customElement('my-element')
class MyElement extends LitElement {
  render() {
    return html`<p>Hello, world!</p>`;
  }
}

Bootstrapping the WCCTools Dashboard

To showcase your elements, @design.estate/dees-wcctools provides a handy way to bootstrap a dashboard where your elements can be registered and displayed.

Create a bootstrap function in your main file or a separate module:

async function bootstrapWCCTools() {
  // Define your elements here
  const elements = {
    'my-element': MyElement, // Assuming MyElement is imported
  };

  // Optionally, define pages as functions returning Lit HTML Templates
  const pages = {
    home: () => html`<h1>Welcome to My Element Catalogue</h1>`,
  };

  // Setup the WCCTools dashboard
  setupWccTools(elements, pages);
}

Call this function to initialize your catalogue:

bootstrapWCCTools();

Configurations and Customizations

The setupWccTools function accepts two arguments: elements and pages.

  • elements: An object where keys are element tags (e.g., 'my-element') and values are the corresponding class definitions.
  • pages: An optional object where keys are page identifiers and values are functions returning Lit HTML templates.

Testing Elements

Once the dashboard is set up, navigate to your project in a web browser. You'll see a sidebar listing all registered elements and pages. Clicking on an element name will display it in the main view, allowing you to interact with it and see it in action.

Theme and Environment Testing

The dashboard also provides options for testing your elements in different environments (e.g., desktop, tablet) and themes (light or dark). This helps ensure that your elements are versatile and adaptable to varying conditions.

Expanding Your Catalogue

To add more elements to your catalogue, simply extend the elements object and rerun bootstrapWCCTools(). This modular approach makes it easy to maintain and expand your element catalogue.

Leveraging TypeScript

Using TypeScript allows you to enforce typing and build more reliable web components. Define properties with decorators, and use TypeScript's features to enhance your component development process.

import { LitElement, property, html, customElement } from 'lit';

@customElement('typed-element')
class TypedElement extends LitElement {
  @property({type: String})
  name: string = 'World';
  
  render() {
    return html`<p>Hello, ${this.name}!</p>`;
  }
}

Conclusion

@design.estate/dees-wcctools provides a powerful, flexible platform for developing, showcasing, and testing web components. By leveraging modern development practices like TypeScript and LitElement, you can build a robust catalogue of reusable web components ready for any project.

License and Legal Information

This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the license file within this repository.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.

Company Information

Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany

For any legal inquiries or if you require further information, please contact us via email at [email protected].

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.