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

vue-adaptive

v2.0.2

Published

A rem scale adaptive with breakpoints for Vue.js

Readme

vue-adaptive

A rem scale adaptive with breakpoints for Vue.js

npm npm npm bundle size (version) Inline docs MIT GitHub issues GitHub last commit David CodeFactor codecov Commitizen friendly

Setup

Install vue-adaptive from npm: npm i vue-adaptive --save

Or yarn: yarn add vue-adaptive

Then import plugin and use in your main.js

import Vue from 'vue'
import Adaptive from 'vue-adaptive'

Vue.use(Adaptive, config)

Configuration

Configuration object has two parts:

1. Global configuration

Configuration object has object named 'global' in it. This object contains all global parameters of plugin.

{
  "global": {
    "rem": 10,
    "throttling": 17,
    "orientationTestCount": 25,
    "orientationChangeTimeout": 1000
  }
}

rem: Default rem value in case no breakpoint matched. Default: 10.

throttling: Time in milliseconds, changes the frequency of viewport update. May be useful if you don't care about changes step and want to reduce CPU usage. Default: 17 (60fps frame time).

orientationTestCount: Count of checks with identical results meaning orientationchange event is over. Default: 25.

orientationChangeTimeout: Max duration of the orientationchange event. Default: 1000.

2. Devices (breakpoints) configuration

Besides 'global' object configuration object represents a list of breakpoints (or devices)

Device structure is:

<device>: {// Device (and global class) name
    if: <if>,
	element: <selector>,
	rem: <px>
	from: {
		width: <fromWidth>,
		height: <fromHeight>
	},
	to: {
		width: <toWidth>,
		height: <toHeight>
	},
	base: {
		width: <toWidth>,
		height: <toHeight>
	},
	k: <k>
}

element: String or HTMLElement, contains element selector that will be used for detecting viewport. Default: window.

if: Condition, functions(viewport), viewport contains width and height of element, function affects device type.

rem: Static rem value, overrides k and base.

from: Minimal width and height for setting device.

to: Maximal width and height for setting device.

base: Base width and height for rem calculation.

k: Additional k for rem calculation.

setDevice: Boolean, if true adaptive will set class or no-class and deviceType based on device name.

You also can create many breakpoints for one device by adding name to device, for example:

{
  "desktop:wide": {
    "rem": 10,
    "from": {
      "width": 1366
    }
  },
  "desktop:thin": {
    "k": 0.75,
    "from": {
      "width": 1008
    },
    "base": {
      "width": 1100
    },
    "to": {
      "width": 1365
    }
  }
}

In this case both breakpoints will have desktop global class (and $adaptive.is of course), but two various rem calculations.

Usage

You can use global classes in your styles:

.someblock
    background-color: blue
    .mobile &
        background-color: red

Or conditions in vue template:

<div v-show="$adaptive.is.mobile"></div>

You always can see current viewport and rem value in $adaptive inside of your component.

computed = {
	isWidth1600 () {
		return this.$adaptive.width >= 1600
	}
}

$adaptive has height, width, rem numeric values and is object, containing all device names with boolean value.