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

@snappywc/calendar

v1.0.6

Published

A Google Calendar element that's easy to use and customize. 1kb (brotli)

Downloads

59

Readme

<snappy-calendar>

A Google Calendar element that's easy to use and customize. 1.7kb (brotli).

Demo

Why Make Another Calendar Element?

I was using @fullcalendar for a site and I got frustrated with customization options and package size. Instead of scouring the internet for something better, I though it would be fun to make my own and see how minimal I can make it.

Features

  1. Supports list and grid views for the selected month.
  2. Responsive by default, but list or grid format can be forced.
  3. Full localization support, including prev/next aria labels.
  4. Detects user locale by default, but locale can be manually specified.
  5. Minimal styling using CSS Grid, with many part selectors available.
  6. Customizable controls using slots.

Installation

Option 1: As a package.

npm i @snappywc/calendar
import '@snappywc/calendar'

Option 2: In your markup.

<script type="module">
  import '//unpkg.com/@snappywc/calendar'
</script>

Usage

<snappy-calendar
  calendar="your google calendar id"
  key="your google calendar api key"
  format="accepts 'grid' or 'list' (defaults to responsive)"
  locale="any locale string ('en', 'fr', etc, defaults to navigator.language)"
  prev-aria-label="any string (defaults to 'show previous month')"
  next-aria-label="any string (defaults to 'show next month')"
></snappy-calendar>

Does it get any easier than that? If your answer is yes, open an issue or make a pull request!

Calendar Methods

The following methods can be used to control the calendar. The calendar will also reinitialize when the calendar, key or locale attributes are modified.

| Method | Description | | ----------------------- | ------------------------- | | .prev() | go to the previous month | | .next() | go to the next month | | .goToMonth(year, month) | go to the specified month |

Customization

The default styles, part selectors and slots for this element were carefully considered to be as minimal and un-opinionated as possible.

Slots

Two slots, prev and next, are provided to customize the icons, text, or other content inside the prev/next buttons.

Parts

The following parts are available, and should be fairly self-explanatory.

  • header
    • prev
    • date
    • next
  • grid
    • day
    • event
      • event-name
      • event-time

Example Use (SCSS)

snappy-carousel {
  &::part(header) {
    background: #eee;
  }
  &[format='list'] {
    &::part(day) {
      margin-bottom: 1rem;
    }
    &::part(event-name) {
      color: #222;
    }
  }
}