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

@citydev/ui-library

v0.9.0

Published

city building UI library

Downloads

31

Readme

Introduction

To provide a consistent and standard UI design, a new standalone UI library package @citydev/ui-library is extracted and updated from the previous esb-ui-web in buildings project. Together with the storybook, you can refer for UI layout, API interface, and basic use cases. Please follow the steps below to proceed with library migration or adoption.

Usage

  1. Create .npmrc file in the root directory with content
    @citydev:registry= http://npm.envisioncn.com:7001/
  1. install @citydev/ui-library
    yarn add @citydev/ui-library
  1. update import path from esb-ui-web to @citydev/ui-library in your project in either way of below
import { Button } from '@citydev/ui-library';
import Button from '@citydev/ui-library/lib/components/Button';
  1. import the default theme on the top level of the application
import * as React from 'react';
import DemoPage from './pages/DemoPage';
import { theme } from '@citydev/ui-library/lib/theme.css';

function App() {
  React.useLayoutEffect(() => {
    document.body.classList.add(theme);
    return () => {
      document.body.classList.remove(theme);
    };
  }, []);

  return <DemoPage />;
}
export default App;
  1. Update webpack config file For multirepo project, just update in webpack config in the root directory. For monorepo project, update webpack config inside those modules that dependent on @citydev/ui-library

    Vanilla-extract is used in our library. To let the predefined style work properly, webpack config needs to update. To setup vanilla-extract, please follow vanilla-extract setup

const { VanillaExtractPlugin } = require('@vanilla-extract/webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  plugins: [new VanillaExtractPlugin(), new MiniCssExtractPlugin()],
  module: {
    rules: [
      {
        test: /\.vanilla\.css$/i, // Targets only CSS files generated by vanilla-extract
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: require.resolve('css-loader'),
            options: {
              url: false, // Required as image imports should be handled via JS/TS import statements
            },
          },
        ],
      },
    ],
  },
};

Vanilla-extract let developers write styles locally in TypeScript file and generate static CSS files at build time. When import @citydev/ui-library, we need to include @citydev/ui-library in js/jsx file that @vanilla-extract/babel-plugin can process the compiled css.js.

    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'babel-loader',
          options: {
            inputSourceMap: true,
            sourceMaps: 'inline',
            presets:  [
            ["@babel/preset-env", { targets: "last 2 versions" }],
            ["@babel/preset-react"],
          ],
            plugins: [
              '@babel/plugin-syntax-dynamic-import',
              '@vanilla-extract/babel-plugin',
            ],
          },
        },
        include: [path.resolve(__dirname, "src")],
        exclude: /node_modules(?!\/@citydev\/ui-library)/,
      }
  1. Run tsc command to check errors and fix them according to components' API interface update
    tsc -p tsconfig.json
  1. Now you can build and run you project. Once successful, you can remove the dependencies on esb-ui-web

Storybook

You can visit storybook to view components demo and docs (still in progress to cover more)

demo