Error returned by the hosted frame or client transport.
class HostedSketchAPIError extends Error
API reference
No matching public symbols.
SketchAPI Browser SDKError returned by the hosted frame or client transport.
class HostedSketchAPIError extends Error
Hosted Sketchpad lifecycle backed by an origin-isolated frame.
class Sketchpad
Example
const sketchpad = new Sketchpad({ session: await response.json() })
const api = await sketchpad.mount(document.querySelector('#sketchpad'))
await api.tool?.use('paintbrush')
Create one unmounted client for a server-minted hosted session.
constructor(options: HostedSketchpadOptions)
Close the transport, remove the frame, and release this one-time session.
destroy() -> void
Mount the one-time hosted session and return its async API. The container's existing children are replaced by the hosted frame.
mount(container: HTMLElement, options?: HostedSketchpadMountOptions) -> Promise<HostedSketchAPI>
Example
const controller = new AbortController()
const api = await sketchpad.mount(container, { signal: controller.signal })
// controller.abort() cancels a still-pending mount during teardown.
Instance API after a successful mount.
get api() -> HostedSketchAPI | undefined
Optional hosted document library after a successful mount.
get files() -> HostedSketchpadFiles | undefined
Frame element owned by this instance.
get frame() -> HTMLIFrameElement | undefined
Current hosted lifecycle state.
get state() -> HostedSketchpadState
Canonical async API exposed by a mounted hosted Sketchpad frame.
interface HostedSketchAPI
| Member | Signature | Description |
|---|---|---|
brush | readonly brush: HostedSketchAPIBrush | Create, inspect, update, select, and remove brushes. |
clipboard | readonly clipboard: HostedSketchAPIClipboard | Read and modify the instance clipboard. |
document | readonly document: HostedSketchAPIDocument | Create, activate, inspect, resize, and close documents. |
events | readonly events: HostedSketchAPIEvents | Subscribe to data-only instance events. |
history | readonly history: HostedSketchAPIHistory | Read and modify undoable history. |
layer | readonly layer: HostedSketchAPILayer | Create, inspect, update, order, group, and remove layers. |
media | readonly media: HostedSketchAPIMedia | Add external media to the active document. |
open | readonly open: HostedSketchAPIOpen | Open supported artwork and document formats. |
runtime | readonly runtime: HostedSketchAPIRuntime | Inspect hosted runtime metadata and readiness. |
save | readonly save: HostedSketchAPISave | Save artwork in supported document and image formats. |
selection | readonly selection: HostedSketchAPISelection | Inspect and change the active selection. |
tool | readonly tool: HostedSketchAPITool | undefined | Discover, configure, and activate tools when the product exposes them. |
Hosted reusable brush-definition namespace.
interface HostedSketchAPIBrush
| Member | Signature | Description |
|---|---|---|
create | create(definition: BrushDefinition) -> Promise<RegisteredBrushDefinition> | Register a new brush definition. |
get | get(id: string) -> Promise<RegisteredBrushDefinition | undefined> | Return a detached brush definition by id. |
has | has(id: string) -> Promise<boolean> | Return whether a brush id is registered. |
list | list(filter?: HostedSketchBrushListFilter) -> Promise<readonly RegisteredBrushDefinition[]> | List registered brush definitions. |
remove | remove(id: string) -> Promise<boolean> | Remove a registered brush definition. |
update | update(id: string, patch: Partial<BrushDefinition>) -> Promise<RegisteredBrushDefinition> | Update an existing brush definition. |
use | use(id: string, options?: SketchBrushUseOptions) -> Promise<unknown> | Activate a registered brush through the owning tool API. |
Clipboard reads are methods because hosted state crosses an async boundary.
interface HostedSketchAPIClipboard
| Member | Signature | Description |
|---|---|---|
clear | clear() -> Promise<void> | Clear copied layers and their retained assets. |
copy | copy(references?: SketchClipboardLayerReference<SketchLayerHandle> | readonly SketchClipboardLayerReference<SketchLayerHandle>[], options?: SketchClipboardTargetOptions<SketchDocumentHandle>) -> Promise<void> | Copy layers, defaulting to the target document's current selection. |
cut | cut(references?: SketchClipboardLayerReference<SketchLayerHandle> | readonly SketchClipboardLayerReference<SketchLayerHandle>[], options?: SketchClipboardTargetOptions<SketchDocumentHandle>) -> Promise<void> | Cut layers, defaulting to the target document's current selection. |
hasContent | hasContent() -> Promise<boolean> | Report whether the hosted clipboard currently contains pasteable content. |
paste | paste(options?: SketchClipboardPasteOptions<SketchLayerHandle, SketchDocumentHandle>) -> Promise<readonly SketchLayerHandle[]> | Paste copied layers into the active or explicitly targeted document. |
Hosted document lifecycle namespace.
interface HostedSketchAPIDocument
| Member | Signature | Description |
|---|---|---|
activate | activate(reference: SketchDocumentReference<SketchDocumentHandle>) -> Promise<SketchDocumentHandle> | Make an open document the active default for subsequent operations. |
clear | clear(options?: SketchDocumentClearOptions<SketchDocumentHandle>) -> Promise<void> | Remove every layer from the active or explicitly targeted document. |
close | close(reference?: SketchDocumentReference<SketchDocumentHandle>) -> Promise<void> | Close a document, defaulting to the active document. |
create | create(options?: SketchDocumentCreateOptions) -> Promise<SketchDocumentHandle> | Create and initialize a document. |
current | current() -> Promise<SketchDocumentHandle | undefined> | Return the active document. |
fit | fit(options?: SketchDocumentFitOptions<SketchDocumentHandle>) -> Promise<void> | Fit the active or explicitly targeted document into its viewport. |
get | get(reference: SketchDocumentReference<SketchDocumentHandle>) -> Promise<SketchDocumentHandle | undefined> | Find an open document by index, id, or live handle. |
getViewport | getViewport(options?: SketchDocumentTargetOptions<SketchDocumentHandle>) -> Promise<SketchDocumentViewportState> | Return immutable camera and size state for the active or targeted document. |
list | list() -> Promise<readonly SketchDocumentHandle[]> | Return an immutable snapshot of the open document list. |
resize | resize(options: SketchDocumentResizeOptions<SketchDocumentHandle>) -> Promise<void> | Resize the active or explicitly targeted document. |
resizeViewport | resizeViewport(options?: SketchDocumentViewportOptions<SketchDocumentHandle>) -> Promise<void> | Resize or remeasure the active or explicitly targeted viewport. |
setViewport | setViewport(options: SketchDocumentSetViewportOptions<SketchDocumentHandle>) -> Promise<void> | Apply camera or size state to the active or explicitly targeted document. |
Data-only event delivered by a hosted SketchAPI subscription.
interface HostedSketchAPIEvent
| Member | Signature | Description |
|---|---|---|
detail | readonly detail: unknown | Serializable event payload. |
source | readonly source: unknown | Serializable source metadata supplied by the runtime. |
target | readonly target: Readonly<{ kind: "SketchAPI" }> | Stable event target descriptor. |
time | readonly time: number | Event time in milliseconds since the Unix epoch. |
type | readonly type: string | SketchAPI event name. |
Hosted event options evaluated by the browser client and frame.
interface HostedSketchAPIEventOptions
| Member | Signature | Description |
|---|---|---|
once | once?: boolean | Remove the subscription after its first event. |
signal | signal?: AbortSignal | Remove the subscription when this signal aborts. |
Local subscription facade backed by frame event forwarding.
interface HostedSketchAPIEvents
| Member | Signature | Description |
|---|---|---|
on | on(type: string, handler: (event: HostedSketchAPIEvent) => void, options?: HostedSketchAPIEventOptions) -> () => void | Subscribe to one data-only hosted event and return its unsubscribe function. |
names | readonly names: readonly string[] | Event names supported by the connected runtime. |
Example: on
const off = api.events.on('document:change', event => console.log(event.type, event.detail))
off()
const controller = new AbortController()
api.events.on('tool:change', event => console.log(event.detail), { signal: controller.signal })
controller.abort()
Remote history operations with one atomic callback transaction.
interface HostedSketchAPIHistory
| Member | Signature | Description |
|---|---|---|
canRedo | canRedo(options?: SketchHistoryTargetOptions<SketchDocumentHandle>) -> Promise<boolean> | Return whether the target document has a redo entry. |
canUndo | canUndo(options?: SketchHistoryTargetOptions<SketchDocumentHandle>) -> Promise<boolean> | Return whether the target document has an undo entry. |
redo | redo(options?: SketchHistoryMoveOptions<SketchDocumentHandle>) -> Promise<void> | Redo one or more entries in the target document. |
transaction | transaction<T>(action: () => Promise<T> | T, options?: SketchHistoryTransactionOptions<SketchDocumentHandle>) -> Promise<T> | Commit all callback operations as one undoable history transaction. |
undo | undo(options?: SketchHistoryMoveOptions<SketchDocumentHandle>) -> Promise<void> | Undo one or more entries in the target document. |
Example: transaction
await api.history.transaction(async () => {
const badge = await api.layer.create({ type: 'rectangle', width: 96, height: 96 })
await api.layer.update(badge, { name: 'Badge', opacity: 0.9 })
}, { name: 'Add badge' })
await api.history.undo()
Hosted layer namespace retaining both canonical creation overloads.
interface HostedSketchAPILayer
| Member | Signature | Description |
|---|---|---|
create | create<TDefinition extends SketchLayerDefinition>(definition: TDefinition, options?: SketchLayerCreateOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle>
create<TDefinition extends SketchLayerDefinition>(definitions: readonly TDefinition[], options?: SketchLayerCreateOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle[]> | Create one layer from a serializable layer definition. |
get | get(reference: SketchLayerReference, options?: SketchLayerTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle | undefined> | Find a layer by id or detached hosted handle. |
group | group(references: readonly SketchLayerReference[], options?: SketchLayerTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle> | Group one or more layers and return the new group handle. |
list | list(options?: SketchLayerTargetOptions<SketchDocumentHandle>) -> Promise<readonly SketchLayerHandle[]> | Return an immutable layer-handle snapshot for the target document. |
move | move(reference: SketchLayerReference, options: SketchLayerMoveOptions<SketchLayerHandle, SketchDocumentHandle>) -> Promise<void> | Move or reparent one layer within the document tree. |
remove | remove(references: SketchLayerReference | readonly SketchLayerReference[], options?: SketchLayerRemoveOptions<SketchDocumentHandle>) -> Promise<void> | Remove one or more layers from the target document. |
schema | schema(type: string) -> Promise<ToolSchema | undefined> | Read the registered configuration schema for one layer type. |
snapshot | snapshot<TData extends object = Record<string, unknown>>(reference: SketchLayerReference, options?: SketchLayerTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerSnapshot<TData>> | Return detached serializable state for one layer. |
ungroup | ungroup(references: SketchLayerReference | readonly SketchLayerReference[], options?: SketchLayerTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle[]> | Ungroup one or more groups and return their moved child handles. |
update | update<TChanges extends object>(references: SketchLayerReference | readonly SketchLayerReference[], changes: SketchLayerChanges<TChanges>, options?: SketchLayerUpdateOptions<SketchDocumentHandle>) -> Promise<void> | Apply validated changes to one or more layer references. |
types | readonly types: readonly string[] | Registered layer type ids. |
Example: create
const card = await api.layer.create({
fill: '#2f6fed',
height: 240,
type: 'rectangle',
width: 320
})
Hosted media import namespace.
interface HostedSketchAPIMedia
| Member | Signature | Description |
|---|---|---|
add | add(input: HostedSketchMediaInput, options?: HostedSketchMediaOptions) -> Promise<SketchMediaAddResult<SketchDocumentHandle, SketchLayerHandle>> | Add transportable media to the active or targeted document. |
Hosted document import namespace.
interface HostedSketchAPIOpen
| Member | Signature | Description |
|---|---|---|
bundle | bundle(blobs: Array<Blob | File>, options?: HostedSketchJsonOpenOptions) -> Promise<SketchDocumentHandle> | Open a Sketchpad bundle archive. |
json | json(content: SketchJsonInput, options?: HostedSketchJsonOpenOptions) -> Promise<SketchDocumentHandle> | Open Sketchpad JSON data. |
pdf | pdf(file: ArrayBuffer | Blob | File | string, options?: HostedSketchPdfOpenOptions) -> Promise<SketchLayerHandle[]> | Open a PDF document. |
psd | psd(file: SketchPsdInput, options?: HostedSketchPsdOpenOptions) -> Promise<SketchLayerHandle[]> | Open a PSD document. |
sketch | sketch(zipBlob: Blob, options?: HostedSketchJsonOpenOptions) -> Promise<SketchDocumentHandle> | Open the native Sketchpad document format. |
svg | svg(input: Blob | File | string, options?: HostedSketchSvgOpenOptions) -> Promise<SketchLayerHandle> | Open SVG content as a layer. |
Hosted runtime metadata and readiness.
interface HostedSketchAPIRuntime
| Member | Signature | Description |
|---|---|---|
ready | ready() -> Promise<void> | Resolve after the hosted runtime is ready for API operations. |
version | readonly version: string | undefined | Connected hosted runtime version, when reported. |
Hosted save namespace retaining output-format return inference.
interface HostedSketchAPISave
| Member | Signature | Description |
|---|---|---|
assets | assets(options?: HostedSketchAssetsSaveOptions) -> Promise<Record<string, Blob | string>> | Export assets referenced by the active or targeted document. |
bundle | bundle(options?: HostedSketchBundleSaveOptions) -> Promise<SketchBundleEntry[]> | Save the active or targeted document as a native bundle. |
jpeg | jpeg<TFormat extends HostedSketchRasterOutputFormat = "blob">(options?: HostedSketchImageSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save a JPEG image in a portable representation. |
json | json<TFormat extends HostedSketchJsonOutputFormat = "object">(options?: HostedSketchJsonSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Serialize a document or layer selection as Sketch JSON. |
pdf | pdf<TFormat extends HostedSketchPdfOutputFormat = "blob">(options?: HostedSketchPdfSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save a PDF document in a portable representation. |
png | png<TFormat extends HostedSketchRasterOutputFormat = "blob">(options?: HostedSketchImageSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save a PNG image in a portable representation. |
psd | psd<TFormat extends HostedSketchPsdOutputFormat = "blob">(options?: HostedSketchPsdSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save a PSD document in a portable representation. |
raster | raster<TFormat extends HostedSketchRasterOutputFormat = "blob">(options?: HostedSketchRasterSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Render and save a raster image, returning a Blob by default. |
svg | svg<TFormat extends HostedSketchSvgOutputFormat = "blob">(options?: HostedSketchSvgSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save SVG in a portable representation. |
webp | webp<TFormat extends HostedSketchRasterOutputFormat = "blob">(options?: HostedSketchImageSaveOptions<TFormat>) -> Promise<HostedSketchSaveOutput<TFormat>> | Save a WebP image in a portable representation. |
zip | zip(options?: HostedSketchBundleSaveOptions) -> Promise<Blob> | Save a ZIP-wrapped native bundle. |
formats | readonly formats: readonly string[] | Export format identifiers available in the connected runtime. |
Example: json
const document = await api.save.json() // portable object, same as { as: 'object' }
const text = await api.save.json({ as: 'string' })
Hosted selection namespace.
interface HostedSketchAPISelection
| Member | Signature | Description |
|---|---|---|
clear | clear(options?: SketchSelectionTargetOptions<SketchDocumentHandle>) -> Promise<void> | Clear the active or explicitly targeted document selection. |
current | current(options?: SketchSelectionTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle | undefined> | Return the primary selected layer in the active or targeted document. |
deselect | deselect(input: SketchSelectionInput<SketchLayerHandle>, options?: SketchSelectionTargetOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle | SketchLayerHandle[] | undefined> | Remove layers from the active or explicitly targeted selection. |
has | has(input: string | SketchLayerHandle, options?: SketchSelectionTargetOptions<SketchDocumentHandle>) -> Promise<boolean> | Check whether a layer or id is selected in the active or targeted document. |
list | list(options?: SketchSelectionTargetOptions<SketchDocumentHandle>) -> Promise<readonly SketchLayerHandle[]> | Return an immutable selection snapshot for the active or targeted document. |
select | select(input: SketchSelectionInput<SketchLayerHandle>, options?: SketchSelectionOptions<SketchDocumentHandle>) -> Promise<SketchLayerHandle | SketchLayerHandle[] | undefined> | Select layers in the active or explicitly targeted document. |
Hosted tool discovery, configuration, and activation namespace.
interface HostedSketchAPITool
| Member | Signature | Description |
|---|---|---|
config | config<TConfig extends object>(toolId: string, values: Readonly<TConfig>, options?: SketchToolConfigOptions) -> Promise<void>
config<TConfigMap extends SketchToolConfigMap>(configs: TConfigMap, options?: SketchToolConfigOptions) -> Promise<void> | Update one tool config or a map of tool configs without switching tools. |
current | current() -> Promise<SketchToolHandle | undefined> | Get the active tool instance. |
getConfig | getConfig<TConfig extends SketchToolConfigValues = SketchToolConfigValues>(toolId?: string) -> Promise<TConfig | undefined> | Get a tool config by id, or the active tool config when omitted. |
has | has(toolId: string) -> Promise<boolean> | Return whether a tool id is registered. |
hasCapability | hasCapability(toolId: string, capability: string) -> Promise<boolean> | Return whether a tool declares a capability. |
list | list(filter?: SketchToolListFilter) -> Promise<readonly SketchToolListEntry[]> | List registered public tools. |
schema | schema(toolId: string) -> Promise<ToolSchema | undefined> | Get the public schema for a tool id. |
use | use<TConfig extends object = SketchToolConfigValues>(toolId: string, values?: Readonly<TConfig>, options?: SetCurrentToolOptions) -> Promise<SketchToolHandle> | Switch to a tool and optionally apply config values. |
Options for hosted referenced-asset export.
interface HostedSketchAssetsSaveOptions extends HostedSketchSaveOptions<"blob" | "dataURL">
| Member | Signature | Description |
|---|---|---|
preferOriginalBlobs | preferOriginalBlobs?: boolean | Reuse unchanged source blobs instead of re-encoding them. |
Structured brush filter accepted across the hosted boundary.
interface HostedSketchBrushListFilter
| Member | Signature | Description |
|---|---|---|
type | type?: BrushDefinition["type"] | Keep brushes with this public definition type. |
Options for hosted native bundle and ZIP export.
interface HostedSketchBundleSaveOptions extends HostedSketchSaveTargetOptions
| Member | Signature | Description |
|---|---|---|
withHistory | withHistory?: boolean | Include undo history in the bundle. |
withResources | withResources?: boolean | Include reusable document resources in the bundle. |
Options for hosted native JSON and bundle imports.
interface HostedSketchJsonOpenOptions extends HostedSketchOpenOptions
| Member | Signature | Description |
|---|---|---|
renderScene | renderScene?: boolean | Render the document after loading it. |
Options for hosted native JSON export.
interface HostedSketchJsonSaveOptions<TFormat extends HostedSketchJsonOutputFormat = HostedSketchJsonOutputFormat> extends HostedSketchSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
quality | quality?: number | Encoder quality used when embedding raster assets. |
withAssets | withAssets?: boolean | Embed referenced assets into the JSON output. |
withHistory | withHistory?: boolean | Include undo history in the JSON output. |
withResources | withResources?: boolean | Include reusable resources in the JSON output. |
Buffer-backed media source accepted by the hosted importer.
interface HostedSketchMediaBufferSource
| Member | Signature | Description |
|---|---|---|
buffer | buffer: ArrayBuffer | Media bytes to import. |
type | type?: string | Optional MIME type or importer-specific media hint. |
Data-only options accepted by hosted media import.
interface HostedSketchMediaOptions
| Member | Signature | Description |
|---|---|---|
anchor | anchor?: SketchMediaPoint | Placement anchor interpreted by the selected media importer. |
asset | asset?: SketchImportedMediaAsset | Existing asset metadata to reuse while importing. |
doc | doc?: SketchDocumentHandle | Target document, defaulting to the active document. |
name | name?: string | Optional display name for the imported media. |
openAsNew | openAsNew?: boolean | Open the input in a new document instead of the active document. |
originalUrl | originalUrl?: string | Original source URL retained as media metadata. |
parentId | parentId?: string | Parent layer id for the imported content. |
placeAt | placeAt?: SketchMediaPoint | Explicit document-space placement point. |
renderScene | renderScene?: boolean | Render the scene after the import completes. |
rotation | rotation?: number | Initial rotation in radians. |
signal | signal?: AbortSignal | Cancel the import without sending a callback across the frame boundary. |
targetIdx | targetIdx?: number | Target child index under the selected parent. |
URL-backed media source accepted by the hosted importer.
interface HostedSketchMediaUrlSource
| Member | Signature | Description |
|---|---|---|
src | src: string | Source URL to import inside the hosted frame. |
type | type?: string | Optional MIME type or importer-specific media hint. |
Shared data-only controls for hosted document-open operations.
interface HostedSketchOpenOptions
| Member | Signature | Description |
|---|---|---|
doc | doc?: SketchDocumentHandle | Target document, defaulting to the active document. |
openAsNew | openAsNew?: boolean | Replace the target document instead of placing imported content into it. |
signal | signal?: AbortSignal | Cancel the import. |
Options for hosted PDF imports.
interface HostedSketchPdfOpenOptions extends HostedSketchOpenOptions
| Member | Signature | Description |
|---|---|---|
openAsLayers | openAsLayers?: boolean | Preserve recoverable PDF vector layers when possible. |
pageNumbers | pageNumbers?: number[] | Import only these one-based page numbers. |
placeAt | placeAt?: SketchMediaPoint | Center imported pages at this document-space point. |
throwOnLayerFallback | throwOnLayerFallback?: boolean | Reject instead of rasterizing a page whose vector import fails. |
Options for hosted PDF export.
interface HostedSketchPdfSaveOptions<TFormat extends HostedSketchPdfOutputFormat = HostedSketchPdfOutputFormat> extends HostedSketchSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
clipToPixelBounds | clipToPixelBounds?: boolean | Crop the PDF to nontransparent pixel bounds. |
clipToSelection | clipToSelection?: boolean | Export only the current selection. |
convertTextToPaths | convertTextToPaths?: boolean | Convert text to vector paths before export. |
dpi | dpi?: number | Target PDF rasterization resolution in dots per inch. |
quality | quality?: number | Encoder quality from zero to one for raster fallbacks. |
region | region?: SketchSaveRegion | Document region to export. |
surface | surface?: string | Surface color used behind exported content. |
vector | vector?: boolean | Prefer native vector output when supported. |
Options for hosted PSD imports.
interface HostedSketchPsdOpenOptions extends HostedSketchOpenOptions
| Member | Signature | Description |
|---|---|---|
openAsLayers | openAsLayers?: boolean | Preserve PSD layers instead of importing only the composite image. |
placeAt | placeAt?: SketchMediaPoint | Center imported content at this document-space point. |
Options for hosted layered PSD export.
interface HostedSketchPsdSaveOptions<TFormat extends HostedSketchPsdOutputFormat = HostedSketchPsdOutputFormat> extends HostedSketchRenderedSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
preserveLayers | preserveLayers?: boolean | Preserve editable layers instead of flattening the document. |
Options for hosted generic raster export.
interface HostedSketchRasterSaveOptions<TFormat extends HostedSketchRasterOutputFormat = HostedSketchRasterOutputFormat> extends HostedSketchRenderedSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
format | format?: "jpeg" | "png" | "webp" | Raster encoder selected by the generic raster operation. |
Shared hosted options for rendered image and PSD exports.
interface HostedSketchRenderedSaveOptions<TFormat extends HostedSketchSaveOutputFormat> extends HostedSketchSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
clipToPixelBounds | clipToPixelBounds?: boolean | Crop the rendered output to its nontransparent pixel bounds. |
clipToSelection | clipToSelection?: boolean | Crop the rendered output to the current selection. |
dpi | dpi?: number | Target dots per inch used to derive export scaling. |
includeSurface | includeSurface?: boolean | Include the document surface behind exported layers. |
longestEdge | longestEdge?: number | Scale the longest output edge to this pixel length. |
preferCanvasFallbackWhenSafe | preferCanvasFallbackWhenSafe?: boolean | Prefer Canvas2D when the layer set requires no Pixi-only effects. |
quality | quality?: number | Encoder quality from zero to one for lossy formats. |
region | region?: SketchSaveRegion | Region of the document to export. |
scale | scale?: number | Explicit output scale multiplier. |
surface | surface?: HostedSketchSurfaceInput | Data-only surface override used behind exported layers. |
Shared hosted save options with portable output inference.
interface HostedSketchSaveOptions<TFormat extends HostedSketchSaveOutputFormat = HostedSketchSaveOutputFormat> extends HostedSketchSaveTargetOptions
| Member | Signature | Description |
|---|---|---|
as | as?: TFormat | Requested portable return representation. |
Shared document, layer, and cancellation controls for hosted saves.
interface HostedSketchSaveTargetOptions
| Member | Signature | Description |
|---|---|---|
doc | doc?: SketchDocumentHandle | Target document, defaulting to the active document. |
layers | layers?: readonly SketchLayerHandle[] | Optional layer subset to export. |
signal | signal?: AbortSignal | Cancel the export. |
Options for hosted SVG imports.
interface HostedSketchSvgOpenOptions extends HostedSketchOpenOptions
| Member | Signature | Description |
|---|---|---|
combineContiguousPaths | combineContiguousPaths?: boolean | Merge compatible neighboring paths into compound paths. |
placeAt | placeAt?: SketchMediaPoint | Center imported content at this document-space point. |
Options for hosted SVG export.
interface HostedSketchSvgSaveOptions<TFormat extends HostedSketchSvgOutputFormat = HostedSketchSvgOutputFormat> extends HostedSketchSaveOptions<TFormat>
| Member | Signature | Description |
|---|---|---|
background | background?: string | Background color written behind exported content. |
clipToPixelBounds | clipToPixelBounds?: boolean | Crop the SVG to nontransparent pixel bounds. |
clipToSelection | clipToSelection?: boolean | Export only the current selection. |
exportBezierPaths | exportBezierPaths?: boolean | Convert compatible geometry to editable Bezier paths. |
exportRawImages | exportRawImages?: boolean | Preserve source raster images instead of re-encoding them. |
inlineClipart | inlineClipart?: "base64" | "merge" | "package" | false | Strategy for embedding or packaging clipart dependencies. |
inlineFont | inlineFont?: "base64" | "outline" | "package" | false | Strategy for embedding, outlining, or packaging fonts. |
region | region?: SketchSaveRegion | Document region to export. |
Options accepted while mounting the hosted frame.
interface HostedSketchpadMountOptions
| Member | Signature | Description |
|---|---|---|
signal | signal?: AbortSignal | Cancel frame loading and connection. |
Hosted client construction options.
interface HostedSketchpadOptions
| Member | Signature | Description |
|---|---|---|
definition | definition?: SketchpadAppDefinitionInput | Optional JSON-safe recipe for the hosted drawing experience. |
onStateChange | onStateChange?: (state: HostedSketchpadState) => void | Observe lifecycle transitions, including destruction caused by a lost frame connection. States arrive as 'mounting', 'mounted', or 'destroyed'. |
requestTimeoutMs | requestTimeoutMs?: number | Per-request transport timeout in milliseconds. |
session | session: HostedSketchpadSession | Short-lived session returned by the SketchAPI control plane. |
title | title?: string | Accessible title applied to the hosted frame. |
Example: onStateChange
const sketchpad = new Sketchpad({
session,
onStateChange: state => {
if (state === 'destroyed') showReconnectPrompt()
}
})
One short-lived hosted session minted by the SketchAPI control plane.
interface HostedSketchpadSession
| Member | Signature | Description |
|---|---|---|
expiresAt | expiresAt: string | ISO timestamp after which the session cannot be mounted. |
frameUrl | frameUrl: string | Exact hosted frame URL for this session. |
sessionId | sessionId?: string | Server-side session id for support and usage correlation. |
token | token: string | One-time secret passed through the authenticated frame channel. |
Options for hosted JPEG, PNG, and WebP exports.
type HostedSketchImageSaveOptions<TFormat extends HostedSketchRasterOutputFormat = HostedSketchRasterOutputFormat> = HostedSketchRenderedSaveOptions<TFormat>
Portable output representations supported by hosted Sketch JSON export.
type HostedSketchJsonOutputFormat = "blob" | "dataURL" | "object" | "string"
Data, blobs, buffers, and URLs accepted by hosted media import.
type HostedSketchMediaInput = string | Blob | ArrayBuffer | HostedSketchMediaBufferSource | HostedSketchMediaUrlSource | HostedSketchMediaInput[]
Portable output representations supported by hosted PDF export.
type HostedSketchPdfOutputFormat = "arrayBuffer" | "blob" | "dataURL"
Portable output representations supported by hosted PSD export.
type HostedSketchPsdOutputFormat = "arrayBuffer" | "blob"
Portable output representations supported by hosted raster exporters.
type HostedSketchRasterOutputFormat = "arrayBuffer" | "base64" | "blob" | "dataURL"
Resolve a hosted save representation to its transported result type.
type HostedSketchSaveOutput<TFormat extends HostedSketchSaveOutputFormat> = HostedSketchSaveOutputMap[TFormat]
Every output representation supported across the hosted boundary.
type HostedSketchSaveOutputFormat = HostedSketchJsonOutputFormat | HostedSketchPdfOutputFormat | HostedSketchPsdOutputFormat | HostedSketchRasterOutputFormat | HostedSketchSvgOutputFormat
Data-only paint or layer reference accepted as a hosted export surface.
type HostedSketchSurfaceInput = string | SketchLayerHandle | Readonly<Record<string, unknown>>
Portable output representations supported by hosted SVG export.
type HostedSketchSvgOutputFormat = "arrayBuffer" | "base64" | "blob" | "dataURL" | "string"
Optional remote document-library operations owned by the hosted frame.
type HostedSketchpadFiles = SketchpadFilesService
Hosted instance lifecycle state.
type HostedSketchpadState = "destroyed" | "idle" | "mounted" | "mounting"
Supporting typesCommon properties shared by all gradient types
interface BaseGradientDef
| Member | Signature | Description |
|---|---|---|
colorSpace | colorSpace?: ColorSpace | Color interpolation space (default: 'linear-rgb', recommend 'oklab' for quality) |
coordSystem | coordSystem?: CoordSystem | Coordinate system for Y-axis (default: 'canvas') |
extendMode | extendMode?: ExtendMode | Edge behavior when gradient is extended (default: 'clamp') |
noise | noise?: GradientNoiseConfig | Optional noise configuration for color stops |
stops | stops: GradientStop[] | Array of color stops (minimum 2 for most gradients) |
transform | transform?: GradientTransform | Optional transform matrix applied in normalized gradient space |
Common properties for all pattern types
interface BasePatternDef
| Member | Signature | Description |
|---|---|---|
offset | offset?: [number, number] | Offset position [x, y] |
opacity | opacity?: number | Pattern opacity (0-1) |
rotation | rotation?: number | Rotation angle in degrees |
scale | scale?: PatternScale | Scale factor for the pattern |
transform | transform?: PatternTransform | Additional affine transform applied to the pattern tile. |
Compositing applied exactly once to one Hybrid layer.
interface BrushDefinitionStyle
| Member | Signature | Description |
|---|---|---|
blendMode | blendMode?: string | Blend mode applied while compositing the layer. |
opacity | opacity?: number | Opacity multiplier from zero to one. |
Paint source backed by one CSS color.
interface ColorPaint
| Member | Signature | Description |
|---|---|---|
color | color: string | CSS color string (hex, rgb, rgba, hsl, hsla, named, oklch, etc.) |
type | type: "color" | Paint kind discriminator. |
Conic gradient - rotates around a center point (also called angular/sweep)
interface ConicGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
center | center: [number, number] | Center point [x, y] in normalized coordinates (0-1) |
rotation | rotation?: number | Starting rotation angle in degrees (0-360) |
scaleX | scaleX?: number | Horizontal scale |
scaleY | scaleY?: number | Vertical scale |
sectors | sectors?: number | Number of sectors/segments (for stepped gradients) |
type | type: "conic" | Gradient kind discriminator. |
Coons patch gradient - bilinear interpolation across 4 boundary curves Used for complex mesh gradients
interface CoonsGradientDef extends OptionalStopsGradientDef
| Member | Signature | Description |
|---|---|---|
bottom | bottom?: [number, number][] | Bottom edge control points |
colors | colors?: [string, string, string, string] | Corner colors [topLeft, topRight, bottomLeft, bottomRight] |
left | left?: [number, number][] | Left edge control points |
patches | patches?: CoonsPatchDef[] | Multiple independent patches |
right | right?: [number, number][] | Right edge control points |
top | top?: [number, number][] | Top edge control points |
type | type: "coons" | Gradient kind discriminator. |
Coons patch definition (for multi-patch gradients)
interface CoonsPatchDef
| Member | Signature | Description |
|---|---|---|
bottom | bottom: [number, number][] | Bottom edge control points (4 points) |
colors | colors: [string, string, string, string] | Corner colors [topLeft, topRight, bottomLeft, bottomRight] |
left | left: [number, number][] | Left edge control points (4 points) |
right | right: [number, number][] | Right edge control points (4 points) |
top | top: [number, number][] | Top edge control points (4 points) |
Curve gradient - gradient that follows a curve path
interface CurveGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
controlPoints | controlPoints?: [number, number][] | Curve control points (cubic bezier). Provide 4 points per segment (p0, c1, c2, p3). |
curves | curves?: CurvePathDef[] | Multiple independent curves (shared stops by default). |
emissionSide | emissionSide?: CurveEmissionSide | Emission side relative to curve direction |
falloffMode | falloffMode?: CurveFalloffMode | Falloff mode for distance from curve |
type | type: "curve" | Gradient kind discriminator. |
width | width?: number | Gradient width perpendicular to curve |
widthEasing | widthEasing?: CurveWidthEasing | Width interpolation easing between stops |
Curve path definition (for multi-curve gradients)
interface CurvePathDef
| Member | Signature | Description |
|---|---|---|
controlPoints | controlPoints: [number, number][] | Curve control points (cubic bezier). Provide 4 points per segment (p0, c1, c2, p3). |
width | width?: number | Optional width override for this curve |
Diamond gradient - diamond-shaped gradient from center
interface DiamondGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
angle | angle?: number | Rotation angle in degrees |
center | center: [number, number] | Center point [x, y] in normalized coordinates (0-1) |
focal | focal?: [number, number] | Optional focal point [x, y] for asymmetric diamond gradients |
radius | radius?: number | Gradient radius in normalized coordinates (relative to min dimension) |
scaleX | scaleX?: number | Horizontal scale |
scaleY | scaleY?: number | Vertical scale |
type | type: "diamond" | Gradient kind discriminator. |
Freeform gradient - N arbitrary color points with Gaussian-weighted blending Most flexible gradient type, similar to Illustrator's freeform gradient
interface FreeformGradientDef extends OptionalStopsGradientDef
| Member | Signature | Description |
|---|---|---|
aspect | aspect?: number | Aspect ratio adjustment |
falloff | falloff?: number | Falloff rate for color blending (higher = sharper transitions) |
points | points: GradientPoint[] | Array of gradient points with position and color |
power | power?: number | Power for distance weighting |
type | type: "freeform" | Gradient kind discriminator. |
A control point for N-point gradients
interface GradientControlPoint
| Member | Signature | Description |
|---|---|---|
color | color: string | CSS color string |
position | position: [number, number] | Position [x, y] in normalized coordinates (0-1) |
radius | radius?: number | Influence radius |
Configuration for gradient color noise effect.
interface GradientNoiseConfig
| Member | Signature | Description |
|---|---|---|
density | density?: number | Number of interpolated stops to generate |
hueRange | hueRange?: number | Hue variation range in degrees |
lumRange | lumRange?: number | Lightness variation range |
satRange | satRange?: number | Saturation variation range |
seed | seed?: number | Random seed for reproducible noise |
Paint source backed by a canonical gradient definition.
interface GradientPaint
| Member | Signature | Description |
|---|---|---|
gradient | gradient: GradientDef | Gradient definition (linear, radial, conic, etc.) |
type | type: "gradient" | Paint kind discriminator. |
A point in a freeform gradient
interface GradientPoint
| Member | Signature | Description |
|---|---|---|
color | color: string | CSS color string |
position | position: [number, number] | Position [x, y] in normalized coordinates (0-1) |
A single color stop in a gradient
interface GradientStop
| Member | Signature | Description |
|---|---|---|
color | color: string | CSS color string (hex, rgb, rgba, hsl, hsla, named) |
offset | offset: number | Position along gradient (0-1) |
Public, serializable Hybrid brush definition.
interface HybridBrushDefinition
| Member | Signature | Description |
|---|---|---|
id | id: string | Stable registry id. |
layers | layers: HybridBrushLayerDefinition[] | Back-to-front ordered layers. |
name | name: string | Human-readable brush name. |
type | type: "hybrid" | Brush definition discriminator. |
One stable, independently configured layer in a Hybrid brush.
interface HybridBrushLayerDefinition
| Member | Signature | Description |
|---|---|---|
brushId | brushId: string | Brush or preset id owned by the selected engine. |
enabled | enabled: boolean | Whether this layer participates in rendering. |
engineId | engineId: string | Brush engine plugin id. Hybrid cannot recursively contain Hybrid. |
id | id: string | Stable layer identity. Reordering layers never changes this value. |
settings | settings?: BrushDefinitionSettings | Engine-specific serializable settings frozen into each stroke recipe. |
style | style?: BrushDefinitionStyle | Layer-level compositing applied to committed and live output. |
transform | transform?: BrushTransform | Serializable point transform applied before dispatching to this layer. |
Image-based pattern
interface ImagePatternDef extends BasePatternDef
| Member | Signature | Description |
|---|---|---|
fit | fit?: PatternFit | Fit mode |
repeat | repeat?: PatternRepeat | Repetition mode |
src | src: string | URL or data URL of the image |
type | type: "image" | Pattern kind discriminator. |
Linear gradient - interpolates along a line from start to end point
interface LinearGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
end | end: [number, number] | End point [x, y] in normalized coordinates (0-1) |
start | start: [number, number] | Start point [x, y] in normalized coordinates (0-1) |
type | type: "linear" | Gradient kind discriminator. |
N-Point gradient - gradient defined by N control points
interface NPointGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
points | points: GradientControlPoint[] | Array of control points |
type | type: "npoint" | Gradient kind discriminator. |
Procedural noise pattern
interface NoisePatternDef extends BasePatternDef
| Member | Signature | Description |
|---|---|---|
colorMode | colorMode?: "grayscale" | "color" | Color mode |
colors | colors?: [string, string] | Base colors for noise output |
frequency | frequency?: number | Noise frequency/detail level |
noiseType | noiseType: NoiseType | Noise algorithm |
octaves | octaves?: number | Number of octaves for fbm/turbulence |
persistence | persistence?: number | Persistence between octaves |
seed | seed?: number | Random seed for reproducible results |
type | type: "noise" | Pattern kind discriminator. |
Shared gradient properties for gradient types that can derive their stops.
interface OptionalStopsGradientDef extends Omit<BaseGradientDef, "stops">
| Member | Signature | Description |
|---|---|---|
stops | stops?: GradientStop[] | Optional color stops used when the gradient does not derive them. |
Structural input shared by normalized paint effects.
interface PaintEffectInput
| Member | Signature | Description |
|---|---|---|
blendMode | blendMode?: unknown | Raw blend mode value. |
enabled | enabled?: unknown | Raw enabled state. |
opacity | opacity?: unknown | Raw opacity value. |
paint | paint?: Paint | string | null | Paint value applied by the effect. |
Paint source backed by an image, noise, or SVG pattern.
interface PatternPaint
| Member | Signature | Description |
|---|---|---|
pattern | pattern: PatternDef | Pattern definition (image, noise, svg) |
type | type: "pattern" | Paint kind discriminator. |
Radial gradient - radiates from a center point with optional focal offset Supports elliptical gradients via scaleY and rotation via angle
interface RadialGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
angle | angle?: number | Rotation angle in degrees (0-360) |
aspect | aspect?: number | Aspect ratio adjustment |
center | center: [number, number] | Center point [x, y] in normalized coordinates (0-1) |
centerRadius | centerRadius: number | Outer radius at center (0-1, where 1 = full width/height) |
focal | focal?: [number, number] | Optional focal point [x, y] for off-center gradients |
focalRadius | focalRadius?: number | Optional inner radius at focal point |
scaleY | scaleY?: number | Vertical scale for elliptical gradients (1.0 = circle, <1 = wide, >1 = tall) |
type | type: "radial" | Gradient kind discriminator. |
SVG pattern reference
interface SVGPatternDef extends BasePatternDef
| Member | Signature | Description |
|---|---|---|
content | content: string | SVG content or URL |
inline | inline?: boolean | Whether content is inline SVG or URL |
repeat | repeat?: PatternRepeat | Repetition mode |
type | type: "svg" | Pattern kind discriminator. |
Shape gradient - gradient that follows a shape contour
interface ShapeGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
angle | angle?: number | Rotation angle in degrees |
bandWidth | bandWidth?: number | Stroke band width (0 = fill), normalized 0-1 |
center | center: [number, number] | Center point [x, y] in normalized coordinates (0-1) |
closePath | closePath?: boolean | Close the polygon path (default: true) |
emissionMode | emissionMode?: ShapeEmissionMode | Which side(s) to emit from the polygon |
focal | focal?: [number, number] | Optional focal point for square/diamond shapes |
points | points?: [number, number][] | Polygon points in normalized coordinates (0-1) |
radius | radius?: number | Square/diamond radius in normalized coordinates (relative to min dimension) |
scaleY | scaleY?: number | Vertical scale for square/diamond shapes |
shape | shape: "square" | "diamond" | "star" | "polygon" | Shape type |
sides | sides?: number | Number of sides (for polygon) |
size | size?: number | Gradient spread as a fraction of the shorter dimension |
type | type: "shape" | Gradient kind discriminator. |
Public brush activation options.
interface SketchBrushUseOptions
| Member | Signature | Description |
|---|---|---|
saveSettings | saveSettings?: boolean | Persist supplied activation values as remembered tool settings. |
toolId | toolId?: string | Tool id used to activate the brush. |
File entry returned by a native Sketchpad bundle export.
interface SketchBundleEntry
| Member | Signature | Description |
|---|---|---|
name | name: string | File name within the exported bundle. |
value | value: Blob | Serialized file content. |
Point offset applied to pasted layers in document coordinates.
interface SketchClipboardPasteOffset
| Member | Signature | Description |
|---|---|---|
x | x?: number | Horizontal offset in document coordinates. |
y | y?: number | Vertical offset in document coordinates. |
Options accepted by SketchAPI.clipboard.paste(...).
interface SketchClipboardPasteOptions<TLayer extends SketchLayerHandle = SketchLayerHandle, TDocument = object> extends SketchClipboardTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
offsetBy | offsetBy?: SketchClipboardPasteOffset | Offset applied after insertion. |
parent | parent?: SketchClipboardLayerReference<TLayer> | null | Destination group, null for the scene root, or omitted for the current selection context. |
Options targeting one open document.
interface SketchClipboardTargetOptions<TDocument = object>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
Options accepted when clearing an open document.
interface SketchDocumentClearOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle> extends SketchDocumentTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
recordHistory | recordHistory?: boolean | Record the clear operation in document history. |
Options accepted when creating an empty live document in the mounted host.
interface SketchDocumentCreateOptions
| Member | Signature | Description |
|---|---|---|
height | height?: number | Initial document height in the requested units. |
units | units?: SketchDocumentSize["units"] | Document unit id understood by the runtime. |
width | width?: number | Initial document width in the requested units. |
Options accepted when fitting an open document into its viewport.
interface SketchDocumentFitOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle> extends SketchDocumentTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
margin | margin?: number | Padding around the fitted document or region. |
rect | rect?: SketchDocumentRect | Optional region to fit instead of the full document. |
Live document capability returned by an instance-scoped SketchAPI.
This is deliberately narrower than the internal document runtime and is not the portable SketchDocument save format.
interface SketchDocumentHandle<TLayer extends SketchLayerHandle = SketchLayerHandle>
| Member | Signature | Description |
|---|---|---|
height | readonly height?: number | Current document height in document units. |
layers | readonly layers?: readonly TLayer[] | Snapshot-readable layer collection owned by this document. |
uuid | readonly uuid: string | Stable identity of this open document. |
width | readonly width?: number | Current document width in document units. |
Rectangular document region used by public camera fitting operations.
interface SketchDocumentRect
| Member | Signature | Description |
|---|---|---|
height | height: number | Region height in document units. |
width | width: number | Region width in document units. |
x | x: number | Horizontal origin in document units. |
y | y: number | Vertical origin in document units. |
Required dimensions used by public document resize operations.
interface SketchDocumentSize
| Member | Signature | Description |
|---|---|---|
height | height: number | Document height in the requested units. |
units | units?: SketchMeasurementUnits | Optional document unit id understood by the runtime. |
width | width: number | Document width in the requested units. |
Options shared by operations targeting an open document.
interface SketchDocumentTargetOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
Camera and document-size changes accepted by setViewport(...).
interface SketchDocumentViewportChanges
| Member | Signature | Description |
|---|---|---|
height | height?: number | Replacement document height. |
scroll | scroll?: { x: number; y: number } | Replacement viewport scroll position. |
units | units?: SketchDocumentSize["units"] | Replacement document units. |
width | width?: number | Replacement document width. |
zoom | zoom?: number | Replacement viewport zoom multiplier. |
Options accepted when resizing an open document's viewport.
interface SketchDocumentViewportOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle> extends SketchDocumentTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
height | height?: number | Explicit viewport height, or omit to measure the host element. |
width | width?: number | Explicit viewport width, or omit to measure the host element. |
Immutable camera and document-size state for one open document.
interface SketchDocumentViewportState
| Member | Signature | Description |
|---|---|---|
height | readonly height: number | Document height in its current units. |
scroll | readonly scroll: Readonly<{ x: number; y: number }> | Current viewport scroll position. |
units | readonly units?: SketchDocumentSize["units"] | Current document units. |
width | readonly width: number | Document width in its current units. |
zoom | readonly zoom: number | Current zoom multiplier. |
Options accepted by public undo and redo operations.
interface SketchHistoryMoveOptions<TDocument = object> extends SketchHistoryTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
steps | steps?: number | Positive number of journal entries to apply. |
Options targeting one open document's history.
interface SketchHistoryTargetOptions<TDocument = object>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
Options accepted by one atomic public history transaction.
interface SketchHistoryTransactionOptions<TDocument = object> extends SketchHistoryTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
name | name?: string | User-facing history entry name. |
Asset metadata returned when media is installed without creating a layer.
interface SketchImportedMediaAsset
| Member | Signature | Description |
|---|---|---|
assetId | readonly assetId: string | Stable asset id used by document layers and resource references. |
height | readonly height?: number | Imported asset height when the source has intrinsic dimensions. |
width | readonly width?: number | Imported asset width when the source has intrinsic dimensions. |
Structured JSON document accepted by open.json.
interface SketchJsonInputDocument
| Member | Signature | Description |
|---|---|---|
assets | assets?: Record<string, unknown> | Serialized asset table. |
config | config?: Record<string, unknown> | Serialized document configuration. |
history | history?: unknown | Serialized undo history. |
layers | layers?: unknown[] | Serialized root layer tree. |
resources | resources?: unknown[] | Serialized reusable document resources. |
Bounding-box and transform fields accepted by public layer creation.
interface SketchLayerBoundsInput
| Member | Signature | Description |
|---|---|---|
anchor | anchor?: number | Partial<SketchLayerPointLike> | Anchor ratio or horizontal and vertical anchor ratios. |
height | height?: number | Layer height in document units. |
rotation | rotation?: number | Clockwise rotation in radians. |
scale | scale?: number | Partial<SketchLayerPointLike> | Uniform scale or horizontal and vertical scale factors. |
sx | sx?: number | Horizontal scale override. |
sy | sy?: number | Vertical scale override. |
translate | translate?: Partial<SketchLayerPointLike> | Relative translation in document units. |
width | width?: number | Layer width in document units. |
x | x?: number | Horizontal position in document units. |
y | y?: number | Vertical position in document units. |
Options accepted when creating layers.
interface SketchLayerCreateOptions<TDocument = object>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
recordHistory | recordHistory?: boolean | Record the creation in document history. |
select | select?: boolean | Select the created layers. |
Common layer input accepted by SketchAPI.layer.create(...).
interface SketchLayerDefinition extends SketchLayerProperties
| Member | Signature | Description |
|---|---|---|
type | readonly type: string | Canonical layer/tool type id. |
Live layer capability returned by an instance-scoped SketchAPI.
interface SketchLayerHandle
| Member | Signature | Description |
|---|---|---|
id | readonly id: string | Stable identity within the owning document. |
idx | readonly idx?: number | Current zero-based position within the parent layer collection. |
name | readonly name?: string | User-facing layer name when one is assigned. |
type | readonly type: string | Canonical layer/tool type id. |
Options accepted when moving a layer within the document tree.
interface SketchLayerMoveOptions<TLayer extends SketchLayerHandle = SketchLayerHandle, TDocument = object> extends SketchLayerTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
index | index: number | Zero-based destination index in the target parent. |
parent | parent?: SketchLayerReference<TLayer> | null | Destination group, null for the scene root, or omitted for the current parent. |
recordHistory | recordHistory?: boolean | Record the ordering change in document history. |
Common serializable properties shared by public layer creation and updates.
interface SketchLayerProperties extends SketchLayerBoundsInput
| Member | Signature | Description |
|---|---|---|
bbox | bbox?: SketchLayerBoundsInput | Explicit bounding-box transform, when preferred over top-level geometry fields. |
fill | fill?: FillInput | null | Primary fill paint. |
fills | fills?: readonly FillInput[] | Ordered fill paint stack. |
name | name?: string | User-facing layer name. |
opacity | opacity?: number | Layer opacity from zero to one. |
stroke | stroke?: StrokeInput | null | Primary stroke paint. |
strokes | strokes?: readonly StrokeInput[] | Ordered stroke paint stack. |
visible | visible?: boolean | Whether the layer participates in rendering. |
Options accepted when removing layers.
interface SketchLayerRemoveOptions<TDocument = object> extends SketchLayerTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
fadeOut | fadeOut?: number | Optional removal fade duration in milliseconds. |
recordHistory | recordHistory?: boolean | Record the removal in document history. |
Options shared by operations targeting layers in an open document.
interface SketchLayerTargetOptions<TDocument = object>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
Options accepted when updating one or more layers.
interface SketchLayerUpdateOptions<TDocument = object> extends SketchLayerTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
recordHistory | recordHistory?: boolean | Record the update in document history. |
storeAs | storeAs?: string | Optional history entry name. |
Result of installing a reusable media asset.
interface SketchMediaAssetResult
| Member | Signature | Description |
|---|---|---|
asset | readonly asset: SketchImportedMediaAsset | Reusable asset installed by the importer. |
kind | readonly kind: "asset" | Result discriminator. |
Result of importing a heterogeneous collection.
interface SketchMediaBatchResult<TDocument = object, TLayer extends SketchLayerHandle = SketchLayerHandle>
| Member | Signature | Description |
|---|---|---|
kind | readonly kind: "batch" | Result discriminator. |
results | readonly results: readonly SketchMediaAddResult<TDocument, TLayer>[] | Ordered normalized results for each imported input. |
Result of opening media as a document.
interface SketchMediaDocumentResult<TDocument = object>
| Member | Signature | Description |
|---|---|---|
document | readonly document: TDocument | Document opened by the importer. |
kind | readonly kind: "document" | Result discriminator. |
Result of creating one media layer.
interface SketchMediaLayerResult<TLayer extends SketchLayerHandle = SketchLayerHandle>
| Member | Signature | Description |
|---|---|---|
kind | readonly kind: "layer" | Result discriminator. |
layer | readonly layer: TLayer | Layer created by the importer. |
Result of creating multiple media layers.
interface SketchMediaLayersResult<TLayer extends SketchLayerHandle = SketchLayerHandle>
| Member | Signature | Description |
|---|---|---|
kind | readonly kind: "layers" | Result discriminator. |
layers | readonly layers: readonly TLayer[] | Layers created by the importer. |
Informational result produced by resource-only imports such as brush packs.
interface SketchMediaMessageResult
| Member | Signature | Description |
|---|---|---|
kind | readonly kind: "message" | Result discriminator. |
message | readonly message: string | Informational message produced by the importer. |
Result produced when an importer completes without creating a public value.
interface SketchMediaNoneResult
| Member | Signature | Description |
|---|---|---|
kind | readonly kind: "none" | Result discriminator. |
Shared two-dimensional document-space point.
interface SketchMediaPoint
| Member | Signature | Description |
|---|---|---|
x | x: number | Horizontal document-space coordinate. |
y | y: number | Vertical document-space coordinate. |
Document-space rectangle used to constrain an export.
interface SketchSaveRegion
| Member | Signature | Description |
|---|---|---|
height | height?: number | Region height in document units. |
width | width?: number | Region width in document units. |
x | x?: number | Horizontal region origin in document units. |
y | y?: number | Vertical region origin in document units. |
Options accepted when selecting layers.
interface SketchSelectionOptions<TDocument = object> extends SketchSelectionTargetOptions<TDocument>
| Member | Signature | Description |
|---|---|---|
replace | replace?: boolean | Replace the existing selection before selecting the input. |
Options shared by selection operations targeting an open document.
interface SketchSelectionTargetOptions<TDocument = object>
| Member | Signature | Description |
|---|---|---|
doc | doc?: TDocument | Target document, defaulting to the active document. |
Options accepted while applying tool configuration.
interface SketchToolConfigOptions
| Member | Signature | Description |
|---|---|---|
registerNullProperties | registerNullProperties?: boolean | Register values that are not already present on the target config. |
silent | silent?: boolean | Suppress configuration change notifications. |
Portable recipe for one Sketchpad product experience.
Runtime services, credentials, documents, and mounted objects are excluded.
interface SketchpadAppDefinition
| Member | Signature | Description |
|---|---|---|
assets | assets?: SketchpadAssetSources | Portable asset source selections. |
capabilities | capabilities?: SketchpadCapabilities | Product capabilities requested by the definition. |
defaults | defaults?: SketchpadDefaults | Defaults contributed to newly created app state. |
definitionVersion | definitionVersion: string | Author-managed revision of this recipe. |
description | description?: string | Human-readable description. |
extensions | extensions?: Record<string, SketchpadJsonValue> | Namespaced extension data preserved without interpretation. |
integrations | integrations?: SketchpadIntegrationRequirements | Runtime integrations requested from the host. |
name | name: string | Human-readable app name. |
settings | settings?: SketchpadSettingsDefaults | Catalog-owned app setting defaults. |
sketchApi | sketchApi: string | Compatible Sketchpad app-definition schema version. |
tools | tools?: SketchpadToolSurface | Canonical tool selection and presentation. |
ui | ui?: SketchpadUiComposition | Registered UI composition. |
Required and optional product capabilities selected by a definition.
interface SketchpadCapabilities
| Member | Signature | Description |
|---|---|---|
optional | optional?: string[] | Capabilities the runtime may use when available. |
required | required?: string[] | Capabilities that must be available before mounting. |
Lightweight document reference accepted by the browser files service.
interface SketchpadFilesDocument
| Member | Signature | Description |
|---|---|---|
uuid | readonly uuid: string | Stable identity of the open Sketchpad document. |
Options accepted when duplicating a stored Sketchpad file.
interface SketchpadFilesDuplicateOptions
| Member | Signature | Description |
|---|---|---|
name | name?: string | User-facing name for the copy. Defaults to the source name. |
Options accepted when opening a stored Sketchpad file.
interface SketchpadFilesOpenOptions
| Member | Signature | Description |
|---|---|---|
openAsNew | openAsNew?: boolean | Open beside the active document instead of replacing it. Defaults to false. |
signal | signal?: AbortSignal | Cancel reading or opening the file. |
Options accepted when saving an open Sketchpad document.
interface SketchpadFilesSaveOptions
| Member | Signature | Description |
|---|---|---|
doc | doc?: SketchpadFilesDocument | Document to save. Defaults to the active document. |
name | name?: string | User-facing name for the stored file. |
signal | signal?: AbortSignal | Cancel serialization or persistence. |
Instance-bound local document library supplied through host.services.files.
interface SketchpadFilesService
| Member | Signature | Description |
|---|---|---|
delete | delete(id: string) -> Promise<void> | Delete a stored file without closing an open document. |
duplicate | duplicate(id: string, options?: SketchpadFilesDuplicateOptions) -> Promise<SketchpadStoredFile> | Copy a stored file under a new identity. |
flush | flush() -> Promise<void> | Wait for all currently queued autosaves. |
list | list() -> Promise<readonly SketchpadStoredFile[]> | List stored files from most recently updated to oldest. |
open | open(id: string, options?: SketchpadFilesOpenOptions) -> Promise<SketchpadFilesDocument> | Open a stored native Sketchpad file in the mounted instance. |
rename | rename(id: string, name: string) -> Promise<SketchpadStoredFile> | Change a stored file's user-facing name. |
save | save(options?: SketchpadFilesSaveOptions) -> Promise<SketchpadStoredFile> | Save an open document as a native Sketchpad file. |
type | readonly type: "sketchapi.files" | Stable host-service discriminator. |
Runtime integrations requested from the embedding host.
interface SketchpadIntegrationRequirements
| Member | Signature | Description |
|---|---|---|
optional | optional?: string[] | Integrations used only when the host supplies them. |
required | required?: string[] | Integrations that must be supplied before mounting. |
Metadata for one native Sketchpad file stored by a files service.
interface SketchpadStoredFile
| Member | Signature | Description |
|---|---|---|
createdAt | readonly createdAt: number | Time the stored file was first created, in milliseconds since the Unix epoch. |
id | readonly id: string | Stable storage identity. |
name | readonly name: string | User-facing file name. |
size | readonly size: number | Native Sketchpad archive size in bytes. |
updatedAt | readonly updatedAt: number | Time the stored file was last written, in milliseconds since the Unix epoch. |
One ordered group in the Sketchpad tool surface.
interface SketchpadToolGroup
| Member | Signature | Description |
|---|---|---|
id | id: string | Stable group id. |
tools | tools: string[] | Canonical tool ids in display order. |
Portable presentation overrides for a canonical tool.
interface SketchpadToolPresentation
| Member | Signature | Description |
|---|---|---|
description | description?: string | Human-readable tool description. |
icon | icon?: string | Registered icon or portable asset id. |
label | label?: string | Human-readable tool label. |
tooltip | tooltip?: string | Human-readable hover or focus help. |
Canonical tools selected and arranged by an app definition.
interface SketchpadToolSurface
| Member | Signature | Description |
|---|---|---|
defaultTool | defaultTool?: string | Tool selected for a newly mounted app. |
groups | groups?: SketchpadToolGroup[] | Ordered tool groups. |
overrides | overrides?: Record<string, SketchpadJsonObject> | Catalog-supported options keyed by canonical tool id. |
presentation | presentation?: Record<string, SketchpadToolPresentation> | Presentation overrides keyed by canonical tool id. |
Registered UI contributions grouped into stable regions.
interface SketchpadUiComposition
| Member | Signature | Description |
|---|---|---|
regions | regions?: Record<string, SketchpadUiContribution[]> | Contributions keyed by canonical region id. |
One registered contribution in a Sketchpad UI region.
interface SketchpadUiContribution
| Member | Signature | Description |
|---|---|---|
options | options?: SketchpadJsonObject | Catalog-owned contribution options. |
type | type: string | Registered contribution type. |
Spiral gradient - spirals outward from center.
interface SpiralGradientDef extends BaseGradientDef
| Member | Signature | Description |
|---|---|---|
center | center: [number, number] | Center point [x, y] in normalized coordinates (0-1) |
coils | coils?: number | Number of spiral rotations/coils |
ellipseAngle | ellipseAngle?: number | Ellipse rotation angle in degrees |
focal | focal?: [number, number] | Optional focal point [x, y] for off-center spirals |
growth | growth?: number | Spiral growth rate |
rotation | rotation?: number | Starting rotation angle in degrees |
rotations | rotations?: number | Number of rotations |
scaleX | scaleX?: number | Horizontal scale |
scaleY | scaleY?: number | Vertical scale |
startAngle | startAngle?: number | Starting angle in degrees |
type | type: SpiralGradientKind | Gradient kind discriminator. |
Structural input accepted by stroke effect normalization.
interface StrokeEffectInput extends PaintEffectInput
| Member | Signature | Description |
|---|---|---|
alignment | alignment?: unknown | Alias for stroke position. |
cap | cap?: unknown | Alias for line cap. |
dashArray | dashArray?: unknown | Alias for line dash. |
dashOffset | dashOffset?: unknown | Alias for line dash offset. |
join | join?: unknown | Alias for line join. |
lineCap | lineCap?: unknown | Raw line cap value. |
lineDash | lineDash?: unknown | Raw line dash sequence. |
lineDashOffset | lineDashOffset?: unknown | Raw line dash offset. |
lineJoin | lineJoin?: unknown | Raw line join value. |
lineWidth | lineWidth?: unknown | Alias for stroke width. |
miterLimit | miterLimit?: unknown | Raw miter limit. |
position | position?: unknown | Raw stroke position. |
width | width?: unknown | Raw stroke width. |
Data-only UI surface metadata exported from tool config files.
interface ToolSurfaceConfig
| Member | Signature | Description |
|---|---|---|
quickOnly | quickOnly?: boolean | Whether the tool is meant to be activated only as a held or temporary tool. |
surface | surface: ToolSurface | Where the tool should be exposed. |
Public serializable brush definition.
type BrushDefinition = HybridBrushDefinition
Engine-specific JSON settings stored with a brush layer.
type BrushDefinitionSettings = Readonly<Record<string, unknown>>
Serializable brush point transform.
type BrushTransform = { type: "offset"; x?: number; y?: number } | { type: "rotate"; angle: number; origin?: BrushTransformOrigin } | { type: "mirror"; angle?: number; axis: "angle" | "x" | "y"; origin?: BrushTransformOrigin } | { type: "radial"; count: number; index?: number; origin?: BrushTransformOrigin }
Origin used by declarative brush transforms.
type BrushTransformOrigin = "canvas-center" | "stroke-start" | "viewport-center" | { x: number; y: number }
Color space for gradient interpolation Maps to imagefx ColorSpace enum
type ColorSpace = "linear-rgb" | "srgb" | "oklab"
Coordinate system for Y-axis orientation Maps to imagefx CoordSystem enum
type CoordSystem = "canvas" | "gl"
Curve emission side Maps to imagefx CurveEmissionSide enum
type CurveEmissionSide = "both" | "left" | "right"
Curve falloff mode Maps to imagefx FalloffMode enum
type CurveFalloffMode = "radial" | "perpendicular"
Curve width easing between stops Maps to imagefx width_easing flag
type CurveWidthEasing = "linear" | "ease-in-out"
How the gradient behaves beyond its defined range Maps to imagefx ExtendMode enum
type ExtendMode = "clamp" | "repeat" | "reflect" | "repeat-reverse" | "reflect-reverse"
Input accepted when normalizing a fill effect.
type FillInput = Paint | string | PaintEffectInput
Any gradient definition type
type GradientDef = LinearGradientDef | RadialGradientDef | ConicGradientDef | DiamondGradientDef | SpiralGradientDef | ShapeGradientDef | NPointGradientDef | CurveGradientDef | CoonsGradientDef | FreeformGradientDef
2D transform matrix [a, b, c, d, e, f] Equivalent to DOMMatrix/Canvas 2D transform order.
type GradientTransform = [number, number, number, number, number, number]
Portable hosted save representations keyed by their requested format.
type HostedSketchSaveOutputMap = { arrayBuffer: ArrayBuffer; base64: string; blob: Blob; dataURL: string; object: SketchJsonDocument; string: string }
| Member | Signature | Description |
|---|---|---|
arrayBuffer | arrayBuffer: ArrayBuffer | Raw exported bytes. |
base64 | base64: string | Base64-encoded export payload without a data URL prefix. |
blob | blob: Blob | Export payload with its media type. |
dataURL | dataURL: string | Data URL containing the exported payload. |
object | object: SketchJsonDocument | Parsed Sketch JSON document. |
string | string: string | Text representation of the exported payload. |
Procedural noise algorithm types
type NoiseType = "perlin" | "simplex" | "worley" | "fbm" | "turbulence" | "white"
A Paint is a single visual source Discriminated union - check type to determine which property is active
type Paint = ColorPaint | GradientPaint | PatternPaint
Any pattern definition type
type PatternDef = ImagePatternDef | NoisePatternDef | SVGPatternDef
How a pattern fits within its container Similar to CSS background-size
type PatternFit = "tile" | "fill" | "contain" | "cover"
How a pattern repeats across its container Maps to CSS/Canvas pattern repetition
type PatternRepeat = "repeat" | "repeat-x" | "repeat-y" | "no-repeat"
Pattern scale. A number scales both axes; a tuple scales [x, y].
type PatternScale = number | [number, number]
Affine transform for pattern coordinate space.
type PatternTransform = [number, number, number, number, number, number]
Registered definitions already require stable ids.
type RegisteredBrushDefinition = BrushDefinition
Options forwarded to the Sketch tool switcher.
type SetCurrentToolOptions = { saveSettings?: boolean }
| Member | Signature | Description |
|---|---|---|
saveSettings | saveSettings?: boolean | Persist supplied values as the tool's remembered settings. |
Shape gradient emission side
type ShapeEmissionMode = "inside" | "outside" | "bidirectional"
Public reference accepted by clipboard layer operations.
type SketchClipboardLayerReference<TLayer extends SketchLayerHandle = SketchLayerHandle> = string | TLayer
Public reference accepted by document lookup and close operations.
type SketchDocumentReference<TDocument extends SketchDocumentHandle = SketchDocumentHandle> = number | string | TDocument
Options accepted when resizing an open document.
type SketchDocumentResizeOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle> = SketchDocumentSize & SketchDocumentTargetOptions<TDocument>
Options accepted when replacing document viewport state.
type SketchDocumentSetViewportOptions<TDocument extends SketchDocumentHandle = SketchDocumentHandle> = SketchDocumentViewportChanges & SketchDocumentTargetOptions<TDocument>
Portable object returned by sketch.save.json({ as: 'object' }).
type SketchJsonDocument = Record<string, unknown> & { config: Record<string, unknown>; layers: SketchJsonLayer[]; version: string }
Input accepted by the native JSON document opener.
type SketchJsonInput = Blob | SketchJsonInputDocument | string
Portable serialized layer returned by Sketch JSON export.
type SketchJsonLayer = Record<string, unknown> & { children?: SketchJsonLayer[]; id?: string; type?: string }
Common properties plus caller-owned extensions inferred by update operations.
type SketchLayerChanges<TChanges extends object = object> = Readonly<SketchLayerProperties & TChanges>
Shared two-dimensional layer point or scale value.
type SketchLayerPointLike = { x: number; y: number }
| Member | Signature | Description |
|---|---|---|
x | x: number | Horizontal coordinate or scale. |
y | y: number | Vertical coordinate or scale. |
Public reference accepted by layer lookup and mutation operations.
type SketchLayerReference<TLayer extends SketchLayerHandle = SketchLayerHandle> = string | TLayer
Detached serializable state for one live layer.
type SketchLayerSnapshot<TData extends object = Record<string, unknown>> = Readonly<TData> & { readonly id: string; readonly type: string }
Supported measurement unit labels.
type SketchMeasurementUnits = "px" | "pt" | "pc" | "in" | "ft" | "yd" | "mm" | "cm" | "m"
Deterministic result produced by the general media importer.
type SketchMediaAddResult<TDocument = object, TLayer extends SketchLayerHandle = SketchLayerHandle> = SketchMediaDocumentResult<TDocument> | SketchMediaAssetResult | SketchMediaLayerResult<TLayer> | SketchMediaLayersResult<TLayer> | SketchMediaMessageResult | SketchMediaNoneResult | SketchMediaBatchResult<TDocument, TLayer>
Input accepted by the public PSD opener.
type SketchPsdInput = ArrayBuffer | Blob | File | string
Layer or layer id accepted by public selection operations.
type SketchSelectionInput<TLayer extends SketchLayerHandle = SketchLayerHandle> = string | TLayer | readonly (string | TLayer)[]
Tool config values keyed by registered tool id.
type SketchToolConfigMap<TConfig extends object = SketchToolConfigValues> = Readonly<Record<string, Readonly<TConfig>>>
Dynamic, schema-validated values for one registered tool.
type SketchToolConfigValues = Readonly<Record<string, unknown>>
Data-only identity for an activated tool.
type SketchToolHandle = { readonly id: string; readonly toolkitId?: string }
| Member | Signature | Description |
|---|---|---|
id | readonly id: string | Canonical tool id. |
toolkitId | readonly toolkitId?: string | Toolkit family that owns the tool implementation. |
Public metadata for a registered Sketch tool.
type SketchToolListEntry = { capabilities?: Record<string, boolean>; id: string; surface?: ToolSurfaceConfig; toolkitId?: string }
| Member | Signature | Description |
|---|---|---|
capabilities | capabilities?: Record<string, boolean> | Capability flags registered for this tool. |
id | id: string | Tool id used with sketch.tool.use(...). |
surface | surface?: ToolSurfaceConfig | Config-pane surface metadata for this tool. |
toolkitId | toolkitId?: string | Toolkit family that owns the tool implementation. |
Filters accepted by sketch.tool.list(...).
type SketchToolListFilter = { capability?: string; surface?: string; toolkitId?: string }
| Member | Signature | Description |
|---|---|---|
capability | capability?: string | Keep tools that declare this capability. |
surface | surface?: string | Keep tools assigned to this config surface id. |
toolkitId | toolkitId?: string | Keep tools from this toolkit family. |
Author input accepted by defineSketchpadApp; the SDK owns its schema version.
type SketchpadAppDefinitionInput = Omit<SketchpadAppDefinition, "sketchApi">
Portable asset source ids keyed by catalog-owned role.
type SketchpadAssetSources = Record<string, string[]>
Catalog-owned defaults applied when the app creates new state.
type SketchpadDefaults = Record<string, SketchpadJsonValue> & { document?: SketchpadInitialDocument }
Initial document behavior for the maintained browser runtime.
type SketchpadInitialDocument = false | SketchDocumentCreateOptions
A JSON-safe object with string keys.
type SketchpadJsonObject = { [key: string]: SketchpadJsonValue }
A primitive value preserved by JSON serialization.
type SketchpadJsonPrimitive = boolean | null | number | string
A recursively JSON-safe value used by portable Sketchpad contracts.
type SketchpadJsonValue = SketchpadJsonPrimitive | SketchpadJsonValue[] | SketchpadJsonObject
Catalog-owned setting defaults keyed by canonical setting id.
type SketchpadSettingsDefaults = Record<string, SketchpadJsonValue>
Spiral gradient variant.
type SpiralGradientKind = "spiral" | "archimedean-spiral" | "logarithmic-spiral"
Input accepted when normalizing a stroke effect.
type StrokeInput = Paint | string | StrokeEffectInput
Normalized public schema for a registered tool.
type ToolSchema = { capabilities?: Record<string, boolean>; id: string; surface?: ToolSurfaceConfig; toolkitId?: string; values: Record<string, ToolSchemaValue> }
| Member | Signature | Description |
|---|---|---|
capabilities | capabilities?: Record<string, boolean> | Capability flags declared by the tool. |
id | id: string | Canonical registered tool id. |
surface | surface?: ToolSurfaceConfig | Config-pane surface metadata. |
toolkitId | toolkitId?: string | Toolkit family that owns the tool. |
values | values: Record<string, ToolSchemaValue> | Public configurable values keyed by config id. |
One public configurable value in a registered tool schema.
type ToolSchemaValue = { default?: unknown; label?: string; max?: number; min?: number; options?: readonly unknown[] | Record<string, unknown>; path: string; step?: number; type: ToolSchemaValueType; unit?: string }
| Member | Signature | Description |
|---|---|---|
default | default?: unknown | Default value applied when the tool has no stored value. |
label | label?: string | Human-readable control label. |
max | max?: number | Maximum numeric value accepted by the control. |
min | min?: number | Minimum numeric value accepted by the control. |
options | options?: readonly unknown[] | Record<string, unknown> | Choice metadata for controls such as select inputs. |
path | path: string | Config path updated by the control. |
step | step?: number | Numeric increment used by stepped controls. |
type | type: ToolSchemaValueType | Canonical control value kind. |
unit | unit?: string | Display unit for numeric values. |
Public value kinds used by registered tool schemas.
type ToolSchemaValueType = "angle" | "blend" | "boolean" | "color" | "filter" | "number" | "paint" | "point" | "resource" | "select" | "style" | "text" | "unknown"
Where a tool should appear in the Sketchpad UI.
type ToolSurface = "primary" | "secondary" | "utility" | "command" | "transient" | "hidden"