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

@cogapp/storiiies-viewer

v2.0.1

Published

A viewer for Storiiies

Downloads

679

Readme

Storiiies Viewer Build status badge

Storiies promotional banner

Storiiies Viewer is an open source viewer for Storiiies, the IIIF digital storytelling platform.

Demo

See an example StoriiiesViewer in action on codepen

Usage

API documentation

Adding the dependencies

There are two options for adding StoriiiesViewer to your project:

In the browser

(This is the quickest and easiest way to get started)

You can include the JavaScript and CSS in the HTML like so, using the unpkg CDN:

<head>
  <!-- ... -->
  <link rel="stylesheet" href="https://unpkg.com/@cogapp/storiiies-viewer@latest/dist/storiiies-viewer.css">
  <script src="https://unpkg.com/@cogapp/storiiies-viewer@latest/dist/umd/storiiies-viewer.js"></script>
  <!-- ... -->
</head>

Or you could save these files and serve them locally if you prefer.

Including the JavaScript file this way will make StoriiiesViewer available globally in JavaScript.

Using a bundler

  1. Install the dependecy with npm install @cogapp/storiiies-viewer
  2. Use import StoriiiesViewer from '@cogapp/storiiies-viewer' in your code to access the StoriiiesViewer constructor
  3. Depending on how your tooling handles importing CSS you might also be able to import the CSS file with import @cogapp/storiiies-viewer/dist/storiiies-viewer.css — but you could also use the method above, or copy the contents of the CSS file into your own src files.

Initialise a viewer

In your HTML:

<div id="storiiies-viewer"></div>

In your JavaScript

document.addEventListener('DOMContentLoaded', () => {
  const myViewer = new StoriiiesViewer({
    container: "#storiiies-viewer", // or document.querySelector("#storiiies-viewer")
    manifestUrl: "https://path-to-your-storiiies-manifest",
  });
});

Customisation

To customise of appearance of StoriiiesViewer you have a few options:

  1. If you'd prefer to bring all your own styles, StoriiiesViewer can be styled from scratch without needing to include the default stylesheet
  2. To 'theme' StoriiiesViewer, you may find the custom properties provided by the default stylesheet to be sufficient
  3. Start with default stylesheet and expand or override these styles as you see fit

Supported manifest formats

StoriiiesViewer supports a subset of the IIIF presentation API v3. Specifically, we target annotationPages which are included directly in the manifest (like in this cookbook recipe).

Text based annotations can either be text/plain or text/html denoted by the format field. For text/plain newline characters will be converted and output as <br> tags.

Support for audio exists, and StoriiiesViewer will render an <audio /> element for annotations that have a type of Sound, and which are structured like shown in this cookbook recipe.

StoriiiesViewer has no required fields (aside from those required by the presentation API), but it will render certain values from the manifest if provided. These are:

[!NOTE] Certain features which aren't currently supported include:

However, pathways exist to enable these features with further development.

[!WARNING] Manifest with a version lower than 3 may load images, but aren't guaranteed to work beyond this, and will display a warning in the console.

Compatibility with Storiiies Editor

Cogapp maintains a free-to-use editor for Storiiies at storiiies-editor.cogapp.com. To use a compatible v3 manifest for your story, append the short alphanumeric code from the "view and share" link to a base URL of https://manifest.storiiies-editor.cogapp.com/v3/

For example, for the link https://storiiies.cogapp.com/viewer/7e4va/A-Sunday-on-La-Grande-Jatte-1884 use a manifest URL of https://manifest.storiiies-editor.cogapp.com/v3/7e4va

Local development

Installation

Pre-requisites

[!IMPORTANT] Although optional, we recommend using nvm to match the version of Node used in this project before running the install command, or the npm scripts described below.

If you encounter problems and aren't using the version of Node shown in the .nvmrc file, you should try aligning your node version to this first. This represents a known compatibility with the code here and our dependencies.

Setup

Switch node version and install the dependencies in the project root with:

nvm use
npm ci

Compiling and previewing changes

Running the tests

[!NOTE] npm run cypress:gui and npm run cypress will also do the same as the above without starting the dev server, if you already have it running.

Linting the code

Image credits from banner image

Georges Seurat. A Sunday on La Grande Jatte, 1884-86. The Art Institute of Chicago. Vincent van Gogh. The Bedroom, 1889. The Art Institute of Chicago. Rosalba Carriera. A Young Lady with a Parrot, c. 1730. The Art Institute of Chicago.