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…
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
Inside selection-menu
<selection-menufor="my-article"><highlight-wc></highlight-wc><note-wc></note-wc></selection-menu><articleid="my-article"><p>Select text, click the note icon to highlight and add a note.</p></article>
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.
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.
The reader selects text and clicks the sticky-note icon in the toolbar.
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.
note-wc opens its note panel beside the highlight with a textarea for the private note.
Notes persist in localStorage alongside the highlight data, and saving fires highlights:note-changed on the article.
Notes appear as margin annotations (“* You highlighted”) beside the text; clicking one reopens the panel.
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
Component
Actor
Persistence
Purpose
<note-wc>
Reader
localStorage
Private marginalia
<comment-wc>
Collaborator
Backend (via review-surface, a separate package)
Shared threaded comments
<foot-note>
Author
Static HTML
Structural 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.