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

lisa-prntr

v0.0.1

Published

A lightweight, zero-dependency TypeScript library for controlling print layouts in web applications. Lisa Prntr makes it easy to define which elements should be printed, customize page settings, and manage print-specific styles.

Downloads

5

Readme

Lisa Prntr

A lightweight, zero-dependency TypeScript library for controlling print layouts in web applications. Lisa Prntr makes it easy to define which elements should be printed, customize page settings, and manage print-specific styles.

Table of Contents

Installation

You can install Lisa Prntr using npm:

npm install lisa-prntr

Or using yarn:

yarn add lisa-prntr

Usage

Basic Usage

  1. Import the package:
import { lisaPrntr } from 'lisa-prntr';
  1. Add the data-printable attribute to elements you want to print:
<div data-printable>
  <h1>This will be printed</h1>
  <p>This content will also be printed</p>
</div>

<div>
  <p>This content will be hidden during printing</p>
</div>
  1. Initialize Lisa Prntr:
// Use default settings
lisaPrntr();

// Or with custom configuration
lisaPrntr({
  pageSize: 'A4',
  margin: '15mm',
  fontSize: '12pt'
});

Features

  • 🎯 Selective printing using data attributes
  • 📏 Customizable page sizes and margins
  • 🎨 Custom print-specific styles
  • 🚫 Hide specific elements during printing
  • 📱 Responsive print layouts
  • 💡 Zero dependencies

API Reference

Configuration Options

The lisaPrntr function accepts a configuration object with the following properties:

| Property | Type | Default | Description | |----------|------|---------|-------------| | pageSize | string | 'A4' | Sets the page size for printing | | margin | string | '20mm' | Sets the page margins | | bodyMargin | number | string | 0 | Sets the margin for the body element | | bodyPadding | number | string | 0 | Sets the padding for the body element | | selector | string | '[data-printable]' | Defines the selector for printable elements | | fontSize | string | '1em' | Sets the font size for printed content | | hideSelectors | string[] | - | Array of selectors to hide during printing | | additionalStyles | Record<string, Record<string, string>> | - | Additional custom styles for printing |

Examples

Basic Example

lisaPrntr({
  pageSize: 'A4',
  margin: '20mm',
  fontSize: '12pt'
});

Custom Selectors

lisaPrntr({
  selector: '.printable-content',
  hideSelectors: ['.no-print', '#navigation']
});

Advanced Styling

lisaPrntr({
  additionalStyles: {
    '.custom-header': {
      'font-size': '24pt',
      'color': '#333333'
    },
    '.page-break': {
      'page-break-before': 'always'
    }
  }
});

Development

  1. Clone the repository:
git clone https://github.com/kuameh/lisa-prntr.git
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Build the package:
npm run build

Scripts

  • npm run dev - Start development server
  • npm run build - Build the package
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier
  • npm run types - Generate TypeScript declarations

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR
  • Keep PR scope focused and specific

License

When I wrote this, only God and I understood what I was doing. Now, only God knows.

MIT License