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

ec-no-shift-ui

v2.0.3

Published

Serviço leve para evitar layout shift ao esconder a scrollbar do body durante modais, overlays e afins.

Readme

ECNoShiftUI

🛑 Evite o layout shift ao esconder a scrollbar do body em modais, overlays e outros componentes com bloqueio de rolagem.

Leve, sem dependências e fácil de integrar.


📦 Instalação

npm install ec-no-shift-ui

ou via CDN:

<script src="https://cdn.jsdelivr.net/npm/ec-no-shift-ui/dist/ec-no-shift-ui.min.js"></script>

🚀 Uso Básico

Módulo ES

import { ECCorp } from 'ec-no-shift-ui';

const ui = new ECCorp.ECNoShiftUI();

ui.applyNoShiftScrollLock();
ui.enableBodyScroll();

CDN / Script Global

<script src="ec-no-shift-ui.min.js"></script>
<script>
  const ui = new ECCorp.ECNoShiftUI();

  document
    .getElementById('seu-componente')
    .addEventListener('open', () => ui.applyNoShiftScrollLock());
  document
    .getElementById('seu-componente')
    .addEventListener('close', () => ui.enableBodyScroll());
</script>

💡 Quando usar?

Sempre que você:

  • Esconder a scrollbar usando overflow: hidden no body
  • Abrir Modais, Side Sheets, Overlays, Drag & Drops, Bottom Sheets;
    • Essa solução foi pensada para ser genérica e reutilizável. Em qualquer lugar que você vá esconder o scroll, considere aplicar o ECNoShiftUI para preservar a fluidez visual da sua interface.
  • Quiser evitar o "pulo" visual causado pela mudança na largura da viewport

🧠 Como funciona?

O ECNoShiftUI calcula dinamicamente a largura (ou altura) da scrollbar e aplica um padding compensatório no body, mantendo a largura da viewport constante — e evitando qualquer "tremedeira".


🧱 Exemplo real

Leia o artigo completo e veja o exemplo em funcionamento:

👉 A forma certa de esconder a scrollbar sem quebrar seu layout (Layout Shift ❌)


🔒 API

| Método | Descrição | | -------------------------- | -------------------------------------------------------- | | applyNoShiftScrollLock() | Aplica overflow: hidden no body e compensa com padding | | enableBodyScroll() | Restaura os paddings e libera o scroll |


📄 Licença

MIT


🙋‍♂️ Autor

Criado por Edson Camargo Menezes
🔗 edsoncamargo.dev

Se você gostou dessa solução, considere visitar meu portfólio ou me seguir no Medium para mais artigos sobre desenvolvimento frontend.