@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
|
@@ -51,71 +51,71 @@ export type FormState = Infer<typeof FormStateStruct>;
|
|
|
51
51
|
export type InterfaceState = Infer<typeof InterfaceStateStruct>;
|
|
52
52
|
export type ComponentOrElement = Component | JSXElement;
|
|
53
53
|
export declare const ComponentOrElementStruct: import("@metamask/superstruct").Struct<{
|
|
54
|
-
type: import("../ui/index.mjs").NodeType.Copyable;
|
|
55
54
|
value: string;
|
|
55
|
+
type: import("../ui/index.mjs").NodeType.Copyable;
|
|
56
56
|
sensitive?: boolean | undefined;
|
|
57
57
|
} | {
|
|
58
58
|
type: import("../ui/index.mjs").NodeType.Divider;
|
|
59
59
|
} | {
|
|
60
|
-
type: import("../ui/index.mjs").NodeType.Heading;
|
|
61
60
|
value: string;
|
|
61
|
+
type: import("../ui/index.mjs").NodeType.Heading;
|
|
62
62
|
} | {
|
|
63
|
-
type: import("../ui/index.mjs").NodeType.Image;
|
|
64
63
|
value: string;
|
|
64
|
+
type: import("../ui/index.mjs").NodeType.Image;
|
|
65
65
|
} | import("../ui/index.mjs").Panel | {
|
|
66
66
|
type: import("../ui/index.mjs").NodeType.Spinner;
|
|
67
67
|
} | {
|
|
68
|
-
type: import("../ui/index.mjs").NodeType.Text;
|
|
69
68
|
value: string;
|
|
69
|
+
type: import("../ui/index.mjs").NodeType.Text;
|
|
70
70
|
markdown?: boolean | undefined;
|
|
71
71
|
} | {
|
|
72
|
-
type: import("../ui/index.mjs").NodeType.Address;
|
|
73
72
|
value: `0x${string}`;
|
|
73
|
+
type: import("../ui/index.mjs").NodeType.Address;
|
|
74
74
|
} | {
|
|
75
|
-
type: import("../ui/index.mjs").NodeType.Row;
|
|
76
75
|
value: {
|
|
77
|
-
type: import("../ui/index.mjs").NodeType.Image;
|
|
78
76
|
value: string;
|
|
77
|
+
type: import("../ui/index.mjs").NodeType.Image;
|
|
79
78
|
} | {
|
|
80
|
-
type: import("../ui/index.mjs").NodeType.Text;
|
|
81
79
|
value: string;
|
|
80
|
+
type: import("../ui/index.mjs").NodeType.Text;
|
|
82
81
|
markdown?: boolean | undefined;
|
|
83
82
|
} | {
|
|
84
|
-
type: import("../ui/index.mjs").NodeType.Address;
|
|
85
83
|
value: `0x${string}`;
|
|
84
|
+
type: import("../ui/index.mjs").NodeType.Address;
|
|
86
85
|
};
|
|
86
|
+
type: import("../ui/index.mjs").NodeType.Row;
|
|
87
87
|
label: string;
|
|
88
|
-
variant?: "default" | "
|
|
88
|
+
variant?: "default" | "critical" | "warning" | undefined;
|
|
89
89
|
} | {
|
|
90
|
-
type: import("../ui/index.mjs").NodeType.Input;
|
|
91
90
|
name: string;
|
|
92
|
-
|
|
93
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
91
|
+
type: import("../ui/index.mjs").NodeType.Input;
|
|
94
92
|
value?: string | undefined;
|
|
95
93
|
label?: string | undefined;
|
|
94
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
96
95
|
placeholder?: string | undefined;
|
|
96
|
+
error?: string | undefined;
|
|
97
97
|
} | {
|
|
98
|
-
type: import("../ui/index.mjs").NodeType.Button;
|
|
99
98
|
value: string;
|
|
100
|
-
|
|
99
|
+
type: import("../ui/index.mjs").NodeType.Button;
|
|
101
100
|
name?: string | undefined;
|
|
101
|
+
variant?: "primary" | "secondary" | undefined;
|
|
102
102
|
buttonType?: "button" | "submit" | undefined;
|
|
103
103
|
} | {
|
|
104
|
-
type: import("../ui/index.mjs").NodeType.Form;
|
|
105
104
|
name: string;
|
|
105
|
+
type: import("../ui/index.mjs").NodeType.Form;
|
|
106
106
|
children: ({
|
|
107
|
-
type: import("../ui/index.mjs").NodeType.Input;
|
|
108
107
|
name: string;
|
|
109
|
-
|
|
110
|
-
inputType?: "number" | "text" | "password" | undefined;
|
|
108
|
+
type: import("../ui/index.mjs").NodeType.Input;
|
|
111
109
|
value?: string | undefined;
|
|
112
110
|
label?: string | undefined;
|
|
111
|
+
inputType?: "number" | "text" | "password" | undefined;
|
|
113
112
|
placeholder?: string | undefined;
|
|
113
|
+
error?: string | undefined;
|
|
114
114
|
} | {
|
|
115
|
-
type: import("../ui/index.mjs").NodeType.Button;
|
|
116
115
|
value: string;
|
|
117
|
-
|
|
116
|
+
type: import("../ui/index.mjs").NodeType.Button;
|
|
118
117
|
name?: string | undefined;
|
|
118
|
+
variant?: "primary" | "secondary" | undefined;
|
|
119
119
|
buttonType?: "button" | "submit" | undefined;
|
|
120
120
|
})[];
|
|
121
121
|
} | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AssetSelectorProps, "AssetSelector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressInputProps, "AddressInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").IconProps, "Icon"> | import("../jsx/index.mjs").SnapElement<{
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.address = exports.AddressStruct = void 0;
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const utils_1 = require("@metamask/utils");
|
|
6
|
+
const internals_1 = require("../../internals/index.cjs");
|
|
6
7
|
const builder_1 = require("../builder.cjs");
|
|
7
8
|
const nodes_1 = require("../nodes.cjs");
|
|
8
9
|
exports.AddressStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
|
|
9
|
-
type: (0,
|
|
10
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Address),
|
|
10
11
|
value: utils_1.HexChecksumAddressStruct,
|
|
11
12
|
}));
|
|
12
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.cjs","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"address.cjs","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AACvD,2CAA2D;AAE3D,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAmD;AAEtC,QAAA,aAAa,GAAG,IAAA,oBAAM,EACjC,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,gCAAwB;CAChC,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;GAYG;AACU,QAAA,OAAO,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,OAAO,EAAE,qBAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\nimport { HexChecksumAddressStruct } from '@metamask/utils';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer<typeof AddressStruct>;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address 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 = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
import { NodeType } from "../nodes.cjs";
|
|
3
3
|
export declare const AddressStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Address;
|
|
5
4
|
value: `0x${string}`;
|
|
5
|
+
type: NodeType.Address;
|
|
6
6
|
}, {
|
|
7
|
-
type: import("@metamask/superstruct").Struct<NodeType.Address,
|
|
7
|
+
type: import("@metamask/superstruct").Struct<NodeType.Address, null>;
|
|
8
8
|
value: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
@@ -28,10 +28,10 @@ export type Address = Infer<typeof AddressStruct>;
|
|
|
28
28
|
* const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');
|
|
29
29
|
*/
|
|
30
30
|
export declare const address: (...args: `0x${string}`[] | [Omit<{
|
|
31
|
-
type: NodeType.Address;
|
|
32
31
|
value: `0x${string}`;
|
|
33
|
-
}, "type">]) => {
|
|
34
32
|
type: NodeType.Address;
|
|
33
|
+
}, "type">]) => {
|
|
35
34
|
value: `0x${string}`;
|
|
35
|
+
type: NodeType.Address;
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=address.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.cts","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"address.d.cts","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Infer } from "@metamask/superstruct";
|
|
2
2
|
import { NodeType } from "../nodes.mjs";
|
|
3
3
|
export declare const AddressStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Address;
|
|
5
4
|
value: `0x${string}`;
|
|
5
|
+
type: NodeType.Address;
|
|
6
6
|
}, {
|
|
7
|
-
type: import("@metamask/superstruct").Struct<NodeType.Address,
|
|
7
|
+
type: import("@metamask/superstruct").Struct<NodeType.Address, null>;
|
|
8
8
|
value: import("@metamask/superstruct").Struct<`0x${string}`, null>;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
@@ -28,10 +28,10 @@ export type Address = Infer<typeof AddressStruct>;
|
|
|
28
28
|
* const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');
|
|
29
29
|
*/
|
|
30
30
|
export declare const address: (...args: `0x${string}`[] | [Omit<{
|
|
31
|
-
type: NodeType.Address;
|
|
32
31
|
value: `0x${string}`;
|
|
33
|
-
}, "type">]) => {
|
|
34
32
|
type: NodeType.Address;
|
|
33
|
+
}, "type">]) => {
|
|
35
34
|
value: `0x${string}`;
|
|
35
|
+
type: NodeType.Address;
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=address.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.d.mts","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"address.d.mts","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAMnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { assign,
|
|
1
|
+
import { assign, object } from "@metamask/superstruct";
|
|
2
2
|
import { HexChecksumAddressStruct } from "@metamask/utils";
|
|
3
|
+
import { literal } from "../../internals/index.mjs";
|
|
3
4
|
import { createBuilder } from "../builder.mjs";
|
|
4
5
|
import { LiteralStruct, NodeType } from "../nodes.mjs";
|
|
5
6
|
export const AddressStruct = assign(LiteralStruct, object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.mjs","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"address.mjs","sourceRoot":"","sources":["../../../src/ui/components/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AACvD,OAAO,EAAE,wBAAwB,EAAE,wBAAwB;AAE3D,OAAO,EAAE,OAAO,EAAE,kCAAwB;AAC1C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAiB;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CACjC,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,wBAAwB;CAChC,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\nimport { HexChecksumAddressStruct } from '@metamask/utils';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: HexChecksumAddressStruct,\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer<typeof AddressStruct>;\n\n/**\n * Create an {@link Address} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The address to be rendered.\n * @returns The address 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 = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n"]}
|
|
@@ -16,7 +16,7 @@ var ButtonType;
|
|
|
16
16
|
ButtonType["Submit"] = "submit";
|
|
17
17
|
})(ButtonType || (exports.ButtonType = ButtonType = {}));
|
|
18
18
|
exports.ButtonStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
|
|
19
|
-
type: (0,
|
|
19
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Button),
|
|
20
20
|
value: (0, superstruct_1.string)(),
|
|
21
21
|
variant: (0, superstruct_1.optional)((0, superstruct_1.union)([
|
|
22
22
|
(0, internals_1.enumValue)(ButtonVariant.Primary),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.cjs","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"button.cjs","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":";;;AACA,uDAAgF;AAEhF,yDAAqD;AACrD,4CAA2C;AAC3C,wCAAmD;AAEnD,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;AACzB,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAEY,QAAA,YAAY,GAAG,IAAA,oBAAM,EAChC,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,IAAA,oBAAM,GAAE;IACf,OAAO,EAAE,IAAA,sBAAQ,EACf,IAAA,mBAAK,EAAC;QACJ,IAAA,qBAAS,EAAC,aAAa,CAAC,OAAO,CAAC;QAChC,IAAA,qBAAS,EAAC,aAAa,CAAC,SAAS,CAAC;KACnC,CAAC,CACH;IACD,UAAU,EAAE,IAAA,sBAAQ,EAClB,IAAA,mBAAK,EAAC,CAAC,IAAA,qBAAS,EAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAA,qBAAS,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CACpE;IACD,IAAI,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CACzB,CAAC,CACH,CAAC;AAaF;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,MAAM,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,MAAM,EAAE,oBAAY,EAAE;IACjE,OAAO;IACP,YAAY;IACZ,MAAM;IACN,SAAS;CACV,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer<typeof ButtonStruct>;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\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 * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n"]}
|
|
@@ -9,13 +9,13 @@ export declare enum ButtonType {
|
|
|
9
9
|
Submit = "submit"
|
|
10
10
|
}
|
|
11
11
|
export declare const ButtonStruct: import("@metamask/superstruct").Struct<{
|
|
12
|
-
type: NodeType.Button;
|
|
13
12
|
value: string;
|
|
14
|
-
|
|
13
|
+
type: NodeType.Button;
|
|
15
14
|
name?: string | undefined;
|
|
15
|
+
variant?: "primary" | "secondary" | undefined;
|
|
16
16
|
buttonType?: "button" | "submit" | undefined;
|
|
17
17
|
}, {
|
|
18
|
-
type: import("@metamask/superstruct").Struct<NodeType.Button,
|
|
18
|
+
type: import("@metamask/superstruct").Struct<NodeType.Button, null>;
|
|
19
19
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
20
20
|
variant: import("@metamask/superstruct").Struct<"primary" | "secondary" | undefined, null>;
|
|
21
21
|
buttonType: import("@metamask/superstruct").Struct<"button" | "submit" | undefined, null>;
|
|
@@ -50,16 +50,16 @@ export type Button = Infer<typeof ButtonStruct>;
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
export declare const button: (...args: [Omit<{
|
|
53
|
-
type: NodeType.Button;
|
|
54
53
|
value: string;
|
|
55
|
-
|
|
54
|
+
type: NodeType.Button;
|
|
56
55
|
name?: string | undefined;
|
|
56
|
+
variant?: "primary" | "secondary" | undefined;
|
|
57
57
|
buttonType?: "button" | "submit" | undefined;
|
|
58
58
|
}, "type">] | (string | undefined)[]) => {
|
|
59
|
-
type: NodeType.Button;
|
|
60
59
|
value: string;
|
|
61
|
-
|
|
60
|
+
type: NodeType.Button;
|
|
62
61
|
name?: string | undefined;
|
|
62
|
+
variant?: "primary" | "secondary" | undefined;
|
|
63
63
|
buttonType?: "button" | "submit" | undefined;
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=button.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.cts","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"button.d.cts","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;EAgBxB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;CAKjB,CAAC"}
|
|
@@ -9,13 +9,13 @@ export declare enum ButtonType {
|
|
|
9
9
|
Submit = "submit"
|
|
10
10
|
}
|
|
11
11
|
export declare const ButtonStruct: import("@metamask/superstruct").Struct<{
|
|
12
|
-
type: NodeType.Button;
|
|
13
12
|
value: string;
|
|
14
|
-
|
|
13
|
+
type: NodeType.Button;
|
|
15
14
|
name?: string | undefined;
|
|
15
|
+
variant?: "primary" | "secondary" | undefined;
|
|
16
16
|
buttonType?: "button" | "submit" | undefined;
|
|
17
17
|
}, {
|
|
18
|
-
type: import("@metamask/superstruct").Struct<NodeType.Button,
|
|
18
|
+
type: import("@metamask/superstruct").Struct<NodeType.Button, null>;
|
|
19
19
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
20
20
|
variant: import("@metamask/superstruct").Struct<"primary" | "secondary" | undefined, null>;
|
|
21
21
|
buttonType: import("@metamask/superstruct").Struct<"button" | "submit" | undefined, null>;
|
|
@@ -50,16 +50,16 @@ export type Button = Infer<typeof ButtonStruct>;
|
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
52
|
export declare const button: (...args: [Omit<{
|
|
53
|
-
type: NodeType.Button;
|
|
54
53
|
value: string;
|
|
55
|
-
|
|
54
|
+
type: NodeType.Button;
|
|
56
55
|
name?: string | undefined;
|
|
56
|
+
variant?: "primary" | "secondary" | undefined;
|
|
57
57
|
buttonType?: "button" | "submit" | undefined;
|
|
58
58
|
}, "type">] | (string | undefined)[]) => {
|
|
59
|
-
type: NodeType.Button;
|
|
60
59
|
value: string;
|
|
61
|
-
|
|
60
|
+
type: NodeType.Button;
|
|
62
61
|
name?: string | undefined;
|
|
62
|
+
variant?: "primary" | "secondary" | undefined;
|
|
63
63
|
buttonType?: "button" | "submit" | undefined;
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=button.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.mts","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"button.d.mts","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;EAgBxB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;CAKjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assign,
|
|
2
|
-
import { enumValue } from "../../internals/index.mjs";
|
|
1
|
+
import { assign, object, optional, string, union } from "@metamask/superstruct";
|
|
2
|
+
import { enumValue, literal } from "../../internals/index.mjs";
|
|
3
3
|
import { createBuilder } from "../builder.mjs";
|
|
4
4
|
import { LiteralStruct, NodeType } from "../nodes.mjs";
|
|
5
5
|
export var ButtonVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.mjs","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"button.mjs","sourceRoot":"","sources":["../../../src/ui/components/button.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAEhF,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,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;AACzB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;AACnB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAChC,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,MAAM,EAAE;IACf,OAAO,EAAE,QAAQ,CACf,KAAK,CAAC;QACJ,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC;QAChC,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC;KACnC,CAAC,CACH;IACD,UAAU,EAAE,QAAQ,CAClB,KAAK,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CACpE;IACD,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACzB,CAAC,CACH,CAAC;AAaF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE;IACjE,OAAO;IACP,YAAY;IACZ,MAAM;IACN,SAAS;CACV,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer<typeof ButtonStruct>;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\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 * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n"]}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.copyable = exports.CopyableStruct = 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.CopyableStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
|
|
8
|
-
type: (0,
|
|
9
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Copyable),
|
|
9
10
|
value: (0, superstruct_1.string)(),
|
|
10
11
|
sensitive: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
|
|
11
12
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyable.cjs","sourceRoot":"","sources":["../../../src/ui/components/copyable.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"copyable.cjs","sourceRoot":"","sources":["../../../src/ui/components/copyable.ts"],"names":[],"mappings":";;;AACA,uDAM+B;AAE/B,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAmD;AAEtC,QAAA,cAAc,GAAG,IAAA,oBAAM,EAClC,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,QAAQ,CAAC;IAChC,KAAK,EAAE,IAAA,oBAAM,GAAE;IACf,SAAS,EAAE,IAAA,sBAAQ,EAAC,IAAA,qBAAO,GAAE,CAAC;CAC/B,CAAC,CACH,CAAC;AAeF;;;;;;;;;;;;;;;GAeG;AACU,QAAA,QAAQ,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,QAAQ,EAAE,sBAAc,EAAE;IACvE,OAAO;IACP,WAAW;CACZ,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 CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer<typeof CopyableStruct>;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\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 = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\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 CopyableStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Copyable;
|
|
5
4
|
value: string;
|
|
5
|
+
type: NodeType.Copyable;
|
|
6
6
|
sensitive?: boolean | undefined;
|
|
7
7
|
}, {
|
|
8
|
-
type: import("@metamask/superstruct").Struct<NodeType.Copyable,
|
|
8
|
+
type: import("@metamask/superstruct").Struct<NodeType.Copyable, null>;
|
|
9
9
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
10
10
|
sensitive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
11
11
|
}>;
|
|
@@ -38,12 +38,12 @@ export type Copyable = Infer<typeof CopyableStruct>;
|
|
|
38
38
|
* const node = copyable({ value: 'Hello, world!' });
|
|
39
39
|
*/
|
|
40
40
|
export declare const copyable: (...args: [Omit<{
|
|
41
|
-
type: NodeType.Copyable;
|
|
42
41
|
value: string;
|
|
42
|
+
type: NodeType.Copyable;
|
|
43
43
|
sensitive?: boolean | undefined;
|
|
44
44
|
}, "type">] | (string | boolean | undefined)[]) => {
|
|
45
|
-
type: NodeType.Copyable;
|
|
46
45
|
value: string;
|
|
46
|
+
type: NodeType.Copyable;
|
|
47
47
|
sensitive?: boolean | undefined;
|
|
48
48
|
};
|
|
49
49
|
//# sourceMappingURL=copyable.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 CopyableStruct: import("@metamask/superstruct").Struct<{
|
|
4
|
-
type: NodeType.Copyable;
|
|
5
4
|
value: string;
|
|
5
|
+
type: NodeType.Copyable;
|
|
6
6
|
sensitive?: boolean | undefined;
|
|
7
7
|
}, {
|
|
8
|
-
type: import("@metamask/superstruct").Struct<NodeType.Copyable,
|
|
8
|
+
type: import("@metamask/superstruct").Struct<NodeType.Copyable, null>;
|
|
9
9
|
value: import("@metamask/superstruct").Struct<string, null>;
|
|
10
10
|
sensitive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
11
11
|
}>;
|
|
@@ -38,12 +38,12 @@ export type Copyable = Infer<typeof CopyableStruct>;
|
|
|
38
38
|
* const node = copyable({ value: 'Hello, world!' });
|
|
39
39
|
*/
|
|
40
40
|
export declare const copyable: (...args: [Omit<{
|
|
41
|
-
type: NodeType.Copyable;
|
|
42
41
|
value: string;
|
|
42
|
+
type: NodeType.Copyable;
|
|
43
43
|
sensitive?: boolean | undefined;
|
|
44
44
|
}, "type">] | (string | boolean | undefined)[]) => {
|
|
45
|
-
type: NodeType.Copyable;
|
|
46
45
|
value: string;
|
|
46
|
+
type: NodeType.Copyable;
|
|
47
47
|
sensitive?: boolean | undefined;
|
|
48
48
|
};
|
|
49
49
|
//# sourceMappingURL=copyable.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 CopyableStruct = assign(LiteralStruct, object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyable.mjs","sourceRoot":"","sources":["../../../src/ui/components/copyable.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"copyable.mjs","sourceRoot":"","sources":["../../../src/ui/components/copyable.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,cAAc,GAAG,MAAM,CAClC,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAChC,KAAK,EAAE,MAAM,EAAE;IACf,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CAC/B,CAAC,CACH,CAAC;AAeF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE;IACvE,OAAO;IACP,WAAW;CACZ,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 CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer<typeof CopyableStruct>;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\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 = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n"]}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.divider = exports.DividerStruct = 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.DividerStruct = (0, superstruct_1.assign)(nodes_1.NodeStruct, (0, superstruct_1.object)({
|
|
8
|
-
type: (0,
|
|
9
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Divider),
|
|
9
10
|
}));
|
|
10
11
|
/**
|
|
11
12
|
* Create a {@link Divider} node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.cjs","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"divider.cjs","sourceRoot":"","sources":["../../../src/ui/components/divider.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;AAOF;;;;;;;;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 DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer<typeof DividerStruct>;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider 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 = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n"]}
|
|
@@ -3,7 +3,7 @@ import { NodeType } from "../nodes.cjs";
|
|
|
3
3
|
export declare const DividerStruct: import("@metamask/superstruct").Struct<{
|
|
4
4
|
type: NodeType.Divider;
|
|
5
5
|
}, {
|
|
6
|
-
type: import("@metamask/superstruct").Struct<NodeType.Divider,
|
|
6
|
+
type: import("@metamask/superstruct").Struct<NodeType.Divider, null>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* A divider node, that renders a line between other nodes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.d.cts","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"divider.d.cts","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,aAAa;;;;EAKzB,CAAC;AAEF;;GAEG;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 DividerStruct: import("@metamask/superstruct").Struct<{
|
|
4
4
|
type: NodeType.Divider;
|
|
5
5
|
}, {
|
|
6
|
-
type: import("@metamask/superstruct").Struct<NodeType.Divider,
|
|
6
|
+
type: import("@metamask/superstruct").Struct<NodeType.Divider, null>;
|
|
7
7
|
}>;
|
|
8
8
|
/**
|
|
9
9
|
* A divider node, that renders a line between other nodes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.d.mts","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;
|
|
1
|
+
{"version":3,"file":"divider.d.mts","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,aAAa;;;;EAKzB,CAAC;AAEF;;GAEG;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 DividerStruct = assign(NodeStruct, object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.mjs","sourceRoot":"","sources":["../../../src/ui/components/divider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"divider.mjs","sourceRoot":"","sources":["../../../src/ui/components/divider.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;AAOF;;;;;;;;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 DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer<typeof DividerStruct>;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider 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 = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n"]}
|
|
@@ -4,11 +4,12 @@ exports.form = exports.FormStruct = exports.FormComponentStruct = void 0;
|
|
|
4
4
|
const superstruct_1 = require("@metamask/superstruct");
|
|
5
5
|
const button_1 = require("./button.cjs");
|
|
6
6
|
const input_1 = require("./input.cjs");
|
|
7
|
+
const internals_1 = require("../../internals/index.cjs");
|
|
7
8
|
const builder_1 = require("../builder.cjs");
|
|
8
9
|
const nodes_1 = require("../nodes.cjs");
|
|
9
10
|
exports.FormComponentStruct = (0, superstruct_1.union)([input_1.InputStruct, button_1.ButtonStruct]);
|
|
10
11
|
exports.FormStruct = (0, superstruct_1.assign)(nodes_1.NodeStruct, (0, superstruct_1.object)({
|
|
11
|
-
type: (0,
|
|
12
|
+
type: (0, internals_1.literal)(nodes_1.NodeType.Form),
|
|
12
13
|
children: (0, superstruct_1.array)(exports.FormComponentStruct),
|
|
13
14
|
name: (0, superstruct_1.string)(),
|
|
14
15
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"form.cjs","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":";;;AACA,uDAA6E;AAE7E,yCAAwC;AACxC,uCAAsC;AACtC,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAgD;AAEnC,QAAA,mBAAmB,GAAG,IAAA,mBAAK,EAAC,CAAC,mBAAW,EAAE,qBAAY,CAAC,CAAC,CAAC;AAOzD,QAAA,UAAU,GAAG,IAAA,oBAAM,EAC9B,kBAAU,EACV,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,IAAI,CAAC;IAC5B,QAAQ,EAAE,IAAA,mBAAK,EAAC,2BAAmB,CAAC;IACpC,IAAI,EAAE,IAAA,oBAAM,GAAE;CACf,CAAC,CACH,CAAC;AAWF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACU,QAAA,IAAI,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,IAAI,EAAE,kBAAU,EAAE;IAC3D,MAAM;IACN,UAAU;CACX,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, assign, object, string, union } from '@metamask/superstruct';\n\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer<typeof FormComponentStruct>;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer<typeof FormStruct>;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form 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 = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n"]}
|