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

bootstrap-utils-dom

v1.0.3

Published

Uma biblioteca de utilitários para DOM e componentes

Downloads

7

Readme

Bootstrap Utils DOM

Este pacote fornece utilitários e funções relacionadas ao DOM, que facilitam a manipulação de elementos HTML, eventos, e componentes. Ele foi projetado para ser usado com o Bootstrap e outros projetos que necessitam de funcionalidades de manipulação do DOM, como ativar triggers, sanitizar HTML e gerenciar componentes dinâmicos.

Instalação

Para instalar o pacote, você pode usar o npm:

npm install bootstrap-utils-dom

Ou, se você preferir usar diretamente no HTML, basta incluir o arquivo compilado:

Copiar código
<script src="dist/bootstrap-utils-dom.umd.js"></script>

Como Usar

Usando como Módulo ES (ESM)

Se você estiver usando um bundler (como Webpack, Rollup, etc.), pode importar as funções diretamente:

Copiar código

import { Dom, Util } from 'bootstrap-utils-dom';

console.log(Dom);  // Acessa as exportações de Dom
console.log(Util); // Acessa as exportações de Util

// Usando uma função do Util
const sanitizedHTML = Util.sanitizeHtml('<div><a href="javascript:void(0)">Click me</a></div>', {});
console.log(sanitizedHTML);

Usando no Navegador com UMD

Se você não estiver usando um bundler e deseja usar diretamente no navegador, pode usar o arquivo UMD:

Copiar código

<script src="dist/bootstrap-utils-dom.umd.js"></script>
<script>
  window.addEventListener('load', () => {
    console.log(BootstrapUtilsDom.Util); // Verifique se o objeto Util foi carregado corretamente
    console.log(BootstrapUtilsDom.Dom); // Verifique se o objeto Dom foi carregado corretamente

    // Testando uma função, exemplo 'sanitizeHtml'
    const sanitizedHTML = BootstrapUtilsDom.Util.sanitizeHtml('<div><a href="javascript:void(0)">Click me</a></div>', {});
    console.log(sanitizedHTML);
  });
</script>

Funções Disponíveis

Dom

  • data: Manipulação de dados DOM.
  • eventHandler: Manipulação de eventos DOM.
  • manipulator: Manipulação de atributos e classes DOM.
  • selectorEngine: Ferramenta de busca e seleção de elementos.

Util

  • backdrop: Manipulação de backdrop para componentes.
  • sanitizeHtml: Função para sanitizar HTML, removendo elementos e atributos indesejados.
  • enableDismissTrigger: Função que ativa um "dismiss trigger" para componentes como alertas.
  • config: Função de configuração para os componentes.
  • focusTrap: Controle de foco em componentes modais e outros.
  • scrollBar: Manipulação de barras de rolagem.
  • swipe: Função para detectar gestos de swipe.
  • templateFactory: Função para criar templates dinâmicos.

Contribuindo

Sinta-se à vontade para fazer contribuições! Abra uma issue ou envie um pull request com melhorias, correções ou novos recursos.

  • Fork o repositório.
  • Crie uma branch para sua feature (git checkout -b feature/nome-da-feature).
  • Faça suas alterações.
  • Commit suas mudanças (git commit -am 'Adiciona nova feature').
  • Envie para a branch principal (git push origin feature/nome-da-feature).
  • Abra um Pull Request.