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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ui-generator-lib

v1.0.5

Published

A library for generating user interfaces based on JSON files or PSD/JPG images.

Readme

UI Generator Library

Overview

The UI Generator Library is a JavaScript library that allows users to generate user interfaces based on JSON files or PSD/JPG images. It provides a flexible way to configure APIs, set alignment (horizontal or vertical), and apply custom styles to the generated UI components.

Features

  • Generate UI from JSON or image files
  • Configure API endpoints and parameters
  • Set alignment for UI components
  • Apply custom styles to UI elements

Installation

To install the UI Generator Library, use npm:

npm install ui-generator-lib

Usage

Importing the Library

To use the library, import it in your JavaScript file:

import { UIBuilder, JsonParser, ImageParser, ApiConfig } from 'ui-generator-lib';

Generating UI from JSON

To generate a UI from a JSON file:

const jsonParser = new JsonParser();
const uiBuilder = new UIBuilder();

const jsonData = jsonParser.parseJson('path/to/your/file.json');
uiBuilder.buildUI(jsonData);

Generating UI from Images

To generate a UI from a PSD or JPG file:

const imageParser = new ImageParser();
const uiBuilder = new UIBuilder();

const imageData = imageParser.parseImage('path/to/your/file.psd');
uiBuilder.buildUI(imageData);

Configuring APIs

To configure API endpoints:

const apiConfig = new ApiConfig();
apiConfig.configureApi({
  endpoint: 'https://api.example.com/data',
  method: 'GET',
});

Setting Alignment

To set the alignment of UI components:

import { setAlignment } from './utils/alignment';

setAlignment('horizontal'); // or 'vertical'

Applying Styles

To apply custom styles to the UI components:

uiBuilder.applyStyles({
  backgroundColor: 'blue',
  color: 'white',
});

API Reference

  • JsonParser

    • parseJson(filePath): Parses the JSON file and returns the data.
    • validateJson(jsonData): Validates the structure of the JSON data.
  • ImageParser

    • parseImage(filePath): Parses the image file and extracts UI components.
    • validateImage(imageData): Validates the integrity of the image data.
  • UIBuilder

    • buildUI(data): Constructs the user interface based on the provided data.
    • applyStyles(styles): Applies custom styles to the UI components.
  • ApiConfig

    • configureApi(config): Configures API endpoints and parameters.
    • validateApi(apiConfig): Validates the API configuration.
  • Alignment

    • setAlignment(direction): Sets the alignment of UI components (horizontal or vertical).

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.