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

essence-touchpad

v1.0.12

Published

Essence TouchPad - TouchPad component

Downloads

44

Readme

Essence TouchPad - TouchPad component

Options:

  • visible: true - show the touchpad or false (default) - hide the touchpad
  • position: list - top: offset pixels & left: offset pixels

How to use

import TouchPad from 'essence-touchpad';

class TouchPadTest extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: false,
      position: {
      start: { top: 0, left: 0},
      end: { top: 0, left: 0},
      touchpad: { top: 0, left: 0}
      },
      classes: ClassNames(
        this.props.classes,
        this.props.className
      )
    };
  }

  getPosition(event) {
    var position = this.state.position,
        mousePosition = this.mousePosition(event);

    position.start = {left: mousePosition.left, top: mousePosition.top };
    position.touchpad = {
      top: position.start.top,
      left: position.start.left
    };

    this.setState({
      position: position
    });
  }

  mousePosition(event) {
    var e = event || window.event,
      pageX = e.pageX,
      pageY = e.pageY;

    if (pageX === undefined) { // IE 8
      pageX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
      pageY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    }

    return { left: pageX, top: pageY };
  }

  selectedText(event) {
    var selectedText = window.getSelection().toString();

    this.getPosition(event);
    this.setState({
      visible: selectedText.length > 0 ? true : false
    });
  }

  render() {
    return (
      <Block>
        <Text
          className={'e-position-relative'}
          onMouseUp={this.selectedText.bind(this)}>
          <Text type={'p'}>
            Lorem ipsum dolor sit amet, duo ex malis putent possit, ea dicta vitae intellegat vel, et tamquam integre mei. Debet invidunt ius ei, ex omnesque efficiendi vis, eu elit paulo ullamcorper eam. Probatus explicari ius an, ei diceret noluisse nam, eam modo mandamus no. Vis in iudico percipitur efficiantur, sea ne maiestatis neglegentur. Assum nonumes ei pro. Sit hinc audiam meliore id, tale justo solet vim ex, quodsi molestie cu his.
            Usu eripuit principes voluptatum id, ea sint nostro vis, vel lobortis mnesarchum ex. Ne vix vide dicam delicatissimi, delenit abhorreant usu ut. Vel ne ubique mediocrem adolescens, vis sint possim omnesque id, soleat suscipiantur in eam. Paulo dolor periculis ius no, eum nisl doming corrumpit eu. Modus inermis fastidii vel ad, ei duo vocibus propriae senserit.
            Pri ut labitur debitis consequuntur, no facer lobortis mea. Democritum vituperatoribus eam ei. Ei his adipisci salutandi accommodare. Ex alia possim nam, pro ubique graeco ea. Duo molestie oporteat constituam ad, fabulas postulant corrumpit et eam.
          </Text>
          <Text type={'p'}>
            Eam sonet nihil singulis ex. Eum debet explicari voluptatum te. Vim sumo tritani ea, id agam brute vitae sed, eu labitur vituperatoribus has. Ad erant efficiendi mediocritatem cum, qui porro mucius ea, eu reque facer nec. Molestiae moderatius sit at, et qui veri apeirian. Ne per brute persecuti, ne alterum molestie sadipscing cum. Eu periculis omittantur qui, ei usu fabellas perfecto qualisque.
            Duo ei tale delectus theophrastus, urbanitas mnesarchum has et. Illum quando ex sed, posse perpetua elaboraret et ius. Atqui debet usu ea, no novum alterum eam, at sea dicant urbanitas. Duo nostrum accusata no.
          </Text>
        </Text>
        <TouchPad
          classes={'e-text-green-500'}
          visible={this.state.visible}
          position={this.state.position.touchpad}
          >
          <Btn type={'touchpad'} label={'copy'} icon={'content-content-copy'} className={'copy'} />
          <Btn type={'touchpad'} label={'paste'} icon={'content-content-paste'} className={'paste'} />
          <Btn type={'touchpad'} label={'redo'} icon={'content-redo'} className={'redo'} />
          <Btn type={'touchpad'} label={'bold'} icon={'editor-format-bold'} className={'bold'} />
          <Btn type={'touchpad'} label={'more'} icon={'navigation-more-vert'} className={'more'} />
          <Btn type={'touchpad'} label={'italic'} icon={'editor-format-italic'} className={'italic'} />
          <Btn type={'touchpad'} label={'undo'} icon={'content-undo'} className={'undo'} />
          <Btn type={'touchpad'} label={'cut'} icon={'content-content-cut'} className={'cut'} />
        </TouchPad>
      </Block>
    );
  }
}