-
Notifications
You must be signed in to change notification settings - Fork 0
Capture Files
A capture is one .lua file. Its first non-whitespace content is a strict,
versioned TOML header; the rest is trusted top-level Lua.
--[[
# viset
version = 1
output = "output/{device}-{theme}.png"
[devices.desktop]
[devices.desktop.viewport]
width = 1280
height = 720
[matrix]
theme = ["light", "dark"]
[data]
url = "https://example.com"
]]
viset.page.navigate(viset.context.data.url)
viset.page.wait_for("document.readyState === 'complete'", "10s")
viset.snapshot()This produces desktop-light.png and desktop-dark.png beneath output/.
-
# visetis the exact header marker. -
version = 1is the current format. -
outputends in.pngor.webp. - At least one
[devices.<name>.viewport]provides positivewidthandheightvalues. - Every declared device expands automatically in declaration order.
- Every
[matrix]value is a non-empty array. Matrix axes expand in declaration order after devices. -
[data]holds arbitrary TOML values exposed throughviset.context.data.
Unknown fields in the fixed schema are errors. matrix and data are the open
tables.
{device} and matrix-axis names are available as output placeholders. Expanded
paths must be unique, relative, and safe. output_root changes the base
directory; --output DIR overrides it for one command.
Viset refuses existing output before browser work unless --force is supplied.
Outputs are ordinary user-owned files: no manifest, ownership marker, history,
or rollback data is created.
Devices may set mobile, touch, device_scale, viewport dimensions, and
optional frame dimensions. mobile and touch default to false, and
device_scale defaults to 1.0.
The top-level frame accepts builtin:auto, builtin:phone,
builtin:laptop, or a capture-relative custom HTML path. builtin:auto uses
the phone frame for mobile devices and the laptop frame otherwise. Custom frame
HTML requires explicit frame dimensions.
- A
.pngcapture callsviset.snapshot()exactly once. - A
.webpcapture creates exactly oneviset.record()and records at least two visible frames. -
frames_per_secondis WebP-only, ranges from 1 through 60, and defaults to 30.
See Trusted Lua API for page and recording control, and WebP and performance for media options.