@metamask/snaps-sdk 6.20.0 → 6.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/dist/error-wrappers.d.cts +192 -192
- package/dist/error-wrappers.d.mts +192 -192
- package/dist/images.d.cts +1 -1
- package/dist/images.d.mts +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internals/error-wrappers.d.cts +12 -12
- package/dist/internals/error-wrappers.d.mts +12 -12
- package/dist/internals/structs.cjs +29 -8
- package/dist/internals/structs.cjs.map +1 -1
- package/dist/internals/structs.d.cts +8 -0
- package/dist/internals/structs.d.cts.map +1 -1
- package/dist/internals/structs.d.mts +8 -0
- package/dist/internals/structs.d.mts.map +1 -1
- package/dist/internals/structs.mjs +29 -9
- package/dist/internals/structs.mjs.map +1 -1
- package/dist/jsx/components/form/AddressInput.cjs +1 -0
- package/dist/jsx/components/form/AddressInput.cjs.map +1 -1
- package/dist/jsx/components/form/AddressInput.d.cts +2 -0
- package/dist/jsx/components/form/AddressInput.d.cts.map +1 -1
- package/dist/jsx/components/form/AddressInput.d.mts +2 -0
- package/dist/jsx/components/form/AddressInput.d.mts.map +1 -1
- package/dist/jsx/components/form/AddressInput.mjs +1 -0
- package/dist/jsx/components/form/AddressInput.mjs.map +1 -1
- package/dist/jsx/validation.cjs +9 -5
- package/dist/jsx/validation.cjs.map +1 -1
- package/dist/jsx/validation.d.cts +15 -15
- package/dist/jsx/validation.d.cts.map +1 -1
- package/dist/jsx/validation.d.mts +15 -15
- package/dist/jsx/validation.d.mts.map +1 -1
- package/dist/jsx/validation.mjs +9 -5
- package/dist/jsx/validation.mjs.map +1 -1
- package/dist/types/handlers/asset-historical-price.cjs +3 -0
- package/dist/types/handlers/asset-historical-price.cjs.map +1 -0
- package/dist/types/handlers/asset-historical-price.d.cts +46 -0
- package/dist/types/handlers/asset-historical-price.d.cts.map +1 -0
- package/dist/types/handlers/asset-historical-price.d.mts +46 -0
- package/dist/types/handlers/asset-historical-price.d.mts.map +1 -0
- package/dist/types/handlers/asset-historical-price.mjs +2 -0
- package/dist/types/handlers/asset-historical-price.mjs.map +1 -0
- package/dist/types/handlers/assets-conversion.cjs +0 -11
- package/dist/types/handlers/assets-conversion.cjs.map +1 -1
- package/dist/types/handlers/assets-conversion.d.cts +43 -22
- package/dist/types/handlers/assets-conversion.d.cts.map +1 -1
- package/dist/types/handlers/assets-conversion.d.mts +43 -22
- package/dist/types/handlers/assets-conversion.d.mts.map +1 -1
- package/dist/types/handlers/assets-conversion.mjs +1 -10
- package/dist/types/handlers/assets-conversion.mjs.map +1 -1
- package/dist/types/handlers/assets-lookup.cjs +4 -4
- package/dist/types/handlers/assets-lookup.cjs.map +1 -1
- package/dist/types/handlers/assets-lookup.d.cts +24 -24
- package/dist/types/handlers/assets-lookup.d.cts.map +1 -1
- package/dist/types/handlers/assets-lookup.d.mts +24 -24
- package/dist/types/handlers/assets-lookup.d.mts.map +1 -1
- package/dist/types/handlers/assets-lookup.mjs +5 -5
- package/dist/types/handlers/assets-lookup.mjs.map +1 -1
- package/dist/types/handlers/index.cjs +0 -1
- package/dist/types/handlers/index.cjs.map +1 -1
- package/dist/types/handlers/index.d.cts +2 -1
- package/dist/types/handlers/index.d.cts.map +1 -1
- package/dist/types/handlers/index.d.mts +2 -1
- package/dist/types/handlers/index.d.mts.map +1 -1
- package/dist/types/handlers/index.mjs +0 -1
- package/dist/types/handlers/index.mjs.map +1 -1
- package/dist/types/handlers/user-input.d.cts +10 -10
- package/dist/types/handlers/user-input.d.mts +10 -10
- package/dist/types/interface.d.cts +21 -21
- package/dist/types/interface.d.mts +21 -21
- package/dist/ui/components/address.cjs +2 -1
- package/dist/ui/components/address.cjs.map +1 -1
- package/dist/ui/components/address.d.cts +4 -4
- package/dist/ui/components/address.d.cts.map +1 -1
- package/dist/ui/components/address.d.mts +4 -4
- package/dist/ui/components/address.d.mts.map +1 -1
- package/dist/ui/components/address.mjs +2 -1
- package/dist/ui/components/address.mjs.map +1 -1
- package/dist/ui/components/button.cjs +1 -1
- package/dist/ui/components/button.cjs.map +1 -1
- package/dist/ui/components/button.d.cts +7 -7
- package/dist/ui/components/button.d.cts.map +1 -1
- package/dist/ui/components/button.d.mts +7 -7
- package/dist/ui/components/button.d.mts.map +1 -1
- package/dist/ui/components/button.mjs +2 -2
- package/dist/ui/components/button.mjs.map +1 -1
- package/dist/ui/components/copyable.cjs +2 -1
- package/dist/ui/components/copyable.cjs.map +1 -1
- package/dist/ui/components/copyable.d.cts +4 -4
- package/dist/ui/components/copyable.d.mts +4 -4
- package/dist/ui/components/copyable.mjs +2 -1
- package/dist/ui/components/copyable.mjs.map +1 -1
- package/dist/ui/components/divider.cjs +2 -1
- package/dist/ui/components/divider.cjs.map +1 -1
- package/dist/ui/components/divider.d.cts +1 -1
- package/dist/ui/components/divider.d.cts.map +1 -1
- package/dist/ui/components/divider.d.mts +1 -1
- package/dist/ui/components/divider.d.mts.map +1 -1
- package/dist/ui/components/divider.mjs +2 -1
- package/dist/ui/components/divider.mjs.map +1 -1
- package/dist/ui/components/form.cjs +2 -1
- package/dist/ui/components/form.cjs.map +1 -1
- package/dist/ui/components/form.d.cts +39 -39
- package/dist/ui/components/form.d.cts.map +1 -1
- package/dist/ui/components/form.d.mts +39 -39
- package/dist/ui/components/form.d.mts.map +1 -1
- package/dist/ui/components/form.mjs +2 -1
- package/dist/ui/components/form.mjs.map +1 -1
- package/dist/ui/components/heading.cjs +2 -1
- package/dist/ui/components/heading.cjs.map +1 -1
- package/dist/ui/components/heading.d.cts +4 -4
- package/dist/ui/components/heading.d.cts.map +1 -1
- package/dist/ui/components/heading.d.mts +4 -4
- package/dist/ui/components/heading.d.mts.map +1 -1
- package/dist/ui/components/heading.mjs +2 -1
- package/dist/ui/components/heading.mjs.map +1 -1
- package/dist/ui/components/image.cjs +1 -1
- package/dist/ui/components/image.cjs.map +1 -1
- package/dist/ui/components/image.d.cts +4 -4
- package/dist/ui/components/image.d.mts +4 -4
- package/dist/ui/components/image.mjs +2 -2
- package/dist/ui/components/image.mjs.map +1 -1
- package/dist/ui/components/input.cjs +1 -1
- package/dist/ui/components/input.cjs.map +1 -1
- package/dist/ui/components/input.d.cts +10 -10
- package/dist/ui/components/input.d.cts.map +1 -1
- package/dist/ui/components/input.d.mts +10 -10
- package/dist/ui/components/input.d.mts.map +1 -1
- package/dist/ui/components/input.mjs +2 -2
- package/dist/ui/components/input.mjs.map +1 -1
- package/dist/ui/components/panel.cjs +1 -1
- package/dist/ui/components/panel.cjs.map +1 -1
- package/dist/ui/components/panel.d.cts +105 -105
- package/dist/ui/components/panel.d.mts +105 -105
- package/dist/ui/components/panel.mjs +2 -2
- package/dist/ui/components/panel.mjs.map +1 -1
- package/dist/ui/components/row.cjs +1 -1
- package/dist/ui/components/row.cjs.map +1 -1
- package/dist/ui/components/row.d.cts +23 -23
- package/dist/ui/components/row.d.cts.map +1 -1
- package/dist/ui/components/row.d.mts +23 -23
- package/dist/ui/components/row.d.mts.map +1 -1
- package/dist/ui/components/row.mjs +2 -2
- package/dist/ui/components/row.mjs.map +1 -1
- package/dist/ui/components/spinner.cjs +2 -1
- package/dist/ui/components/spinner.cjs.map +1 -1
- package/dist/ui/components/spinner.d.cts +1 -1
- package/dist/ui/components/spinner.d.cts.map +1 -1
- package/dist/ui/components/spinner.d.mts +1 -1
- package/dist/ui/components/spinner.d.mts.map +1 -1
- package/dist/ui/components/spinner.mjs +2 -1
- package/dist/ui/components/spinner.mjs.map +1 -1
- package/dist/ui/components/text.cjs +2 -1
- package/dist/ui/components/text.cjs.map +1 -1
- package/dist/ui/components/text.d.cts +4 -4
- package/dist/ui/components/text.d.mts +4 -4
- package/dist/ui/components/text.mjs +2 -1
- package/dist/ui/components/text.mjs.map +1 -1
- package/dist/ui/nodes.d.cts +1 -1
- package/dist/ui/nodes.d.mts +1 -1
- package/package.json +3 -3
|
@@ -6,34 +6,34 @@ export declare enum RowVariant {
|
|
|
6
6
|
Warning = "warning"
|
|
7
7
|
}
|
|
8
8
|
export declare const RowStruct: import("@metamask/superstruct").Struct<{
|
|
9
|
-
type: NodeType.Row;
|
|
10
9
|
value: {
|
|
11
|
-
type: NodeType.Image;
|
|
12
10
|
value: string;
|
|
11
|
+
type: NodeType.Image;
|
|
13
12
|
} | {
|
|
14
|
-
type: NodeType.Text;
|
|
15
13
|
value: string;
|
|
14
|
+
type: NodeType.Text;
|
|
16
15
|
markdown?: boolean | undefined;
|
|
17
16
|
} | {
|
|
18
|
-
type: NodeType.Address;
|
|
19
17
|
value: `0x${string}`;
|
|
18
|
+
type: NodeType.Address;
|
|
20
19
|
};
|
|
20
|
+
type: NodeType.Row;
|
|
21
21
|
label: string;
|
|
22
|
-
variant?: "default" | "
|
|
22
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
23
23
|
}, {
|
|
24
|
-
type: import("@metamask/superstruct").Struct<NodeType.Row,
|
|
25
|
-
variant: import("@metamask/superstruct").Struct<"default" | "
|
|
24
|
+
type: import("@metamask/superstruct").Struct<NodeType.Row, null>;
|
|
25
|
+
variant: import("@metamask/superstruct").Struct<"default" | "critical" | "warning" | undefined, null>;
|
|
26
26
|
label: import("@metamask/superstruct").Struct<string, null>;
|
|
27
27
|
value: import("@metamask/superstruct").Struct<{
|
|
28
|
-
type: NodeType.Image;
|
|
29
28
|
value: string;
|
|
29
|
+
type: NodeType.Image;
|
|
30
30
|
} | {
|
|
31
|
-
type: NodeType.Text;
|
|
32
31
|
value: string;
|
|
32
|
+
type: NodeType.Text;
|
|
33
33
|
markdown?: boolean | undefined;
|
|
34
34
|
} | {
|
|
35
|
-
type: NodeType.Address;
|
|
36
35
|
value: `0x${string}`;
|
|
36
|
+
type: NodeType.Address;
|
|
37
37
|
}, null>;
|
|
38
38
|
}>;
|
|
39
39
|
/**
|
|
@@ -64,44 +64,44 @@ export type Row = Infer<typeof RowStruct>;
|
|
|
64
64
|
* const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);
|
|
65
65
|
*/
|
|
66
66
|
export declare const row: (...args: [Omit<{
|
|
67
|
-
type: NodeType.Row;
|
|
68
67
|
value: {
|
|
69
|
-
type: NodeType.Image;
|
|
70
68
|
value: string;
|
|
69
|
+
type: NodeType.Image;
|
|
71
70
|
} | {
|
|
72
|
-
type: NodeType.Text;
|
|
73
71
|
value: string;
|
|
72
|
+
type: NodeType.Text;
|
|
74
73
|
markdown?: boolean | undefined;
|
|
75
74
|
} | {
|
|
76
|
-
type: NodeType.Address;
|
|
77
75
|
value: `0x${string}`;
|
|
76
|
+
type: NodeType.Address;
|
|
78
77
|
};
|
|
78
|
+
type: NodeType.Row;
|
|
79
79
|
label: string;
|
|
80
|
-
variant?: "default" | "
|
|
80
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
81
81
|
}, "type">] | (string | {
|
|
82
|
-
type: NodeType.Image;
|
|
83
82
|
value: string;
|
|
83
|
+
type: NodeType.Image;
|
|
84
84
|
} | {
|
|
85
|
-
type: NodeType.Text;
|
|
86
85
|
value: string;
|
|
86
|
+
type: NodeType.Text;
|
|
87
87
|
markdown?: boolean | undefined;
|
|
88
88
|
} | {
|
|
89
|
-
type: NodeType.Address;
|
|
90
89
|
value: `0x${string}`;
|
|
90
|
+
type: NodeType.Address;
|
|
91
91
|
} | undefined)[]) => {
|
|
92
|
-
type: NodeType.Row;
|
|
93
92
|
value: {
|
|
94
|
-
type: NodeType.Image;
|
|
95
93
|
value: string;
|
|
94
|
+
type: NodeType.Image;
|
|
96
95
|
} | {
|
|
97
|
-
type: NodeType.Text;
|
|
98
96
|
value: string;
|
|
97
|
+
type: NodeType.Text;
|
|
99
98
|
markdown?: boolean | undefined;
|
|
100
99
|
} | {
|
|
101
|
-
type: NodeType.Address;
|
|
102
100
|
value: `0x${string}`;
|
|
101
|
+
type: NodeType.Address;
|
|
103
102
|
};
|
|
103
|
+
type: NodeType.Row;
|
|
104
104
|
label: string;
|
|
105
|
-
variant?: "default" | "
|
|
105
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
106
106
|
};
|
|
107
107
|
//# sourceMappingURL=row.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.d.mts","sourceRoot":"","sources":["../../../src/ui/components/row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"row.d.mts","sourceRoot":"","sources":["../../../src/ui/components/row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAQnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAKD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcrB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { assign,
|
|
1
|
+
import { assign, object, string, optional, union } from "@metamask/superstruct";
|
|
2
2
|
import { AddressStruct } from "./address.mjs";
|
|
3
3
|
import { ImageStruct } from "./image.mjs";
|
|
4
4
|
import { TextStruct } from "./text.mjs";
|
|
5
|
-
import { enumValue } from "../../internals/index.mjs";
|
|
5
|
+
import { enumValue, literal } from "../../internals/index.mjs";
|
|
6
6
|
import { createBuilder } from "../builder.mjs";
|
|
7
7
|
import { LiteralStruct, NodeType } from "../nodes.mjs";
|
|
8
8
|
export var RowVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.mjs","sourceRoot":"","sources":["../../../src/ui/components/row.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"row.mjs","sourceRoot":"","sources":["../../../src/ui/components/row.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,8BAA8B;AAEhF,OAAO,EAAE,aAAa,EAAE,sBAAkB;AAC1C,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,UAAU,EAAE,mBAAe;AACpC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,kCAAwB;AACrD,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAiB;AAEnD,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED,mDAAmD;AACnD,MAAM,kBAAkB,GAAG,KAAK,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAC7B,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IAC3B,OAAO,EAAE,QAAQ,CACf,KAAK,CAAC;QACJ,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;QAC7B,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC9B,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;KAC9B,CAAC,CACH;IACD,KAAK,EAAE,MAAM,EAAE;IACf,KAAK,EAAE,kBAAkB;CAC1B,CAAC,CACH,CAAC;AAaF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE;IACxD,OAAO;IACP,OAAO;IACP,SAAS;CACV,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string, optional, union } from '@metamask/superstruct';\n\nimport { AddressStruct } from './address';\nimport { ImageStruct } from './image';\nimport { TextStruct } from './text';\nimport { enumValue, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum RowVariant {\n Default = 'default',\n Critical = 'critical',\n Warning = 'warning',\n}\n\n// A subset of components made available to the row\nconst RowComponentStruct = union([ImageStruct, TextStruct, AddressStruct]);\n\nexport const RowStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Row),\n variant: optional(\n union([\n enumValue(RowVariant.Default),\n enumValue(RowVariant.Critical),\n enumValue(RowVariant.Warning),\n ]),\n ),\n label: string(),\n value: RowComponentStruct,\n }),\n);\n\n/**\n * A row node, that renders a row with a label and a value.\n *\n * @property type - The type of the node. Must be the string `row`.\n * @property label - The label for the row.\n * @property value - A sub component to be rendered\n * on one side of the row.\n * @property variant - Optional variant for styling.\n */\nexport type Row = Infer<typeof RowStruct>;\n\n/**\n * Create a {@link Row} node.\n *\n * @param args - The node arguments. This can either be a string, a component and an optional variant or an object\n * with the properties: `label`, `value` and `variant`.\n * @param args.label - The label for the row.\n * @param args.value - Another component, is currently limited to `image`, `text` and `address`.\n * @param args.variant - An optional variant, either `default`, `warning` or `critical`.\n * @returns The row node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520') });\n * const node = row({ label: 'Address', value: address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), variant: RowVariant.Warning });\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'));\n * const node = row('Address', address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520'), RowVariant.Warning);\n */\nexport const row = createBuilder(NodeType.Row, RowStruct, [\n 'label',\n 'value',\n 'variant',\n]);\n"]}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.spinner = exports.SpinnerStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const internals_1 = require("../../internals/index.cjs");
|
|
5
6
|
const builder_1 = require("../builder.cjs");
|
|
6
7
|
const nodes_1 = require("../nodes.cjs");
|
|
7
8
|
exports.SpinnerStruct = (0, superstruct_1.assign)(nodes_1.NodeStruct, (0, superstruct_1.object)({
|
|
8
|
-
type: (0,
|
|
9
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Spinner),
|
|
9
10
|
}));
|
|
10
11
|
/**
|
|
11
12
|
* Create a {@link Spinner} node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.cjs","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"spinner.cjs","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AAEvD,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAgD;AAEnC,QAAA,aAAa,GAAG,IAAA,oBAAM,EACjC,kBAAU,EACV,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,OAAO,CAAC;CAChC,CAAC,CACH,CAAC;AAQF;;;;;;;;GAQG;AACU,QAAA,OAAO,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,OAAO,EAAE,qBAAa,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer<typeof SpinnerStruct>;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n"]}
|
|
@@ -3,7 +3,7 @@ import { NodeType } from "../nodes.cjs";
|
|
|
3
3
|
export declare const SpinnerStruct: import("@metamask/superstruct").Struct<{
|
|
4
4
|
type: NodeType.Spinner;
|
|
5
5
|
}, {
|
|
6
|
-
type: import("@metamask/superstruct").Struct<NodeType.Spinner,
|
|
6
|
+
type: import("@metamask/superstruct").Struct<NodeType.Spinner, null>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* A spinner node, that renders a spinner, either as a full-screen overlay, or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.cts","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"spinner.d.cts","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,aAAa;;;;EAKzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO;;CAAiD,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { NodeType } from "../nodes.mjs";
|
|
|
3
3
|
export declare const SpinnerStruct: import("@metamask/superstruct").Struct<{
|
|
4
4
|
type: NodeType.Spinner;
|
|
5
5
|
}, {
|
|
6
|
-
type: import("@metamask/superstruct").Struct<NodeType.Spinner,
|
|
6
|
+
type: import("@metamask/superstruct").Struct<NodeType.Spinner, null>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* A spinner node, that renders a spinner, either as a full-screen overlay, or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.mts","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"spinner.d.mts","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,aAAa;;;;EAKzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO;;CAAiD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { assign,
|
|
1
|
+
import { assign, object } from "@metamask/superstruct";
|
|
2
|
+
import { literal } from "../../internals/index.mjs";
|
|
2
3
|
import { createBuilder } from "../builder.mjs";
|
|
3
4
|
import { NodeStruct, NodeType } from "../nodes.mjs";
|
|
4
5
|
export const SpinnerStruct = assign(NodeStruct, object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.mjs","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"spinner.mjs","sourceRoot":"","sources":["../../../src/ui/components/spinner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAEvD,OAAO,EAAE,OAAO,EAAE,kCAAwB;AAC1C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAiB;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CACjC,UAAU,EACV,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;CAChC,CAAC,CACH,CAAC;AAQF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const SpinnerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Spinner),\n }),\n);\n\n/**\n * A spinner node, that renders a spinner, either as a full-screen overlay, or\n * inline when nested inside a {@link Panel}.\n */\nexport type Spinner = Infer<typeof SpinnerStruct>;\n\n/**\n * Create a {@link Spinner} node.\n *\n * @returns The spinner node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = spinner();\n */\nexport const spinner = createBuilder(NodeType.Spinner, SpinnerStruct);\n"]}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.text = exports.TextStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const internals_1 = require("../../internals/index.cjs");
|
|
5
6
|
const builder_1 = require("../builder.cjs");
|
|
6
7
|
const nodes_1 = require("../nodes.cjs");
|
|
7
8
|
exports.TextStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
|
|
8
|
-
type: (0,
|
|
9
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Text),
|
|
9
10
|
value: (0, superstruct_1.string)(),
|
|
10
11
|
markdown: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
|
|
11
12
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.cjs","sourceRoot":"","sources":["../../../src/ui/components/text.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"text.cjs","sourceRoot":"","sources":["../../../src/ui/components/text.ts"],"names":[],"mappings":";;;AACA,uDAM+B;AAE/B,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAmD;AAEtC,QAAA,UAAU,GAAG,IAAA,oBAAM,EAC9B,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,IAAA,oBAAM,GAAE;IACf,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC;CAC9B,CAAC,CACH,CAAC;AAaF;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,IAAI,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,IAAI,EAAE,kBAAU,EAAE;IAC3D,OAAO;IACP,UAAU;CACX,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer<typeof TextStruct>;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
import { NodeType } from "../nodes.cjs";
|
|
3
3
|
export declare const TextStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Text;
|
|
5
4
|
value: string;
|
|
5
|
+
type: NodeType.Text;
|
|
6
6
|
markdown?: boolean | undefined;
|
|
7
7
|
}, {
|
|
8
|
-
type: import("@metamask/superstruct").Struct<NodeType.Text,
|
|
8
|
+
type: import("@metamask/superstruct").Struct<NodeType.Text, null>;
|
|
9
9
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
10
10
|
markdown: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
11
11
|
}>;
|
|
@@ -38,12 +38,12 @@ export type Text = Infer<typeof TextStruct>;
|
|
|
38
38
|
* const node = text('Hello, world!', false);
|
|
39
39
|
*/
|
|
40
40
|
export declare const text: (...args: (string | boolean | undefined)[] | [Omit<{
|
|
41
|
-
type: NodeType.Text;
|
|
42
41
|
value: string;
|
|
42
|
+
type: NodeType.Text;
|
|
43
43
|
markdown?: boolean | undefined;
|
|
44
44
|
}, "type">]) => {
|
|
45
|
-
type: NodeType.Text;
|
|
46
45
|
value: string;
|
|
46
|
+
type: NodeType.Text;
|
|
47
47
|
markdown?: boolean | undefined;
|
|
48
48
|
};
|
|
49
49
|
//# sourceMappingURL=text.d.cts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
import { NodeType } from "../nodes.mjs";
|
|
3
3
|
export declare const TextStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Text;
|
|
5
4
|
value: string;
|
|
5
|
+
type: NodeType.Text;
|
|
6
6
|
markdown?: boolean | undefined;
|
|
7
7
|
}, {
|
|
8
|
-
type: import("@metamask/superstruct").Struct<NodeType.Text,
|
|
8
|
+
type: import("@metamask/superstruct").Struct<NodeType.Text, null>;
|
|
9
9
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
10
10
|
markdown: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
11
11
|
}>;
|
|
@@ -38,12 +38,12 @@ export type Text = Infer<typeof TextStruct>;
|
|
|
38
38
|
* const node = text('Hello, world!', false);
|
|
39
39
|
*/
|
|
40
40
|
export declare const text: (...args: (string | boolean | undefined)[] | [Omit<{
|
|
41
|
-
type: NodeType.Text;
|
|
42
41
|
value: string;
|
|
42
|
+
type: NodeType.Text;
|
|
43
43
|
markdown?: boolean | undefined;
|
|
44
44
|
}, "type">]) => {
|
|
45
|
-
type: NodeType.Text;
|
|
46
45
|
value: string;
|
|
46
|
+
type: NodeType.Text;
|
|
47
47
|
markdown?: boolean | undefined;
|
|
48
48
|
};
|
|
49
49
|
//# sourceMappingURL=text.d.mts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { assign, boolean,
|
|
1
|
+
import { assign, boolean, object, optional, string } from "@metamask/superstruct";
|
|
2
|
+
import { literal } from "../../internals/index.mjs";
|
|
2
3
|
import { createBuilder } from "../builder.mjs";
|
|
3
4
|
import { LiteralStruct, NodeType } from "../nodes.mjs";
|
|
4
5
|
export const TextStruct = assign(LiteralStruct, object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.mjs","sourceRoot":"","sources":["../../../src/ui/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"text.mjs","sourceRoot":"","sources":["../../../src/ui/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACP,8BAA8B;AAE/B,OAAO,EAAE,OAAO,EAAE,kCAAwB;AAC1C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAiB;AAEnD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAC9B,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,EAAE;IACf,QAAQ,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CAC9B,CAAC,CACH,CAAC;AAaF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE;IAC3D,OAAO;IACP,UAAU;CACX,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n boolean,\n object,\n optional,\n string,\n} from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const TextStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Text),\n value: string(),\n markdown: optional(boolean()),\n }),\n);\n\n/**\n * A text node, that renders the text as one or more paragraphs.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n * @property markdown - A flag to enable/disable markdown, if nothing is specified\n * markdown will be enabled.\n */\nexport type Text = Infer<typeof TextStruct>;\n\n/**\n * Create a {@link Text} node.\n *\n * @param args - The node arguments. This can be either a string\n * and a boolean, or an object with a `value` property\n * and an optional `markdown` property.\n * @param args.value - The text content of the node.\n * @param args.markdown - An optional flag to enable or disable markdown. This\n * is enabled by default.\n * @returns The text node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = text({ value: 'Hello, world!' });\n * const node = text('Hello, world!');\n * const node = text({ value: 'Hello, world!', markdown: false });\n * const node = text('Hello, world!', false);\n */\nexport const text = createBuilder(NodeType.Text, TextStruct, [\n 'value',\n 'markdown',\n]);\n"]}
|
package/dist/ui/nodes.d.cts
CHANGED
|
@@ -38,8 +38,8 @@ export type Node = Infer<typeof NodeStruct>;
|
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
40
40
|
export declare const LiteralStruct: import("@metamask/superstruct").Struct<{
|
|
41
|
-
type: string;
|
|
42
41
|
value: unknown;
|
|
42
|
+
type: string;
|
|
43
43
|
}, {
|
|
44
44
|
value: import("@metamask/superstruct").Struct<unknown, null>;
|
|
45
45
|
type: import("@metamask/superstruct").Struct<string, null>;
|
package/dist/ui/nodes.d.mts
CHANGED
|
@@ -38,8 +38,8 @@ export type Node = Infer<typeof NodeStruct>;
|
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
40
40
|
export declare const LiteralStruct: import("@metamask/superstruct").Struct<{
|
|
41
|
-
type: string;
|
|
42
41
|
value: unknown;
|
|
42
|
+
type: string;
|
|
43
43
|
}, {
|
|
44
44
|
value: import("@metamask/superstruct").Struct<unknown, null>;
|
|
45
45
|
type: import("@metamask/superstruct").Struct<string, null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-sdk",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.22.0",
|
|
4
4
|
"description": "A library containing the core functionality for building MetaMask Snaps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
"@metamask/key-tree": "^10.1.1",
|
|
95
95
|
"@metamask/providers": "^21.0.0",
|
|
96
96
|
"@metamask/rpc-errors": "^7.0.2",
|
|
97
|
-
"@metamask/superstruct": "^3.1
|
|
97
|
+
"@metamask/superstruct": "^3.2.1",
|
|
98
98
|
"@metamask/utils": "^11.2.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@lavamoat/allow-scripts": "^3.0.4",
|
|
102
|
-
"@metamask/auto-changelog": "^
|
|
102
|
+
"@metamask/auto-changelog": "^5.0.1",
|
|
103
103
|
"@ts-bridge/cli": "^0.6.1",
|
|
104
104
|
"@types/jest": "^27.5.1",
|
|
105
105
|
"deepmerge": "^4.2.2",
|