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

@internetarchive/cdxsummary

v0.4.1

Published

A Web Component to render CDX Summary JSON files

Downloads

38

Readme

CDX Summary Web Component

Assuming that a CDX Summary JSON file is generated from CDX files or WARC collections using the cdxsummary CLI tool, use the following Web Component to render it as an interactive HTML markup.

<cdx-summary src="CDX_SUMMARY_JSON_URL"></cdx-summary>

Alternatively, render a summary from a web collection/item of Internet Archive's Petabox, if a corresponding summary file is generated already.

<cdx-summary item="PETABOX_ITEM_OR_COLLECTION_ID"></cdx-summary>

One of the src and item attributes is mandatory for the element to render.

By default, sample capture playback links (i.e., memento URIs or URI-Ms) point to https://web.archive.org/web/, but this can be customized by specifying the playback attribute. To control the maximum number of thumbnails of random sample captures (rendered by embedding them in iframes), specify a positive integer in the thumbs attribute. Specify a space-separated list of terms thumbs, samples, and description in the fold attribute to configure the initial folding/hiding of thumbnails, list of random sample capture playback URIs, and descriptions (the latter, if folded, truncates the paragraph at one line and toggles when clicked). The element accepts a name attribute, which defaults to the name of the summary file (without extensions). A type attribute can be used to customize textual descriptions with a value of collection, item, or CDX (defaults to CDX). A report attribute points to a comprehensive version of the summary file, which is derived from the item attribute for Petabox items/collections, unless specified explicitly. Number reported in various table cells can be formatted using format attribute with values short, percent, or local (defaults to local). The code below illustrates the usage of these attributes.

<cdx-summary src="https://example.org/files/covid-collection-cdx.summary.json"
             report="https://example.org/files/covid-collection-cdx.report.json.gz"
             type="collection"
             name="COVID-19 Collection"
             format="short"
             thumbs="10"
             playback="https://archive.example.com/memento/"
             fold="thumbs samples description">
</cdx-summary>

Customize the style of various parts using any of the following CSS custom properties (variables). For example, override the --cdxsummary-thumb-scale CSS variable to change the size of the thumbnail from the original 960x600 iframe dimension (default scale is set to 0.3).

cdx-summary {
  --cdxsummary-main-txt-color: initial;
  --cdxsummary-main-bg-color: initial;
  --cdxsummary-main-font-family: sans-serif;
  --cdxsummary-main-font-size: initial;
  --cdxsummary-main-margin: 0;
  --cdxsummary-main-padding: 5px;
  --cdxsummary-mono-font-family: monospace;
  --cdxsummary-link-txt-color: blue;
  --cdxsummary-link-txt-decoration: underline;
  --cdxsummary-link-bg-color: inherit;
  --cdxsummary-info-txt-color: inherit;
  --cdxsummary-info-bg-color: inherit;
  --cdxsummary-info-font-family: inherit;
  --cdxsummary-info-font-size: inherit;
  --cdxsummary-info-font-style: italic;
  --cdxsummary-info-border: initial;
  --cdxsummary-info-border-radius: initial;
  --cdxsummary-info-margin: 5px;
  --cdxsummary-info-padding: 5px;
  --cdxsummary-h2-txt-color: inherit;
  --cdxsummary-h2-bg-color: inherit;
  --cdxsummary-h2-font-family: inherit;
  --cdxsummary-h2-font-size: 1.5em;
  --cdxsummary-h2-margin: 1em 0 0.7em;
  --cdxsummary-h2-padding: initial;
  --cdxsummary-tbl-txt-color: inherit;
  --cdxsummary-tbl-bg-color: inherit;
  --cdxsummary-tbl-hdr-txt-color: white;
  --cdxsummary-tbl-hdr-bg-color: gray;
  --cdxsummary-tbl-alt-txt-color: inherit;
  --cdxsummary-tbl-alt-bg-color: inherit;
  --cdxsummary-tbl-border: 1px solid gray;
  --cdxsummary-tbl-font-family: inherit;
  --cdxsummary-tbl-font-size: inherit;
  --cdxsummary-tbl-margin: initial;
  --cdxsummary-btn-txt-color: white;
  --cdxsummary-btn-bg-color: gray;
  --cdxsummary-btn-font-family: inherit;
  --cdxsummary-btn-font-size: inherit;
  --cdxsummary-btn-border: tbl-border;
  --cdxsummary-btn-border-radius: 5px;
  --cdxsummary-btn-margin: 0 0 10px;
  --cdxsummary-btn-padding: 5px 10px;
  --cdxsummary-thumb-border: tbl-border;
  --cdxsummary-thumb-border-radius: 5px;
  --cdxsummary-thumb-scale: 0.3;
}

Alternatively, use the interactive tester interface to customize the style and copy the generated code for integration.