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 🙏

© 2026 – Pkg Stats / Ryan Hefner

baroview

v0.1.1

Published

URL-based document viewer web component

Downloads

93

Readme

baroview

Main ESM package for URL-based document viewing.
It statically imports marked and pdfjs-dist, configures markdown and PDF renderers, then loads baroview-core.
A single import registers <baro-view> and <baro-view-item> so you can use them immediately.


Install

pnpm add baroview

npm/yarn:

npm install baroview

Peer / bundled: marked and pdfjs-dist are in dependencies, so they are installed and bundled with baroview.
(baroview-core is linked from the workspace or installed at publish time.)


Usage

In HTML (script only)

<script type="module" src="/node_modules/baroview/dist/baroview.js"></script>
<baro-view url="https://example.com/doc.pdf"></baro-view>

JS/TS (with bundler)

import 'baroview';

document.body.appendChild(
  Object.assign(document.createElement('baro-view'), { url: '/image.png' })
);

React / Vue / Solid / Svelte

Use <baro-view> as a component.
(Vue: register baro-view, baro-view-item in compilerOptions.isCustomElement.
Svelte 5: you may need Vite resolve.conditions: ['browser'].)

import 'baroview';

<baro-view url="/demo.pdf" />
<baro-view urls="/a.svg /b.md" layout="grid" columns="2" />

Supported formats

| Format | Extensions | Viewer | |--------|------------|--------| | Image | jpg, png, gif, webp, svg | <img> | | Video | mp4, webm, ogv | <video> | | Audio | mp3, wav, ogg, weba, m4a | <audio> | | PDF | pdf | pdf.js (canvas) | | HTML | html, htm | <iframe> | | Markdown | md, markdown | marked → HTML | | Office | docx, xlsx, pptx | Unsupported (message + link) |


Attributes (baro-view)

Basic

| Attribute | Description | |-----------|-------------| | url | Single resource URL (required for single mode). | | urls | Multiple URLs, space or comma separated. Use with layout. | | layout | row | column | columns | grid | sidebar | gallery | image-gallery | masonry. Default grid. | | columns | Grid column count (e.g. 2, 3). | | rows | Grid row count (e.g. 2). | | ratios | Ratios, space or comma separated (e.g. 1 2 1 → 1fr 2fr 1fr). Used with row/column/sidebar. | | resizable | If present, splitter is draggable when there are 2+ URLs. | | fit | For images: cover | contain | fill | none. Default contain. | | aspect-ratio | Image wrapper ratio (e.g. 1, 16/9, auto). | | sandbox | If set, sandbox is applied to iframe (HTML/PDF). |

Gallery (layout="gallery")

| Attribute | Description | |-----------|-------------| | gallery-style | uniform | masonry | carousel | strip | list | bento | billboard | slides. Default uniform. | | gallery-visible | For carousel: ratio of visible items (e.g. 2 → 50% width). | | strip-hero | For strip: top (hero on top) | left (hero on left). | | strip-thumb-size | Strip thumbnail size. width height (px) or single width (keeps ratio). Default 80 60. | | billboard-arrange | Billboard: circle | random. | | billboard-radius | Billboard circle radius (px). Default 120. | | billboard-canvas | Billboard canvas size. "width height" (px). Default 600 400. | | billboard-content-size | Billboard non-image card default size. "width height". Default 220 280. | | billboard-image-max | Billboard image max size. "width height". Default 360 270. |

Slides (gallery-style="slides")

| Attribute | Description | |-----------|-------------| | slides-height | Stage min height (px). e.g. 480. Default 420. | | slides-pagination | dots | fraction | progress. | | slides-toolbar | visible | hover | hidden. Default visible. | | slides-toolbar-style | solid | frosted. Default frosted. | | slides-arrows | edges | none. Default edges. | | slides-autoplay | Autoplay interval (seconds). 0 or omit to disable. | | slides-fullscreen | If set, fullscreen button is shown. | | slides-direction | horizontal | vertical. Default horizontal. | | slides-deep-link | If set, sync with URL hash #slide=N. | | slides-loop | If set, wrap last→first and first→last. | | slides-transition | fade | slide. | | slides-from-markdown | Markdown URL; split by H1 and show each section as a slide. |

Child: baro-view-item

You can pass items as children instead of urls.

<baro-view layout="gallery" gallery-style="slides">
  <baro-view-item url="/slide1.pdf" title="Intro" />
  <baro-view-item url="/slide2.svg" title="Chart" />
  <baro-view-item>
    <pre>Inline text slide</pre>
  </baro-view-item>
</baro-view>
  • url: URL for that item.
  • title: Tooltip / accessibility.

Theme (CSS variables)

Set on the host (baro-view) or an ancestor:

  • --baro-bg: Message area background.
  • --baro-color: Message text color.
  • --baro-error-bg, --baro-error-color: Error area.
  • --baro-unsupported-bg, --baro-unsupported-color: Unsupported format area.

CORS

Cross-origin URLs require CORS on the server. On failure, an error message and an "Open in new tab" link are shown.


Build (development)

From monorepo root:

pnpm build

Or baroview only:

pnpm --filter baroview build

Output: dist/baroview.js (ESM), dist/baroview.umd.cjs.
baroview-core is built and included as a dependency.