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

@djplaner/film-watch-options

v0.1.3

Published

Film Watch Options - Display how to watch a film based on JSON data source

Downloads

1

Readme

film-watch-options

Under construction

Web component that provides different representations to watch a film. The representation is based on the

  • the tag content - the film's name e.g. <film-watch-options jsonurl="">The String</film-watch-options>
  • and a JSON file (located at jsonurl) that specifies if and how the film is available.

Still very much a work in progress.

The dev/index.html file gives some examples (including broken examples)

How it works

A data source is specified (e.g. a JSON file's URL). The data source is essentially a hash from film name to a URL online where the film can be found. The component uses a singleton to retrieve and cache the data source.

On render, the component translates the film name provided in the web component into an embedded video player. The component currently works for (fairly limited, specific) video URLs from

  • Web Archive (archive.org)
  • DailyMotion (dailymotion.com)
  • Microsoft stream (microsoftstream.com)
  • Vimeo (vimeo.com)
  • YouTube (youtube.com)

To do

  • Be more flexible in how video URLs are handled
  • Support other means of specifying the data source (CSV?)
  • Generally tidy everything up

Name recognition

  • be case insensitive?

Views

  • have attributes to specify different types of views (e.g. small, just a link)

Setup

Install dependencies:

npm i

Testing

This sample modern-web.dev's @web/test-runner along with Mocha, Chai, and some related helpers for testing. See the modern-web.dev testing documentation for more information.

Tests can be run with the test script:

npm test

Dev Server

This sample uses modern-web.dev's @web/dev-server for previewing the project without additional build steps. Web Dev Server handles resolving Node-style "bare" import specifiers, which aren't supported in browsers. It also automatically transpiles JavaScript and adds polyfills to support older browsers. See modern-web.dev's Web Dev Server documentation for more information.

To run the dev server and open the project in a new browser tab:

npm run serve

There is a development HTML file located at /dev/index.html that you can view at http://localhost:8000/dev/index.html.

Editing

If you use VS Code, we highly reccomend the lit-plugin extension, which enables some extremely useful features for lit-html templates:

  • Syntax highlighting
  • Type-checking
  • Code completion
  • Hover-over docs
  • Jump to definition
  • Linting
  • Quick Fixes

The project is setup to reccomend lit-plugin to VS Code users if they don't already have it installed.

Linting

Linting of JavaScript files is provided by ESLint. In addition, lit-analyzer is used to type-check and lint lit-html templates with the same engine and rules as lit-plugin.

The rules are mostly the recommended rules from each project, but some have been turned off to make LitElement usage easier. The recommended rules are pretty strict, so you may want to relax them by editing .eslintrc.json.

To lint the project run:

npm run lint

Formatting

Prettier is used for code formatting. It has been pre-configured according to the Polymer Project's style. You can change this in .prettierrc.json.

Prettier has not been configured to run when commiting files, but this can be added with Husky and and pretty-quick. See the prettier.io site for instructions.

Static Site

This project includes a simple website generated with the eleventy static site generator and the templates and pages in /docs-src. The site is generated to /docs and intended to be checked in so that GitHub pages can serve the site from /docs on the master branch.

To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".

To build the site, run:

npm run docs

To serve the site locally, run:

npm run docs:serve

To watch the site files, and re-build automatically, run:

npm run docs:watch

The site will usually be served at http://localhost:8000.

Bundling and minification

This starter project doesn't include any build-time optimizations like bundling or minification. We recommend publishing components as unoptimized JavaScript modules, and performing build-time optimizations at the application level. This gives build tools the best chance to deduplicate code, remove dead code, and so on.

For information on building application projects that include LitElement components, see Build for production on the LitElement site.

More information

See Get started on the LitElement site for more information.