UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

24 lines 1.03 kB
import { assign, object } from "@metamask/superstruct"; import { svg, literal } from "../../internals/index.mjs"; import { createBuilder } from "../builder.mjs"; import { NodeStruct, NodeType } from "../nodes.mjs"; export const ImageStruct = assign(NodeStruct, object({ type: literal(NodeType.Image), value: svg(), })); /** * Create an {@link Image} node. * * @param args - The node arguments. This can either be a string, or an object * with the `value` property. * @param args.value - The SVG image to be rendered. Must be a valid SVG string. * @returns The image node as object. Other image formats are supported by * embedding them as data URLs in the SVG. * @deprecated Snaps component functions are deprecated, in favor of the new JSX * components. This function will be removed in a future release. * @example * const node = image({ value: '<svg />' }); * const node = image('<svg />'); */ export const image = createBuilder(NodeType.Image, ImageStruct, ['value']); //# sourceMappingURL=image.mjs.map