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

eldav1d-marvel-ui

v1.2.0

Published

UI library for (and from) Playing with Marvel API

Downloads

459

Readme

ElDav1d Marvel UI: DEVELOPMENT

This is an UI library effort consisting in the abstraction of presentational logic applied on my pet project Playing with Marvel API

It mimics the look and feel of the Marvel Characters page.

The approach relies on vite's library mode and is heavily inspired by this article and this hybrid implementation

Stack is React + TypeScript + Vite + Vitest + React Testing Library + Storybook + TailwindCSS

TailwindCSS is applied as Peer Dependency. Be dareful about conflicts with your tailwind.config.js or your version, if your project has it already installed.

Features

Support for both ECMAScript Modules and CommonJS

  • Outputs:
    • esm and cjs source files
    • source maps for JavaScript files (.js.map)
    • esm and cjs declaration files (.d.ts and .c.ts)
    • esm and cjs source maps for declaration files (.d.ts.map and .c.ts.map)
    • compiled and uglified CSS (consuming app is not required to support css modules)
  • Subpath exports for explicit path referencing. Will auto map to the right module system
  • Libraries are externalized for a lighter bundle size (react, react/jsx-runtime, tailwindcss, react-lazy-load-image-component)

Prerequisites

You need Node.js and npm or yarn installed on your machine. To check if you have Node.js installed, run this command in your terminal:

node -v
yarn -v

Install the dependencies:

npm install or yarn

Main Scripts

npm run storybook or yarn storybook

Starts the Storybook tool for developing UI components in isolation. Open http://localhost:6006 to view it in the browser.

npm run test or yarn test

Launches the test runner for the whole project.

npm run build or yarn build

Builds the app for production to the dist folder. It takes this sequence:

  • clean previous build: remove ./dist directory and its contents

  • compile JS: with specific ./tsconfig-build.json

  • build: creates production bundle on new ./dist directory

  • rename CSS file: into ./dist/lib.css preventing conflicts on consumer

  • clean irrelevant files: removes tests and stories for optimal bundle size

ElDav1d Marvel UI: USAGE

Install package

npm i 'eldav1d-marvel-ui'
yarn add 'eldav1d-marvel-ui'

Import CSS

On top of your project, in order make it available

//src/App.tsx

import 'eldav1d-marvel-ui/dist/lib.css';
...

Import and apply components constants or utilities

All available with named imports

//tailwind.config.js

import { MARVEL_RED } from 'eldav1d-marvel-ui/'
...
module.exports = {
  theme: {
    extend: {
      colors: {
        red: MARVEL_RED,
      },
    },
  },
}
//src/App.tsx

import { Loader } from 'eldav1d-marvel-ui/'
...
function App() {
  return <Loader loadingLabel={'...loading'} />
}