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

@sil/pointer

v0.0.19

Published

Create an alternate pointer in your interface, or a specific pointer for a button. This directive makes it easily possible by adding it to the element. The directive throws you back two custom-properties which you can use to animate anything.

Downloads

44

Readme

Pointer

Create an alternate pointer in your interface, or a specific pointer for a button. This directive makes it easily possible by adding it to the element. The directive throws you back two custom-properties which you can use to animate anything.

Install

Install the package

npm install @sil/pointer 

Import the package

import Pointer from '~/@sil/pointer 

Define the component:

Vue.directive(Pointer);

Use the component with default values:

<any-element v-pointer />

About

When the directive is added, it will give you back a --x and a --y which are the values of your pointer relative to the viewport. You can use for instance for a pointer or animated background.

Options

By default the directive will return you with the current x and why on the page.

| option | default | description | | ------ | --------- | ------------------------------------------------------------------------------ | | center | false | Calculate the value based on the center of the element | | box | element | Calculate values based on either the element, viewport or the whole page | | type | pixel | See below | | min | null | Minimum return value for x and y | | min_x | null | Minimum return value for x | | min_y | null | Minimum return value for y | | max | null | Maximum return value for x and y | | max_x | null | Maximum return value for x | | max_y | null | Maximum return value for y | | var_x | --x | Property name for X to place value on. | | var_y | --y | Property name for Y to place value on. |

Type options:

| type | output | | -------------- | ------------------------------ | | default: pixel | Returns a value in pixels | | percentage | Returns a value in percentage | | scale | Returns a value between 0 to 1 |

Percentage

You can also choose type percentage, in this case directive will return the position of the pointer relative to the element which has the directive. When pointing in the ultimate center of the element the --x and --y will be 50%.

<any-element v-pointer="{ type: 'percentage' }">

Min / Max values

Give a min and max value to make sure the value doesn't go over the top.

<any-element v-pointer="{ type: 'percentage', min: 0, max: 100 }">

In this case the pointer won't give any value bigger than 100% and smaller than 0%.

Custom variables

By default the directive returns you a --x and --y. You can alter these by setting: (Make sure you add the -- otherwise your custom property won't work. )

<any-element v-pointer="{ x_var: '--horizontal', y_var: '--vertical' }">

This will return:

<any-element style="--horizontal: 50%; --vertical: 50%">

Examples

Button Background

<button v-pointer>Hoi</button>
button {
	display: inline-block;
	padding: 1rem 2rem;

	background-color: blue;
	border: none;

	font-family: sans-serif;
	font-size: 1rem;
	color: white;
}
button::before {
	content: '';

	position: absolute;
	top: var(
		--y,
		50%
	); /* --y comes from the directive, the 50% is just a fallback */
	left: var(--x, 50%);

	display: block;
	width: 200%;
	height: 200%;

	background-image: radial-gradient(
		closest-side,
		rgba(0, 0, 0, 1),
		rgba(0, 0, 0, 0)
	);
}

Body Pointer

With this your pointer will be just a black dot.

<body v-pointer>
	<!-- Your html here -->
</body>
body {
	pointer: none;
}
body::before {
	content: '';

	position: absolute;
	top: var(
		--y,
		50%
	); /* --y comes from the directive, the 50% is just a fallback */
	left: var(--x, 50%);

	display: block;
	width: 1rem;
	height: 1rem;

	background-image: radial-gradient(
		closest-side,
		rgba(0, 0, 0, 1) 100%,
		rgba(0, 0, 0, 0)
	);
}