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 🙏

© 2026 – Pkg Stats / Ryan Hefner

i78s.frontend-utils

v0.0.13

Published

クライアントサイド汎用ライブラリ集

Readme

i78s.frontend-utils

実務上でよく使う薄いライブラリ集

インストール

$ npm install i78s.frontend-utils

transitionendの取得

Android4.4.2が要件定義外なら不要

import { transitionEndName } from 'i78s.frontend-utils';

const $test = document.getElementById('test');
$test.addEventListener(transitionEndName, () => {});

スクロールの固定 / 解除

ドロワーメニューやモーダルを開いた時にスクロールを固定したい時などに使用する

import { fixScroll, releaseScroll } from 'i78s.frontend-utils';

fixScroll();      // スクロールできなくする
releaseScroll();  // スクロール固定を解除
.js-no-scroll {
  position: fixed;
  width: 100%;
}

シンプルなタブUI

import { Tab } from 'i78s.frontend-utils';

const $tabs = document.querySelectorAll('.js-tab');
const $tabContents = document.querySelectorAll('.js-tab-content');
const tab = new Tab($tabs, $tabContents);
.js-tab {
  &.is-active {
    color: #f00;
    border: #f00;
  }
}

.js-tab-content {
  display: none;
  &.is-active {
    display: block;
  }
}
<ul>
  <li><a class="js-tab is-active" data-index="0" href="#">tab1</a></li>
  <li><a class="js-tab" data-index="1" href="#">tab2</a></li>
  <li><a class="js-tab" data-index="2" href="#">tab3</a></li>
</ul>
<div>
  <div class="js-tab-content is-active">tab1 content</div>
  <div class="js-tab-content">tab2 content</div>
  <div class="js-tab-content">tab3 content</div>
</div>

モーダルやドロワーメニューに使える汎用クラス

import { Togglable } from 'i78s.frontend-utils';

$drawer = document.querySelector('.drawer');
const drawer = new Togglable($drawer);
drawer.show();
drawer.hide();
.drawer {
  transform: translateY(-100%);
  &.is-active {
    transform: translateY(0);
  }
}

画面内に要素が入ってきた時にclassNameを付与するクラス

import { ScrollIntoView } from 'i78s.frontend-utils';

const scrollIntoView = new ScrollIntoView('js-slidein');
scrollIntoView.init();
.js-slidein {
  transform: translateY(40px);
  opacity: 0;
  transition: .3s ease-out;

  &.is-show {
    opacity: 1;
    transform: translateY(0px);
  }
}

要素をスタッガリングリストトランジションさせるクラス

import { StaggeredListTransition } from 'i78s.frontend-utils';

const staggeredCardsTransition = new StaggeredListTransition('js-slidein');
staggeredCardsTransition.show()
  .then(() => { /* do something */ });

staggeredCardsTransition.hide()
  .then(() => { /* do something */ });
.js-slidein {
  transform: translateY(40px);
  opacity: 0;
  transition: .3s ease-out;

  &.is-show {
    opacity: 1;
    transform: translateY(0px);
  }
  
  &.is-hide {
    opacity: 0;
    transform: translateY(100px);
  }

  &.is-out {
    opacity: 0;
  }
}

requestAnimationFrame版のsetInterval

import { rafInterval, rafClearInterval } from 'i78s.frontend-utils';

let count = 0;
let timer = rafInterval(() => {
  count++;
  /* do something */
  if (count == 2) {
    rafClearInterval(timer)
  }
}}, 100);

requestAnimationFrame版のsetTimeout

import { rafTimeout } from 'i78s.frontend-utils';

rafTimeout(() => {
  /* do something */
}, 100);