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

polycon

v0.2.3

Published

Create polygonal container

Downloads

15

Readme

polycon

NPM version Build Status Dependency Status devDependency Status

Create polygonal container.

Demo and Description

English | Japanese


Usage

ES module

import Polycon from 'polycon';

const polycon = new Polycon(document.querySelector('.polycon'));

API

method|parameter|return ---|---|--- new Polycon(element)|element: HTMLElement|Polycon Polycon.new(selector)|selector: string | Array<Polycon> Polycon.new(element)|element: HTMLElement|Polycon Polycon.new(nodeList)|nodeList: NodeList<HTMLElement>|Array<Polycon>

Browser

<script src="polycon.min.js"></script>
<script>
polycon('.polycon');
</script>

API

method|parameter|return ---|---|--- polycon(selector)|selector: string | Array<Polycon> polycon(element)|element: HTMLElement|Polycon polycon(nodeList)|nodeList: NodeList<HTMLElement>|Array<Polycon>

HTML Markup

<!-- basic -->
<div class="polycon" data-points="0,0 50%,50% w,0 w,h 0,h">
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tenetur quis temporibus dicta illo magnam consequuntur quod tempora non dolorum, libero voluptas, aliquam ipsum quam eius quae error sequi, unde alias.</p>
</div>

<!-- mediaquery -->
<div class="polycon" data-points="
	@media default { 0,0 50%,50% w,0 w,h 0,h }
	@media (max-width: 640px) { 0,0 50%,90% w,0 w,h 0,h }
	@media (orientation: landscape) { 10,10 50%,50%, w-10,10 w-10,h-10 10,h-10 }">
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quae, mollitia nesciunt vero voluptates natus? Accusamus assumenda rem consectetur. Ullam sapiente voluptatibus praesentium deleniti quae culpa ab consequatur perferendis iste quam.</p>
</div>

Required attributes

mame|value|description ---|---|--- data-points|flex points|points attribute value of the extended to the <polygon> svg elements so as to correspond to a relative value. Separate the x and y by a comma, each apexes by spaces x1,y1 x2,y2 x3,y3.... Numeric value without unit (0, 300) is absolute pixel. Numeric value with percent (30%, 98%) is relative value. Numeric value with alphabet and symbol (w-30,h+30) is offset number.Usable with media queries @media [mediaQueryString] { [coordinates for each apexes] } ....

StyleSheet

Automatically define into <style> element.

[data-polycon-node="root"] {
	position: relative;
	background: none !important;
}
[data-polycon-node="root"] > * {
	position: relative;
	z-index: 1;
}
[data-polycon-node="root"] > [data-polycon-node="background"] {
	position: absolute;
	z-index: 0;
	top: 0;
	left: 0;
}

Support browsers

  • Chrome
  • Firefox
  • Edge
  • Safari 5.1+
  • Internet Explorer 9 and 11
  • iOS Safari 8+
  • Android Browser 4.0+

: IE9 is not support mediaQuery syntax because that was not support matchMedia API. Allways refrect default value in that syntax.


©YusukeHirao(@cloud10designs), MIT license.