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

@pap-it/switch

v1.0.25

Published

Atomic Type: atoms

Downloads

27

Readme

Switch

Atomic Type: atoms

Version: Version: Version: 1.0.25

Use Case

installation

npm install @pap-it/switch

to use in html

<script type="module" defer>
  import "@pap-it/switch/wc"
</script>

<pap-switch></pap-switch>

to use in react

import { Switch } from "@pap-it/switch/react";

function Component() {
  return (
    <Switch /> 
  )
}

Development

Development takes place within the src folder. To add a new subcomponent, use the command npm run component:add. This command updates the .env file, creates a view folder, and adds a subfolder in the components folder (creating it if it doesn't exist) inside src with all the necessary files.

Styling is managed in the style.scss file, which automatically generates a style.ts file for use in the component.

Viewing

To view the component, run npm start. This command is equivalent to npm run start demo and launches the development server for the demo folder located within the views folder. This allows you to preview your component during development.

Assets

All assets required by the component, such as icons and images for translations, should be placed in the assets folder. This folder will already include an icons and translations folder with an en.json file for English translations. Use this structure to organize translations and make them easily accessible for other projects.

For assets used solely for display or demo purposes, create a public folder under the relevant directory inside the views folder. These assets are not included in the component package.

Commands

  • build: Builds the component in development mode. Use the --prod flag (npm run build -- --prod) for a production build, which includes minification.
  • watch: Watches for changes to the component files and rebuilds them automatically without starting the development server.
  • start: Starts the development server for a specific demo. The target folder within the views directory must contain an index.html file. Usage example: npm run start --name=<folder>.
  • analyse: Generates a comprehensive analysis file, mainly useful for React scripts and potentially for generating pages. The analysis file is only generated if it does not exist, unless the --force flag is used. Optional flags include --verbose and --force.
  • react: Generates the necessary React code based on the web component code, including any subcomponents. The generated code will not overwrite existing files, allowing for manual customization. Flags: --verbose & --force.