Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

note-wc

Private reader notes on highlighted text: a selection-menu action, a page-level button, and the note panel itself. Notes persist in localStorage.

Overview

<note-wc> adds private reader notes to highlighted text. It owns the note panel (quote, textarea, Save and Cancel) and opens it in three ways:

  • Inside <selection-menu> — one click highlights the selection (or reuses the highlight it falls inside) and opens the panel.
  • With for="id" (standalone or in <page-tools>) — a page-level button that opens the panel for the first noted highlight on the target, or the first highlight if none has a note.
  • Margin annotations — clicking a highlight’s margin label on a data-highlights article dispatches highlights:request-note; the first connected note-wc opens its panel for that highlight. A note-wc with no for outside a selection menu renders no button and only hosts the panel.

Notes are the reader’s private marginalia — stored in localStorage, not shared with others. For a shared discussion, use <comment-thread>. <comment-wc> pins comments to the text, but only with <review-surface> from the separate vb-project-planning package.

Demo

Select some text, then choose the sticky-note action in the toolbar.

Usage

Inside selection-menu

Page-level button

With for, the button (named “View notes”) reopens notes on an article that already has highlights. It does nothing until the reader has highlighted something.

Panel host only

To open notes from margin annotations without a toolbar, place a bare <note-wc> anywhere on the page. It renders nothing until a margin label is clicked.

How It Works

  1. The reader selects text and clicks the sticky-note icon in the toolbar.
  2. note-wc locates the selection by text offset. If it falls inside an existing highlight, that highlight is reused; otherwise a yellow highlight is created.
  3. note-wc opens its note panel beside the highlight with a textarea for the private note.
  4. Notes persist in localStorage alongside the highlight data, and saving fires highlights:note-changed on the article.
  5. Notes appear as margin annotations (“* You highlighted”) beside the text; clicking one reopens the panel.

Attributes

AttributeDefaultDescription
for—ID of the target article (page-level mode)
data-label-addAdd private noteButton name inside selection-menu
data-label-viewView notesButton name in page-level mode
data-label-dialogPrivate notePanel dialog name
data-label-headingPrivate noteVisible panel heading (uppercased by CSS)
data-label-placeholderAdd a note…Textarea placeholder
data-label-textareaNote for highlighted textTextarea name
data-label-save / data-label-cancelSave / CancelAction button text

JavaScript API

MemberDescription
openFor(highlight, controller, opener?)Open the panel for a highlight record on a highlights controller (from initHighlights(article)). Focus returns to opener — by default the element focused when the panel opened — on close.
highlights:request-note (listened on document)Detail { id, highlight, controller }. Dispatched by margin-annotation clicks; the first connected note-wc calls openFor.

Annotation Layers

ComponentActorPersistencePurpose
<note-wc>ReaderlocalStoragePrivate marginalia
<comment-wc>CollaboratorBackend (via review-surface, a separate package)Shared threaded comments
<foot-note>AuthorStatic HTMLStructural footnotes

Accessibility

  • The button is named “Add private note” (selection-menu) or “View notes” (page-level); override with data-label-*.
  • The note panel has role="dialog" and an accessible name; the textarea is focused when it opens. The panel is non-modal and does not trap focus: the page behind it stays usable and Tab moves on into the page.
  • Ctrl+Enter (Cmd+Enter on macOS) saves; Escape cancels when focus is anywhere in the panel.
  • When the panel closes while focus is inside it (Save, Cancel, Escape, an outside click that lands on nothing focusable), focus returns to the opener if it is still visible, otherwise to the highlight’s <mark> or the article, so it never drops to the page body. If focus has already moved elsewhere, it is left there.
  • Without JavaScript there is no toolbar and nothing renders; the article reads normally.

Related

↑