UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

25 lines 958 B
import { assign, object, string } from "@metamask/superstruct"; import { literal } from "../../internals/index.mjs"; import { createBuilder } from "../builder.mjs"; import { LiteralStruct, NodeType } from "../nodes.mjs"; export const HeadingStruct = assign(LiteralStruct, object({ type: literal(NodeType.Heading), value: string(), })); /** * Create a {@link Heading} node. * * @param args - The node arguments. This can either be a string, or an object * with the `value` property. * @param args.value - The heading text. * @returns The heading node as object. * @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 = heading({ value: 'Hello, world!' }); * const node = heading('Hello, world!'); */ export const heading = createBuilder(NodeType.Heading, HeadingStruct, [ 'value', ]); //# sourceMappingURL=heading.mjs.map