@aitty/snapshot
v0.6.7
Published
Read-only terminal snapshot web component for aitty reports and embeds.
Maintainers
Readme
@aitty/snapshot
Read-only terminal snapshot renderer for static reports and embeds.
Use this package when you already have terminal DOM snapshot HTML and only need
the viewer component, without the full @aitty/browser session runtime.
Install
npm i @aitty/snapshotImport the stylesheet once:
import "@aitty/snapshot/style.css";Usage
import { mountAittySnapshot } from "@aitty/snapshot";
import "@aitty/snapshot/style.css";
mountAittySnapshot("#snapshot", {
html: terminalSnapshotHtml,
cols: 80,
rows: 24,
screenMode: "termvision",
theme: "dark"
});The same viewer is available as a Web Component:
<aitty-snapshot screen-mode="termvision" theme="dark" cols="80" rows="24">
<!-- terminal DOM snapshot -->
</aitty-snapshot>Bundled apps can register the component with the ESM side-effect entry:
import "@aitty/snapshot/web-component.js";
import "@aitty/snapshot/style.css";Static reports or no-bundler HTML should copy @aitty/snapshot/style.css and
@aitty/snapshot/web-component.global.js, then load them as normal assets:
<link rel="stylesheet" href="./aitty-terminal.css" />
<script src="./aitty-web-component.js"></script>The global bundle registers <aitty-snapshot> and exposes
globalThis.AittySnapshot.mountAittySnapshot.
License
Apache-2.0
