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

@meta-ultra/responsive-view

v0.2.1

Published

<div> <img style="display:inline;" src="https://img.shields.io/github/package-json/v/meta-ultra/responsive-view?filename=packages%2Fresponsive-view%2Fpackage.json"> <img style="display:inline;" src="https://img.shields.io/bundlephobia/min/%40meta-ul

Downloads

8

Readme

Welcome to @meta-ultra/responsive-view

Inspired by autofix.js, @meta-ultra/responsive-view provides a pretty much preciser React based responsive solution for Big Screen or Digital Cockpit.

🏠 Installation

Install @meta-ultra/responsive-view with your favorite package manager:

  • pnpm: pnpm add @meta-ultra/responsive-view@latest
  • yarn: yarn add @meta-ultra/responsive-view@latest
  • npm: npm install -S @meta-ultra/responsive-view@latest

✨ Usage

It's easy peasy to make the whole components responsive by wrapping them with ResponsiveView.div component.

import { 
  ResponsiveMode, 
  ResponsiveProvider, 
  ResponsiveView, 
} from "@meta-ultra/responsive-view"

const App = () => {
  return (
    <ResponsiveProvider config={{
      draftWidth: 1920,          // the width of draft
      draftHeight: 1080,         // the height of draft
      minScale: 0.5,             // minimum scaling ratio for each axis
      mode: ResponsiveMode.FILL, // fill up the screen size completely
    }}>
      <ResponsiveView.div>{/*...the whole application*/}</ResponsiveView.div>
    </ResponsiveProvider>
  )
}

If you want to make a single existing component and its children components become responsive, ResponsiveView will be a great choice.

import { 
  ResponsiveMode, 
  ResponsiveProvider, 
  ResponsiveView, 
} from "@meta-ultra/responsive-view"

const App = () => {
  return (
    <ResponsiveProvider config={{
      draftWidth: 1920,          // the width of draft
      draftHeight: 1080,         // the height of draft
      minScale: 0.5,             // minimum scaling ratio for each axis
      mode: ResponsiveMode.FILL, // fill up the screen size completely
    }}>
      <ResponsiveView>
        <div>I gonna be responsive right now :)</div>
        <div>I'm still for fixed screen size :(</div>
      </ResponsiveView>
    </ResponsiveProvider>
  )
}

Is there a way to responsify a single component no impacts on its children? There you go - useScaledSize.

import { type ReactNode } from "react"
import { 
  ResponsiveMode, 
  ResponsiveProvider, 
  useScaledSize,
} from "@meta-ultra/responsive-view"

const Header = ({children}: {children: ReactNode}) => {
  // return the scaled size based on screen size and draft size of h1
  const scaledSize = useScaledSize({
    scaling: true, // update state when resize event of window fires
    width: 600,    // the draft width of h1
    height: 100,   // the draft height of h1
  })
  return <h1 style={scaledSize}>{children}</h1>
}

const App = () => {
  return (
    <ResponsiveProvider config={{
      draftWidth: 1920,          // the width of draft
      draftHeight: 1080,         // the height of draft
      minScale: 0.5,             // minimum scaling ratio for each axis
      mode: ResponsiveMode.FILL, // fill up the screen size completely
    }}>
      <Header>Title with fixed font size</Header>
    </ResponsiveProvider>
  )
}

👶 Author

Hey, friends. I'm John Huang, a full stack developer majorly code with React, Next.js, GraphQL, TailwindCSS, Taro and SpringBoot. Feel free to contact with me 😃

🤝 Contributing

Contributions, issues and feature requests are welcome! Feel free to check issues page.