ZenFG TypeScript API / inspector / root / FrameGraphInspector
Class: FrameGraphInspector
Defined in: inspector/src/FrameGraphInspector.ts:80
Browser lifecycle controller for one embeddable FrameGraph inspector.
Remarks
The constructor creates, but does not append, dom. Use mountFrameGraphInspector for the common append-and-return workflow. Async capture, import, and clipboard failures are reported in the UI. Call destroy when the controller is no longer needed.
Example
const inspector = new FrameGraphInspector({ captureSnapshot: capture });
document.body.append(inspector.dom);
// Later:
inspector.destroy();Constructors
Constructor
new FrameGraphInspector(
options?):FrameGraphInspector
Defined in: inspector/src/FrameGraphInspector.ts:143
Creates a detached inspector UI.
Parameters
options?
FrameGraphInspectorOptions = {}
Returns
FrameGraphInspector
Throws
If a configured numeric limit is not a non-negative safe integer, or if browser DOM globals are unavailable.
Properties
dom
readonlydom:HTMLElement
Defined in: inspector/src/FrameGraphInspector.ts:82
Root element owned by this inspector instance.
Methods
captureSnapshot()
captureSnapshot():
Promise<void>
Defined in: inspector/src/FrameGraphInspector.ts:276
Requests and displays a live snapshot from the configured provider.
Returns
Promise<void>
Remarks
Concurrent requests are coalesced. Provider errors, invalid snapshots, and an unavailable provider are displayed in the inspector and do not reject the returned promise.
copySnapshotJson()
copySnapshotJson():
Promise<void>
Defined in: inspector/src/FrameGraphInspector.ts:412
Copies the displayed snapshot as pretty-printed canonical JSON.
Returns
Promise<void>
Remarks
Clipboard failures are shown in the UI and do not reject the returned promise. A legacy document.execCommand fallback is used when the async Clipboard API is unavailable.
destroy()
destroy():
void
Defined in: inspector/src/FrameGraphInspector.ts:472
Idempotently cancels pending UI results, releases graph resources, and removes the inspector workbench. Do not reuse the controller afterward.
Returns
void
downloadSnapshot()
downloadSnapshot():
void
Defined in: inspector/src/FrameGraphInspector.ts:394
Downloads the displayed snapshot as pretty-printed canonical JSON.
Returns
void
getSnapshot()
getSnapshot():
FrameGraphSnapshotV1|undefined
Defined in: inspector/src/FrameGraphInspector.ts:331
Returns the currently displayed canonical snapshot, if any.
Returns
FrameGraphSnapshotV1 | undefined
importSnapshot()
importSnapshot(
file):Promise<void>
Defined in: inspector/src/FrameGraphInspector.ts:341
Reads, migrates, validates, and displays a snapshot JSON file.
Parameters
file
File
Returns
Promise<void>
Remarks
Files above maxImportBytes, read failures, invalid JSON, and validation failures are displayed in the UI and do not reject the promise.
refreshTheme()
refreshTheme():
void
Defined in: inspector/src/FrameGraphInspector.ts:240
Re-read final CSS values after external CSS changes and refresh graph and legend. Does not write theme variables, recapture, fit, or rebuild the component.
Returns
void
setCaptureSnapshotProvider()
setCaptureSnapshotProvider(
provider):void
Defined in: inspector/src/FrameGraphInspector.ts:256
Replaces or removes the live-capture provider.
Parameters
provider
((request) => FrameGraphSnapshotV1 | Promise<FrameGraphSnapshotV1 | undefined> | undefined) | undefined
Returns
void
Remarks
Installing a provider may immediately begin an asynchronous capture when no snapshot is displayed. Replacing or removing a provider invalidates its pending capture results without cancelling the provider promise. An already displayed snapshot and any pending import are preserved.
setSnapshot()
setSnapshot(
snapshot):void
Defined in: inspector/src/FrameGraphInspector.ts:320
Validates and synchronously displays a programmatic Snapshot 1.2 value.
Parameters
snapshot
Returns
void
Throws
FrameGraphSnapshotValidationError if snapshot is invalid.
setTheme()
setTheme(
theme):void
Defined in: inspector/src/FrameGraphInspector.ts:231
Replace API-applied variables on this instance, then synchronize graph styles. Pass null to restore host CSS and defaults. Does not change capture or interaction state.
Parameters
theme
InspectorTheme | null
Returns
void