/** * [[include:src/codecs/vega/README.md]] * * @module codecs/vega */ import schema from '@stencila/schema'; import * as vfile from '../../util/vfile'; import { Codec } from '../types'; export declare const vegaMediaType = "application/vnd.vega+json"; export declare const isVegaMediaType: (mimeType: string) => boolean; export declare class VegaCodec extends Codec implements Codec { readonly mediaTypes: string[]; /** * Decode Vega JSON to an `ImageObject`. * * Most often used to convert the output of a Jupyter cell to an * image for compatibility to non-browser, non-Vega supporting * formats such as Word or Markdown. * * Uses Puppeteer and Vega to generate a static PNG for `contentUrl` for * consistency with the Plotly codec. * * In addition to the static image, stores the Vega JSON in `content` ( * with `mediaType` and `spec` properties, so that the node can be reversed * back to Jupyter if needed, or rendered as an interactive figure in HTML. */ readonly decode: (file: vfile.VFile) => Promise; /** * Encode a Stencila `ImageObject` to Vega spec JSON * * Most often used when encoding a Jupyter Notebook from some other format, when * the source document was itself created from a Jupyter Notebook (ie. reverse * converting back to a Jupyter Notebook from Word) */ readonly encode: (node: schema.Node) => Promise; }