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

@illinois-toolkit/ilw-video

v1.0.0

Published

Illinois Toolkit: A responsive wrapper for embedded videos.

Downloads

10

Readme

ilw-video

Overview

A responsive wrapper for embedded videos. This component ensures a consistent size and aspect ratio across breakpoints, but does not supply the video element or its controls.

By default, the container uses the same 16:9 aspect ratio used by standard YouTube videos.

An individual video may be given a custom aspect ratio using the component's aspectratio attribute. For example, a YouTube short would use aspectratio="9/16".

If all videos on a page should use a common custom aspect ratio, the component's aspect ratio may be reset using the --ilw-video--aspect-ratio css variable. For example, a page with multiple YouTube shorts might use the following style rule instead of setting each component's aspectratio attribute.

<style>
    :root {
        --ilw-video--aspect-ratio: 9/16;
    }
</style>

The video component may use the size and width attributes specified in the video's embed code. Size may also be controlled directly using the component's height and width attributes. If no size is specified in the component or embed code, the video will fill the component's parent container.

For convenience and backward compatibility, embed codes may be generated automatically for YouTube, Mediaspace, and Vimeo URLs by using the src attribute. If the src attribute is used, a corresponding title attribute must be included. Auto-generated videos will use the default 16:9 aspect ratio and will fill their parent container. If both an embed code and src attribute are used, the slotted embed code will take priority.

Slots

The video component has only one slot, which contains the video embed code (typically an iframe).

Attributes

  • aspectratio
  • height
  • src
  • title
  • width

Variables

  • --ilw-video--aspect-ratio

NPM Install

None yet. Still in alpha.

Files

None yet. Still in alpha.

Code Examples

Most embedded videos will use a standard 16:9 aspect ratio, as defined in --ilw-video--aspect-ratio.

Standard YouTube or Mediaspace Embed

<ilw-video>
    <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/pW8cNXyAqyI?si=X9643WrgKwDm0BTw" title="Progress isn't Quiet at Illinois" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</ilw-video>

YouTube Short

YouTube Shorts use a 9:16 aspect ratio, so you will need to override the --ilw-video--aspect-ratio variable, either inline or in your stylesheet.

<ilw-video aspectratio="9/16;">
    <iframe width="467" height="831" src="https://www.youtube.com/embed/6kIIFYwIU5w" title="Cheers to the start of an #ILLINOIS summer ☀️ #summer #solstice #shorts" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</ilw-video>

Accessibility Notes and Use

YouTube video embed codes are created with boilerplate title attributes. You will need to correct each embedded video's title yourself.

Videos must be captioned. Caption files must be uploaded with the video, and are not attached to the Illinois Toolkit video component.

Upgrade Process

ilw-video replaces il-video from Toolkit version 2 and earlier. To upgrade:

  • Replace all instances of the il-video tag with ilw-video.
  • Replace all instances of the --il-video-aspect-ratio CSS variable with --ilw-video--aspect-ratio.
  • Replace all instances of tv aspect ratio with 16/9.
  • Replace all instances of vertical aspect ratio with 9/16.

External References