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

@cityssm/bulma-js

v0.5.0

Published

The unofficial missing JavaScript library for Bulma websites

Downloads

627

Readme

bulma-js

Codacy grade Code Climate maintainability

Made with Bulma

The unofficial missing JavaScript library for Bulma websites.

Getting Started

Download bulma-js.js here, use the jsDelivr CDN, or install from npm.

npm install @cityssm/bulma-js

Add the following to your HTML.

<script src="dist/bulma-js.js"></script>
<script>
  bulmaJS.init()
</script>

Options

Toggle Functionality

bulmaJS.setConfig('bulma.burger', true)
bulmaJS.setConfig('bulma.dropdown', true)
bulmaJS.setConfig('dropdown', true)
bulmaJS.setConfig('tabs', true)
bulmaJS.setConfig('window.collapse', true) // close dropdowns when clicked outside

Set Unique Element Id Prefix

bulmaJS.setConfig('bulmaJS.elementIdPrefix', 'bulma-js-')

Set the "Initialized" Attribute Name

bulmaJS.setConfig('bulmaJS.initAttribute', 'data-bulma-js-init')

Initialize Functionality on Entire Page

Can be called multiple times after page contents have changed.

bulmaJS.init()

Initialize Functionality on the Children of an Element

Helpful after populating an area with an AJAX call.

bulmaJS.init(document.getElementById('container-element'))

Features So Far

  • Toggles appropriate Bulma classes and ARIA attributes.
  • Close dropdown and navbar-dropdown elements when other parts of the webpage are clicked.

Delete Buttons (Messages, Notifications, and Tags)

https://bulma.io/documentation/elements/notification/, https://bulma.io/documentation/components/message/, https://bulma.io/documentation/elements/tag/

  • Support for delete buttons within notification, message, and tag elements. (Thanks thibaultmeyer for the feature.)

Navbar

https://bulma.io/documentation/components/navbar/

  • Support for the navbar-burger element.
  • Support for the navbar-dropdown elements.

Dropdown

https://bulma.io/documentation/components/dropdown/

  • Support for the dropdown elements.

Tabs

https://bulma.io/documentation/components/tabs/

  • Support for the tabs elements.
  • Use the href attribute on each tab anchor element to link to the corresponding tab panel.
  • All tab panels should be siblings. Hide the inactive tab panels with the is-hidden class.

Modal Alerts and Confirms

Methods for creating accessible alerts and confirms.

bulmaJS.alert('This is a basic alert!')

bulmaJS.alert({
  title: 'Alert',
  message: 'This is a <strong>more complex</strong> alert.',
  messageIsHtml: true,
  contextualColorName: 'success',
  okButton: {
    text: 'Yes, But Not Too Complex',
    callbackFunction: () => {
      console.log('OK Button Pressed')
    }
  }
})

bulmaJS.confirm({
  title: 'Question',
  message: 'Have you ever been to Sault Ste. Marie, Ontario?',
  contextualColorName: 'primary',
  okButton: {
    text: 'Yes, I Have',
    callbackFunction: () => {
      console.log('OK Button Pressed')
    }
  },
  cancelButton: {
    text: "No, But I'd Like To",
    callbackFunction: () => {
      console.log('Cancel Button Pressed')
    }
  }
})

Alternative Bulma JavaScript Project

The BulmaJS project also provides JavaScript functionality for Bulma, and is far more complete than this project. I recommend you take a look if you need more functionality than is offered here.

This project goes in a different direction in a few ways.

  • Prioritizes simple usage in an HTML script tag. No import or require necessary.
  • TypeScript types available.
  • Goes beyond just toggling the is-active Bulma classes, and manages ARIA attributes as well to increase accessibility.
  • Attempts to correct common issues (i.e. missing roles, missing ids) that may affect accessibility.