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…
A set of elements that display HTTP messages the way they travel on the wire: a request line or status line, then headers, then a body. It does not read Vanilla Breeze tokens: it has its own light and dark palettes, which you can override with CSS custom properties.
A request and its response in one <http-transaction>, then four requests on a timeline in <http-waterfall>. All of the data is written in the page; nothing is fetched.
Usage
Show a request and response pair by setting the data property of <http-transaction>. A body is a string; when the Content-Type header is JSON, HTML, CSS or JavaScript the body is syntax highlighted.
Without JavaScript of your own, pass the same objects as JSON in the request and response attributes. Use highlight to mark a part and box to draw a labeled border around it.
Attributes only, with emphasis
<http-transactionrequest='{"method":"GET","url":"/api/users/123","headers":{"Accept":"application/json"}}'response='{"status":404,"statusText":"Not Found","headers":{"Content-Type":"text/plain"},"body":"No such user"}'highlight="response-line"box="request-headers"></http-transaction>
Show one message alone with <http-request> or <http-response>. Here the section names have no request- or response- prefix.
Show several requests on a timeline by setting the exchanges property of <http-waterfall>. Each exchange is a request, a response and a timing object in milliseconds.
Color palette. With auto or no value, the element checks the operating system color preference once, when it is added to the page, and rewrites the attribute to light or dark.
request
http-transaction, http-request
JSON object
None
The request: method, url, and optional httpVersion, headers, body. The data property wins when both are set.
response
http-transaction, http-response
JSON object
None
The response: status, statusText, and optional httpVersion, headers, body.
highlight
http-transaction, http-request, http-response
Comma-separated section names
None
Marks the named sections. See the section names below.
box
http-transaction, http-request, http-response
Comma-separated section names
None
Draws a labeled border around the named sections.
show-header
http-request, http-response
false to hide
Shown
Shows or hides the "Request" or "Response" title bar.
view
http-waterfall
list, duration, waterfall
Chosen by the element, usually duration
Display mode. Without the attribute, resources mode starts in waterfall and other modes start in duration.
requests
http-waterfall
JSON array of exchanges
None
The exchanges to list, as an attribute. The exchanges property does the same from JavaScript.
capture
http-waterfall
true or empty
Off
Records every fetch() and XMLHttpRequest call the page makes and lists it.
resources
http-waterfall
Boolean
Off
Lists the requests the page itself made (document, stylesheets, scripts, images, fonts), read from the browser's Navigation Timing and Resource Timing data. No headers or bodies are available in this mode.
filter
http-waterfall
URL pattern, * as wildcard
None
Limits captured or listed requests to matching URLs.
max-entries
http-waterfall
Number
100
The most exchanges kept.
explorer
http-waterfall
Boolean
Closed
Opens the request builder, a form that sends a real request and adds the result to the list.
Section names for highlight and box
On http-transaction
On http-request or http-response
Part
request-line
request-line
The first line of the request: method, URL and version.
response-line
status-line
The first line of the response: version, status code and reason.
request-headers, response-headers
headers
All headers.
request-header:accept, response-header:location
header:accept
One header, by name. Case does not matter.
request-body, response-body
body
The body.
Methods and properties
Member
Applies to
Purpose
data
http-transaction
An object with request and response. Setting it renders again.
data
http-request, http-response
The request or response object.
headers, body
http-message
An object of header names and values, and a body string. This element shows headers and a body with no first line, and has two slots, before-headers and after-body.
exchanges
http-waterfall
An array of exchanges, each with request, response and timing (startTime, endTime, duration).
view
http-waterfall
The current display mode.
startCapture(), stopCapture()
http-waterfall
Start or stop recording the page's fetch() and XMLHttpRequest calls.
togglePause()
http-waterfall
Pause or resume recording.
clearExchanges()
http-waterfall
Empty the list.
startResources(), stopResources()
http-waterfall
Start or stop listing the page's own requests.
toggleExplorer()
http-waterfall
Open or close the request builder.
Events
All four are fired on <http-waterfall>. They do not bubble, so listen on the element itself.
Event
Detail
Fired when
request-sent
{ method, url, headers, body }
The request builder sends a request.
response-received
The exchange: { request, response, timing }
The request builder receives a response.
request-error
{ error }
The request builder's request fails.
resources-observed
{ exchanges }
The resources mode adds a batch of entries.
CSS custom properties
Each element declares its colors as custom properties on its own host. These are the main ones. Message elements also define variables for HTTP methods (--method-get, --method-post and so on), status classes (--status-success, --status-redirect, --status-client-error, --status-server-error) and body syntax colors (--json-*, --html-*, --css-*, --js-*).
Property
Applies to
Drives
--bg-primary
http-transaction, http-waterfall
Outer background.
--bg-secondary
http-request, http-response, http-waterfall
Message panel background; secondary surfaces in the waterfall.
--bg-header
http-request, http-response
Title bar background. The title text is always white.
--border-color
All elements
Borders.
--text-primary
All elements
Main text.
--text-secondary
http-waterfall
Sizes, durations and other secondary text.
--text-empty
http-transaction, http-request, http-response
The "No data" message.
--header-name, --header-value
http-request, http-response, http-message
Header names and values.
--url-color, --version-color
http-request
The URL and the protocol version in the request line.
--button-primary-bg
http-waterfall
Primary buttons, such as the active view and Send.
Version 0.3.0 reads no Vanilla Breeze token. Every color is a fixed value in one of two built-in palettes, and the fonts are fixed too (Courier New for messages, the system sans-serif stack for the waterfall).
Otherwise the operating system color preference, read once when the element is added to the page.
The elements do not look at the data-mode attribute that Vanilla Breeze uses to force light or dark mode. If your page sets data-mode, copy it to the themeattribute yourself:
To use Vanilla Breeze colors, set the component's custom properties on the element from page CSS. A rule in the page wins over the defaults the element sets on itself.
This reaches <http-request> and <http-response> that you write in the page. It does not reach the ones inside <http-transaction> or <http-waterfall>: those live in a shadow tree and set the same properties again on themselves. On <http-transaction> only the outer --bg-primary can be changed this way. For full control of colors, place a request and a response side by side yourself.
Accessibility
Messages are rendered as text in a <pre> element, so they can be read, selected and copied. Highlighted sections use <mark>.
The waterfall's view switch, pause, clear, expand and request builder controls are native <button>, <select> and <input> elements, so they work from the keyboard.
The pause, clear and row expand buttons show a symbol only. Pause and clear have a title; the expand button has no text label in this version.
The active view is shown by color alone, and new captured requests are not announced to screen readers.
The colored timing phase bars are hidden from assistive technology with aria-hidden; the same numbers appear as text when a row is expanded.
The "Capturing" indicator pulses. The component has no prefers-reduced-motion rule, so the pulse does not stop for readers who ask for less motion.