@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
27 lines • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.image = exports.ImageStruct = void 0;
const superstruct_1 = require("@metamask/superstruct");
const internals_1 = require("../../internals/index.cjs");
const builder_1 = require("../builder.cjs");
const nodes_1 = require("../nodes.cjs");
exports.ImageStruct = (0, superstruct_1.assign)(nodes_1.NodeStruct, (0, superstruct_1.object)({
type: (0, internals_1.literal)(nodes_1.NodeType.Image),
value: (0, internals_1.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 />');
*/
exports.image = (0, builder_1.createBuilder)(nodes_1.NodeType.Image, exports.ImageStruct, ['value']);
//# sourceMappingURL=image.cjs.map