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

@htmlbricks/hb-stylus-notebook

v0.73.7

Published

Notebook layout around `hb-stylus-paper`: toolbar (`part="controller"`) for modes, undo/redo, save, and file pickers; optional `load_draw` JSON restore.

Readme

hb-stylus-notebook — integrator guide

Category: inputs · Tags: inputs, drawing · Package: @htmlbricks/hb-stylus-notebook

Declared layout size: fullscreen (see extra/docs.ts).

Summary

hb-stylus-notebook is a notebook shell around the drawing web component hb-stylus-paper. It renders a toolbar (part="controller") and a paper region (part="paper-container") that hosts the nested canvas. The shell wires mode switching (draw / select / eraser), undo/redo, a Save action that exports the current drawing as JSON via a download, load and insert flows using hb-input-file, and optional restoration of strokes from a load_draw payload.

Peer components: this package expects hb-stylus-paper and hb-input-file to be registered (see extra/docs.tsdependencies).

Custom element

hb-stylus-notebook

Attributes (snake_case, string-friendly)

HTML and setAttribute only expose strings. Serialize objects as JSON strings.

| Attribute | Required | Description | | --- | --- | --- | | id | No | Optional host identifier string. | | style | No | Optional inline style string (reserved in typings; not applied inside component.wc.svelte today). | | load_draw | No | JSON string of a saved notebook payload (TSave). When the value is a non-empty string, the component attempts JSON.parse in an effect. Passed through to hb-stylus-paper as a serialized string when set. |

load_draw / save payload shape (TSave)

From types/webcomponent.type.d.ts:

  • type: "pdf" | "json" | "png" | "svg" | "jpg"
  • draw: array of IStroke objects (strokes, multipaths, eraser, move, etc.)
  • id, draw_id, name, version: strings / numbers as defined in the type file

Strokes include fields such as type, id, visible, actionIndex, optional path, pathData, color, opacity, bounds min/max, and related metadata. Treat the typings as the source of truth for exact fields.

Toolbar and nested paper (runtime behavior)

The controller part contains:

  • clear — switches hb-stylus-paper to eraser mode
  • selectselect mode
  • drawdraw mode
  • undo / redo — driven by history index from the paper’s historyIndex event
  • save — sets an internal save_as { name: "test", type: "json" }, then clears it after the paper fires save; the handler downloadObjectAsJson saves {detail}.name + ".json"
  • brush — disabled unless mode is draw
  • loadhb-input-file reads a text file and **JSON.parse**s it into load_draw
  • inserthb-input-file reads an image file as data URL and passes insert_image to the paper (PNG/JPG inferred from the data URL)

The paper-container part wraps hb-stylus-paper with props including mode, goto (history navigation), save_as, load_draw, insert_image, insert_text, background_color (currently "green" in source), and listeners for historyIndex and save.

Events

No custom events are declared for this component (Events is {} in types/webcomponent.type.d.ts).

Styling

  • Bulma 1.x is included for the shell; theme with --bulma-* variables on :host or ancestors (see Bulma CSS variables).

CSS custom properties (styleSetup)

| Variable | Role | | --- | --- | | --bulma-scheme-main-bis | Background behind the nested paper in #paper-container (falls back in SCSS if unset). |

CSS parts

| Part | Role | | --- | --- | | controller | Toolbar row: modes, undo/redo, save, and file inputs. | | paper-container | Region that hosts hb-stylus-paper. |

Layout (styles/webcomponent.scss)

:host is a fullscreen-sized grid (position: absolute; inset: 0; width/height 100%) with rows header (toolbar) and paper (canvas area, min-height: 0 for correct flex/grid scrolling).

Slots

None (htmlSlots is empty in extra/docs.ts).

Examples

Minimal

<hb-stylus-notebook></hb-stylus-notebook>

With load_draw (attribute must be a JSON string)

<hb-stylus-notebook
  load_draw='{"type":"json","id":"stylus-paper","draw_id":"example","name":"sketch","version":0,"draw":[]}'
></hb-stylus-notebook>

Replace the JSON value with a real TSave payload exported from your app or from a previous session.

Related packages

  • @htmlbricks/hb-stylus-paper — drawing surface API (modes, history, save detail, inserts).
  • @htmlbricks/hb-input-file — file picking for load / insert rows in the toolbar.

License

See extra/docs.tslicenses (Apache-2.0 entry) for catalog metadata.