@metamask/snaps-sdk 6.8.0 → 6.9.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 +17 -1
- package/dist/error-wrappers.d.cts +192 -192
- package/dist/error-wrappers.d.mts +192 -192
- package/dist/internals/error-wrappers.d.cts +12 -12
- package/dist/internals/error-wrappers.d.mts +12 -12
- package/dist/jsx/components/Avatar.cjs +20 -0
- package/dist/jsx/components/Avatar.cjs.map +1 -0
- package/dist/jsx/components/Avatar.d.cts +31 -0
- package/dist/jsx/components/Avatar.d.cts.map +1 -0
- package/dist/jsx/components/Avatar.d.mts +31 -0
- package/dist/jsx/components/Avatar.d.mts.map +1 -0
- package/dist/jsx/components/Avatar.mjs +17 -0
- package/dist/jsx/components/Avatar.mjs.map +1 -0
- package/dist/jsx/components/Heading.cjs +1 -1
- package/dist/jsx/components/Heading.cjs.map +1 -1
- package/dist/jsx/components/Heading.d.cts +3 -3
- package/dist/jsx/components/Heading.d.cts.map +1 -1
- package/dist/jsx/components/Heading.d.mts +3 -3
- package/dist/jsx/components/Heading.d.mts.map +1 -1
- package/dist/jsx/components/Heading.mjs +1 -1
- package/dist/jsx/components/Heading.mjs.map +1 -1
- package/dist/jsx/components/form/Input.cjs +8 -0
- package/dist/jsx/components/form/Input.cjs.map +1 -1
- package/dist/jsx/components/form/Input.d.cts +32 -6
- package/dist/jsx/components/form/Input.d.cts.map +1 -1
- package/dist/jsx/components/form/Input.d.mts +32 -6
- package/dist/jsx/components/form/Input.d.mts.map +1 -1
- package/dist/jsx/components/form/Input.mjs +8 -0
- package/dist/jsx/components/form/Input.mjs.map +1 -1
- package/dist/jsx/components/index.cjs +1 -0
- package/dist/jsx/components/index.cjs.map +1 -1
- package/dist/jsx/components/index.d.cts +3 -1
- package/dist/jsx/components/index.d.cts.map +1 -1
- package/dist/jsx/components/index.d.mts +3 -1
- package/dist/jsx/components/index.d.mts.map +1 -1
- package/dist/jsx/components/index.mjs +1 -0
- package/dist/jsx/components/index.mjs.map +1 -1
- package/dist/jsx/index.cjs +1 -2
- package/dist/jsx/index.cjs.map +1 -1
- package/dist/jsx/index.d.cts +1 -1
- package/dist/jsx/index.d.cts.map +1 -1
- package/dist/jsx/index.d.mts +1 -1
- package/dist/jsx/index.d.mts.map +1 -1
- package/dist/jsx/index.mjs +1 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/validation.cjs +67 -36
- package/dist/jsx/validation.cjs.map +1 -1
- package/dist/jsx/validation.d.cts +70 -15
- package/dist/jsx/validation.d.cts.map +1 -1
- package/dist/jsx/validation.d.mts +70 -15
- package/dist/jsx/validation.d.mts.map +1 -1
- package/dist/jsx/validation.mjs +66 -36
- package/dist/jsx/validation.mjs.map +1 -1
- package/dist/types/global.cjs.map +1 -1
- package/dist/types/global.d.cts.map +1 -1
- package/dist/types/global.d.mts.map +1 -1
- package/dist/types/global.mjs.map +1 -1
- package/dist/types/images.cjs.map +1 -1
- package/dist/types/images.d.cts.map +1 -1
- package/dist/types/images.d.mts.map +1 -1
- package/dist/types/images.mjs.map +1 -1
- package/dist/types/interface.d.cts +2 -2
- package/dist/types/interface.d.mts +2 -2
- package/dist/types/methods/notify.cjs.map +1 -1
- package/dist/types/methods/notify.d.cts +2 -21
- package/dist/types/methods/notify.d.cts.map +1 -1
- package/dist/types/methods/notify.d.mts +2 -21
- package/dist/types/methods/notify.d.mts.map +1 -1
- package/dist/types/methods/notify.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,66 @@ export declare const ButtonStruct: Describe<ButtonElement>;
|
|
|
30
30
|
* A struct for the {@link CheckboxElement} type.
|
|
31
31
|
*/
|
|
32
32
|
export declare const CheckboxStruct: Describe<CheckboxElement>;
|
|
33
|
+
/**
|
|
34
|
+
* A struct for the generic input element props.
|
|
35
|
+
*/
|
|
36
|
+
export declare const GenericInputPropsStruct: Struct<{
|
|
37
|
+
name: string;
|
|
38
|
+
value?: string | undefined;
|
|
39
|
+
placeholder?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
name: Struct<string, null>;
|
|
42
|
+
value: Struct<string | undefined, null>;
|
|
43
|
+
placeholder: Struct<string | undefined, null>;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* A struct for the text type input props.
|
|
47
|
+
*/
|
|
48
|
+
export declare const TextInputPropsStruct: Struct<{
|
|
49
|
+
type: "text";
|
|
50
|
+
name: string;
|
|
51
|
+
value?: string | undefined;
|
|
52
|
+
placeholder?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
type: Struct<"text", null>;
|
|
55
|
+
name: Struct<string, null>;
|
|
56
|
+
value: Struct<string | undefined, null>;
|
|
57
|
+
placeholder: Struct<string | undefined, null>;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* A struct for the password type input props.
|
|
61
|
+
*/
|
|
62
|
+
export declare const PasswordInputPropsStruct: Struct<{
|
|
63
|
+
type: "password";
|
|
64
|
+
name: string;
|
|
65
|
+
value?: string | undefined;
|
|
66
|
+
placeholder?: string | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
type: Struct<"password", null>;
|
|
69
|
+
name: Struct<string, null>;
|
|
70
|
+
value: Struct<string | undefined, null>;
|
|
71
|
+
placeholder: Struct<string | undefined, null>;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* A struct for the number type input props.
|
|
75
|
+
*/
|
|
76
|
+
export declare const NumberInputPropsStruct: Struct<{
|
|
77
|
+
type: "number";
|
|
78
|
+
name: string;
|
|
79
|
+
max?: number | undefined;
|
|
80
|
+
min?: number | undefined;
|
|
81
|
+
value?: string | undefined;
|
|
82
|
+
placeholder?: string | undefined;
|
|
83
|
+
step?: number | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
type: Struct<"number", null>;
|
|
86
|
+
min: Struct<number | undefined, null>;
|
|
87
|
+
max: Struct<number | undefined, null>;
|
|
88
|
+
step: Struct<number | undefined, null>;
|
|
89
|
+
name: Struct<string, null>;
|
|
90
|
+
value: Struct<string | undefined, null>;
|
|
91
|
+
placeholder: Struct<string | undefined, null>;
|
|
92
|
+
}>;
|
|
33
93
|
/**
|
|
34
94
|
* A struct for the {@link InputElement} type.
|
|
35
95
|
*/
|
|
@@ -80,9 +140,9 @@ export declare const FieldChildUnionStruct: Struct<SnapElement<import("./compone
|
|
|
80
140
|
value: string;
|
|
81
141
|
children: string;
|
|
82
142
|
}, "Radio">>;
|
|
83
|
-
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
143
|
+
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
84
144
|
children: StringElement;
|
|
85
|
-
size?: "md" | "lg" | undefined;
|
|
145
|
+
size?: "md" | "sm" | "lg" | undefined;
|
|
86
146
|
}, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
|
|
87
147
|
/**
|
|
88
148
|
* A struct for the {@link FieldElement} type.
|
|
@@ -109,6 +169,10 @@ export declare const FormattingStruct: Describe<StandardFormattingElement>;
|
|
|
109
169
|
* A struct for the {@link AddressElement} type.
|
|
110
170
|
*/
|
|
111
171
|
export declare const AddressStruct: Describe<AddressElement>;
|
|
172
|
+
/**
|
|
173
|
+
* A struct for the {@link AvatarElement} type.
|
|
174
|
+
*/
|
|
175
|
+
export declare const AvatarStruct: Struct<SnapElement<import("./components/index.mjs").AvatarProps, "Avatar">, null>;
|
|
112
176
|
export declare const BoxChildrenStruct: Struct<SnapsChildren<GenericSnapElement>, null>;
|
|
113
177
|
/**
|
|
114
178
|
* A struct for the {@link BoxElement} type.
|
|
@@ -118,11 +182,6 @@ export declare const BoxStruct: Describe<BoxElement>;
|
|
|
118
182
|
* A struct for the {@link SectionElement} type.
|
|
119
183
|
*/
|
|
120
184
|
export declare const SectionStruct: Describe<SectionElement>;
|
|
121
|
-
export declare const NotificationChildrenStruct: Struct<SnapsChildren<GenericSnapElement>, null>;
|
|
122
|
-
/**
|
|
123
|
-
* A struct for the {@link BoxElement} type but with a limited subset of children.
|
|
124
|
-
*/
|
|
125
|
-
export declare const NotificationStruct: Describe<BoxElement>;
|
|
126
185
|
/**
|
|
127
186
|
* A subset of JSX elements that are allowed as children of the Footer component.
|
|
128
187
|
* This set should include a single button or a tuple of two buttons.
|
|
@@ -196,14 +255,10 @@ export declare const BoxChildStruct: Struct<SnapElement<import("./components/ind
|
|
|
196
255
|
value: string;
|
|
197
256
|
children: string;
|
|
198
257
|
}, "Radio">>;
|
|
199
|
-
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
258
|
+
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
200
259
|
children: StringElement;
|
|
201
|
-
size?: "md" | "lg" | undefined;
|
|
260
|
+
size?: "md" | "sm" | "lg" | undefined;
|
|
202
261
|
}, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
|
|
203
|
-
export declare const NotificationComponentsStruct: Struct<SnapElement<import("./components/index.mjs").IconProps, "Icon"> | SnapElement<{
|
|
204
|
-
src: string;
|
|
205
|
-
alt?: string | undefined;
|
|
206
|
-
}, "Image"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
|
|
207
262
|
/**
|
|
208
263
|
* A struct for the {@link ContainerElement} type.
|
|
209
264
|
*/
|
|
@@ -222,9 +277,9 @@ export declare const RootJSXElementStruct: Struct<SnapElement<import("./componen
|
|
|
222
277
|
value: string;
|
|
223
278
|
children: string;
|
|
224
279
|
}, "Radio">>;
|
|
225
|
-
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").ContainerProps, "Container"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
280
|
+
}, "RadioGroup"> | SnapElement<import("./components/index.mjs").FileInputProps, "FileInput"> | SnapElement<import("./components/index.mjs").CardProps, "Card"> | SnapElement<import("./components/index.mjs").SelectorProps, "Selector"> | SnapElement<import("./components/index.mjs").BoldProps, "Bold"> | SnapElement<import("./components/index.mjs").ItalicProps, "Italic"> | SnapElement<import("./components/index.mjs").AvatarProps, "Avatar"> | SnapElement<import("./components/index.mjs").AddressProps, "Address"> | SnapElement<import("./components/index.mjs").BoxProps, "Box"> | SnapElement<import("./components/index.mjs").ContainerProps, "Container"> | SnapElement<import("./components/index.mjs").CopyableProps, "Copyable"> | SnapElement<Record<string, never>, "Divider"> | SnapElement<{
|
|
226
281
|
children: StringElement;
|
|
227
|
-
size?: "md" | "lg" | undefined;
|
|
282
|
+
size?: "md" | "sm" | "lg" | undefined;
|
|
228
283
|
}, "Heading"> | SnapElement<import("./components/index.mjs").LinkProps, "Link"> | SnapElement<import("./components/index.mjs").TextProps, "Text"> | SnapElement<import("./components/index.mjs").RowProps, "Row"> | SnapElement<import("./components/index.mjs").SectionProps, "Section"> | SnapElement<Record<string, never>, "Spinner"> | SnapElement<import("./components/index.mjs").TooltipProps, "Tooltip">, null>;
|
|
229
284
|
/**
|
|
230
285
|
* A struct for the {@link JSXElement} type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,MAAM,EACP,8BAA8B;
|
|
1
|
+
{"version":3,"file":"validation.d.mts","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAKV,MAAM,EACP,8BAA8B;AAwB/B,OAAO,KAAK,EAAE,QAAQ,EAAE,+BAAqB;AAS7C,OAAO,KAAK,EAEV,kBAAkB,EAElB,GAAG,EAEH,WAAW,EACX,aAAa,EACb,aAAa,EACd,wBAAoB;AAErB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,yBAAyB,EAC9B,KAAK,WAAW,EAChB,KAAK,cA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AK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAOtE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAW5E"}
|
package/dist/jsx/validation.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is, boolean, optional, array, lazy, nullable, number, object, record, string, tuple, refine } from "@metamask/superstruct";
|
|
1
|
+
import { is, boolean, optional, array, lazy, nullable, number, object, record, string, tuple, refine, assign } from "@metamask/superstruct";
|
|
2
2
|
import { CaipAccountIdStruct, hasProperty, HexChecksumAddressStruct, isPlainObject, JsonStruct } from "@metamask/utils";
|
|
3
3
|
import { literal, nullUnion, selectiveUnion, svg, typedUnion } from "../internals/index.mjs";
|
|
4
4
|
import { IconName } from "./components/index.mjs";
|
|
@@ -82,6 +82,20 @@ function element(name, props = {}) {
|
|
|
82
82
|
key: nullable(KeyStruct),
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A helper function for creating a struct for a JSX element with selective props.
|
|
87
|
+
*
|
|
88
|
+
* @param name - The name of the element.
|
|
89
|
+
* @param selector - The selector function choosing the struct to validate with.
|
|
90
|
+
* @returns The struct for the element.
|
|
91
|
+
*/
|
|
92
|
+
function elementWithSelectiveProps(name, selector) {
|
|
93
|
+
return object({
|
|
94
|
+
type: literal(name),
|
|
95
|
+
props: selectiveUnion(selector),
|
|
96
|
+
key: nullable(KeyStruct),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
85
99
|
/**
|
|
86
100
|
* A struct for the {@link ImageElement} type.
|
|
87
101
|
*/
|
|
@@ -119,14 +133,52 @@ export const CheckboxStruct = element('Checkbox', {
|
|
|
119
133
|
variant: optional(nullUnion([literal('default'), literal('toggle')])),
|
|
120
134
|
});
|
|
121
135
|
/**
|
|
122
|
-
* A struct for the
|
|
136
|
+
* A struct for the generic input element props.
|
|
123
137
|
*/
|
|
124
|
-
export const
|
|
138
|
+
export const GenericInputPropsStruct = object({
|
|
125
139
|
name: string(),
|
|
126
|
-
type: optional(nullUnion([literal('text'), literal('password'), literal('number')])),
|
|
127
140
|
value: optional(string()),
|
|
128
141
|
placeholder: optional(string()),
|
|
129
142
|
});
|
|
143
|
+
/**
|
|
144
|
+
* A struct for the text type input props.
|
|
145
|
+
*/
|
|
146
|
+
export const TextInputPropsStruct = assign(GenericInputPropsStruct, object({
|
|
147
|
+
type: literal('text'),
|
|
148
|
+
}));
|
|
149
|
+
/**
|
|
150
|
+
* A struct for the password type input props.
|
|
151
|
+
*/
|
|
152
|
+
export const PasswordInputPropsStruct = assign(GenericInputPropsStruct, object({
|
|
153
|
+
type: literal('password'),
|
|
154
|
+
}));
|
|
155
|
+
/**
|
|
156
|
+
* A struct for the number type input props.
|
|
157
|
+
*/
|
|
158
|
+
export const NumberInputPropsStruct = assign(GenericInputPropsStruct, object({
|
|
159
|
+
type: literal('number'),
|
|
160
|
+
min: optional(number()),
|
|
161
|
+
max: optional(number()),
|
|
162
|
+
step: optional(number()),
|
|
163
|
+
}));
|
|
164
|
+
/**
|
|
165
|
+
* A struct for the {@link InputElement} type.
|
|
166
|
+
*/
|
|
167
|
+
export const InputStruct = elementWithSelectiveProps('Input', (value) => {
|
|
168
|
+
if (isPlainObject(value) && hasProperty(value, 'type')) {
|
|
169
|
+
switch (value.type) {
|
|
170
|
+
case 'text':
|
|
171
|
+
return TextInputPropsStruct;
|
|
172
|
+
case 'password':
|
|
173
|
+
return PasswordInputPropsStruct;
|
|
174
|
+
case 'number':
|
|
175
|
+
return NumberInputPropsStruct;
|
|
176
|
+
default:
|
|
177
|
+
return GenericInputPropsStruct;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return GenericInputPropsStruct;
|
|
181
|
+
});
|
|
130
182
|
/**
|
|
131
183
|
* A struct for the {@link OptionElement} type.
|
|
132
184
|
*/
|
|
@@ -295,6 +347,13 @@ export const FormattingStruct = typedUnion([BoldStruct, ItalicStruct]);
|
|
|
295
347
|
export const AddressStruct = element('Address', {
|
|
296
348
|
address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),
|
|
297
349
|
});
|
|
350
|
+
/**
|
|
351
|
+
* A struct for the {@link AvatarElement} type.
|
|
352
|
+
*/
|
|
353
|
+
export const AvatarStruct = element('Avatar', {
|
|
354
|
+
address: CaipAccountIdStruct,
|
|
355
|
+
size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),
|
|
356
|
+
});
|
|
298
357
|
export const BoxChildrenStruct = children(
|
|
299
358
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
300
359
|
[lazy(() => BoxChildStruct)]);
|
|
@@ -343,23 +402,6 @@ export const SectionStruct = element('Section', {
|
|
|
343
402
|
literal('space-around'),
|
|
344
403
|
])),
|
|
345
404
|
});
|
|
346
|
-
export const NotificationChildrenStruct = children(
|
|
347
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
348
|
-
[lazy(() => NotificationComponentsStruct)]);
|
|
349
|
-
/**
|
|
350
|
-
* A struct for the {@link BoxElement} type but with a limited subset of children.
|
|
351
|
-
*/
|
|
352
|
-
export const NotificationStruct = element('Box', {
|
|
353
|
-
children: NotificationChildrenStruct,
|
|
354
|
-
direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),
|
|
355
|
-
alignment: optional(nullUnion([
|
|
356
|
-
literal('start'),
|
|
357
|
-
literal('center'),
|
|
358
|
-
literal('end'),
|
|
359
|
-
literal('space-between'),
|
|
360
|
-
literal('space-around'),
|
|
361
|
-
])),
|
|
362
|
-
});
|
|
363
405
|
/**
|
|
364
406
|
* A subset of JSX elements that are allowed as children of the Footer component.
|
|
365
407
|
* This set should include a single button or a tuple of two buttons.
|
|
@@ -399,7 +441,7 @@ export const ValueStruct = element('Value', {
|
|
|
399
441
|
*/
|
|
400
442
|
export const HeadingStruct = element('Heading', {
|
|
401
443
|
children: StringElementStruct,
|
|
402
|
-
size: optional(nullUnion([literal('md'), literal('lg')])),
|
|
444
|
+
size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),
|
|
403
445
|
});
|
|
404
446
|
/**
|
|
405
447
|
* A struct for the {@link LinkElement} type.
|
|
@@ -525,20 +567,7 @@ export const BoxChildStruct = typedUnion([
|
|
|
525
567
|
IconStruct,
|
|
526
568
|
SelectorStruct,
|
|
527
569
|
SectionStruct,
|
|
528
|
-
|
|
529
|
-
export const NotificationComponentsStruct = typedUnion([
|
|
530
|
-
CopyableStruct,
|
|
531
|
-
NotificationStruct,
|
|
532
|
-
BoldStruct,
|
|
533
|
-
ItalicStruct,
|
|
534
|
-
AddressStruct,
|
|
535
|
-
DividerStruct,
|
|
536
|
-
RowStruct,
|
|
537
|
-
TextStruct,
|
|
538
|
-
TooltipStruct,
|
|
539
|
-
IconStruct,
|
|
540
|
-
ImageStruct,
|
|
541
|
-
LinkStruct,
|
|
570
|
+
AvatarStruct,
|
|
542
571
|
]);
|
|
543
572
|
/**
|
|
544
573
|
* A struct for the {@link ContainerElement} type.
|
|
@@ -594,6 +623,7 @@ export const JSXElementStruct = typedUnion([
|
|
|
594
623
|
SelectorStruct,
|
|
595
624
|
SelectorOptionStruct,
|
|
596
625
|
SectionStruct,
|
|
626
|
+
AvatarStruct,
|
|
597
627
|
]);
|
|
598
628
|
/**
|
|
599
629
|
* Check if a value is a JSX element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACP,8BAA8B;AAC/B,OAAO,EACL,mBA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IACX,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,eAAe;IACf,UAAU;IACV,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,aAAa;CACd,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,aAAa,CAAC,KAAK,CAAC;QACpB,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: string(),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BOX_INPUT_LEFT),\n tuple(BOX_INPUT_RIGHT),\n tuple(BOX_INPUT_BOTH),\n ...FIELD_CHILDREN_ARRAY,\n]) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n});\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n center: optional(boolean()),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\nexport const NotificationChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => NotificationComponentsStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type but with a limited subset of children.\n */\nexport const NotificationStruct: Describe<BoxElement> = element('Box', {\n children: NotificationChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n]);\n\nexport const NotificationComponentsStruct = typedUnion([\n CopyableStruct,\n NotificationStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n DividerStruct,\n RowStruct,\n TextStruct,\n TooltipStruct,\n IconStruct,\n ImageStruct,\n LinkStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACP,8BAA8B;AAC/B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,UAAU,EACX,wBAAwB;AAGzB,OAAO,EACL,OAAO,EACP,SAAS,EACT,cAAc,EACd,GAAG,EACH,UAAU,EACX,+BAAqB;AAatB,OAAO,EAkCL,QAAQ,EACT,+BAAqB;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,MAAM,EAAE;CACT,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,MAAM,CAAC;IAChE,IAAI,EAAE,MAAM,EAAE;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC;IACnC,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC;CACzB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,QAAQ,CACf,MAA4B;IAE5B,MAAM,cAAc,GAA2B,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;QACtE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAE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,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,aAAa,CAAC,KAAK,CAAC;QACpB,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAC3B,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n assign,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapChildren,\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type { AvatarElement } from './components';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct which allows a single child of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param struct - The struct to allow as a single child.\n * @returns The struct for the children.\n */\nfunction singleChild<Type extends AnyStruct>(\n struct: Type,\n): Struct<Infer<Type> | boolean | null, null> {\n return nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n\n return struct;\n }),\n ) as unknown as Struct<Infer<Type> | boolean | null, null>;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A helper function for creating a struct for a JSX element with selective props.\n *\n * @param name - The name of the element.\n * @param selector - The selector function choosing the struct to validate with.\n * @returns The struct for the element.\n */\nfunction elementWithSelectiveProps<\n Name extends string,\n Selector extends (value: any) => AnyStruct,\n>(name: Name, selector: Selector) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: selectiveUnion(selector),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n form: optional(string()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the generic input element props.\n */\nexport const GenericInputPropsStruct = object({\n name: string(),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the text type input props.\n */\nexport const TextInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('text'),\n }),\n);\n\n/**\n * A struct for the password type input props.\n */\nexport const PasswordInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('password'),\n }),\n);\n\n/**\n * A struct for the number type input props.\n */\nexport const NumberInputPropsStruct = assign(\n GenericInputPropsStruct,\n object({\n type: literal('number'),\n min: optional(number()),\n max: optional(number()),\n step: optional(number()),\n }),\n);\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = elementWithSelectiveProps(\n 'Input',\n (value) => {\n if (isPlainObject(value) && hasProperty(value, 'type')) {\n switch (value.type) {\n case 'text':\n return TextInputPropsStruct;\n case 'password':\n return PasswordInputPropsStruct;\n case 'number':\n return NumberInputPropsStruct;\n default:\n return GenericInputPropsStruct;\n }\n }\n return GenericInputPropsStruct;\n },\n);\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: string(),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\nconst BOX_INPUT_LEFT = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n] as [typeof BoxChildStruct, typeof InputStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\nconst BOX_INPUT_RIGHT = [\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n singleChild(lazy(() => BoxChildStruct)),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BOX_INPUT_LEFT),\n tuple(BOX_INPUT_RIGHT),\n tuple(BOX_INPUT_BOTH),\n ...FIELD_CHILDREN_ARRAY,\n]) as unknown as Struct<\n | [InputElement, GenericSnapChildren]\n | [GenericSnapChildren, InputElement]\n | [GenericSnapChildren, InputElement, GenericSnapChildren]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n});\n\n/**\n * A struct for the {@link AvatarElement} type.\n */\nexport const AvatarStruct = element('Avatar', {\n address: CaipAccountIdStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n}) as unknown as Struct<AvatarElement, null>;\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n center: optional(boolean()),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([\n FormattingStruct,\n string(),\n IconStruct,\n ImageStruct,\n AddressStruct,\n ]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([\n AddressStruct,\n ImageStruct,\n TextStruct,\n ValueStruct,\n LinkStruct,\n ]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n AvatarStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.cjs","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"","sourcesContent":["import type { SnapsEthereumProvider, SnapsProvider } from './provider';\n\n/**\n * Constants that are available globally in the Snap.\n */\ndeclare global {\n const ethereum: SnapsEthereumProvider;\n const snap: SnapsProvider;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"global.cjs","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"","sourcesContent":["import type { SnapsEthereumProvider, SnapsProvider } from './provider';\n\n/**\n * Constants that are available globally in the Snap.\n */\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n const ethereum: SnapsEthereumProvider;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n const snap: SnapsProvider;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.cts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,uBAAmB;AAEvE;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"global.d.cts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,uBAAmB;AAEvE;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAGb,MAAM,QAAQ,EAAE,qBAAqB,CAAC;IAGtC,MAAM,IAAI,EAAE,aAAa,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.mts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,uBAAmB;AAEvE;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"global.d.mts","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,uBAAmB;AAEvE;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAGb,MAAM,QAAQ,EAAE,qBAAqB,CAAC;IAGtC,MAAM,IAAI,EAAE,aAAa,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.mjs","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"","sourcesContent":["import type { SnapsEthereumProvider, SnapsProvider } from './provider';\n\n/**\n * Constants that are available globally in the Snap.\n */\ndeclare global {\n const ethereum: SnapsEthereumProvider;\n const snap: SnapsProvider;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"global.mjs","sourceRoot":"","sources":["../../src/types/global.ts"],"names":[],"mappings":"","sourcesContent":["import type { SnapsEthereumProvider, SnapsProvider } from './provider';\n\n/**\n * Constants that are available globally in the Snap.\n */\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n const ethereum: SnapsEthereumProvider;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n const snap: SnapsProvider;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.cjs","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line import/unambiguous\ndeclare module '*.svg' {\n const content: string;\n export default content;\n}\n\ndeclare module '*.png' {\n const content: string;\n export default content;\n}\n\ndeclare module '*.jpg' {\n const content: string;\n export default content;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"images.cjs","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line import/unambiguous\ndeclare module '*.svg' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n\ndeclare module '*.png' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n\ndeclare module '*.jpg' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.cts","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"images.d.cts","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB;AAED,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB;AAED,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.mts","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"images.d.mts","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB;AAED,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB;AAED,OAAO,QAAQ,OAAO,CAAC;IACrB,MAAM,OAAO,EAAE,MAAM,CAAC;IAGtB,eAAe,OAAO,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.mjs","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line import/unambiguous\ndeclare module '*.svg' {\n const content: string;\n export default content;\n}\n\ndeclare module '*.png' {\n const content: string;\n export default content;\n}\n\ndeclare module '*.jpg' {\n const content: string;\n export default content;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"images.mjs","sourceRoot":"","sources":["../../src/types/images.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line import/unambiguous\ndeclare module '*.svg' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n\ndeclare module '*.png' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n\ndeclare module '*.jpg' {\n const content: string;\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Redeclared in .d.cts file\n export default content;\n}\n"]}
|
|
@@ -112,9 +112,9 @@ export declare const ComponentOrElementStruct: import("@metamask/superstruct").S
|
|
|
112
112
|
value: string;
|
|
113
113
|
children: string;
|
|
114
114
|
}, "Radio">>;
|
|
115
|
-
}, "RadioGroup"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").FileInputProps, "FileInput"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CardProps, "Card"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SelectorProps, "Selector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoldProps, "Bold"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ItalicProps, "Italic"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AddressProps, "Address"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoxProps, "Box"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ContainerProps, "Container"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CopyableProps, "Copyable"> | import("../jsx/index.cjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.cjs").SnapElement<{
|
|
115
|
+
}, "RadioGroup"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").FileInputProps, "FileInput"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CardProps, "Card"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SelectorProps, "Selector"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoldProps, "Bold"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ItalicProps, "Italic"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AvatarProps, "Avatar"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").AddressProps, "Address"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").BoxProps, "Box"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").ContainerProps, "Container"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").CopyableProps, "Copyable"> | import("../jsx/index.cjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.cjs").SnapElement<{
|
|
116
116
|
children: import("../jsx/index.cjs").StringElement;
|
|
117
|
-
size?: "md" | "lg" | undefined;
|
|
117
|
+
size?: "md" | "sm" | "lg" | undefined;
|
|
118
118
|
}, "Heading"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").LinkProps, "Link"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").TextProps, "Text"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").RowProps, "Row"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").SectionProps, "Section"> | import("../jsx/index.cjs").SnapElement<Record<string, never>, "Spinner"> | import("../jsx/index.cjs").SnapElement<import("../jsx/index.cjs").TooltipProps, "Tooltip">, null>;
|
|
119
119
|
export declare const InterfaceContextStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
120
120
|
export type InterfaceContext = Infer<typeof InterfaceContextStruct>;
|
|
@@ -112,9 +112,9 @@ export declare const ComponentOrElementStruct: import("@metamask/superstruct").S
|
|
|
112
112
|
value: string;
|
|
113
113
|
children: string;
|
|
114
114
|
}, "Radio">>;
|
|
115
|
-
}, "RadioGroup"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").FileInputProps, "FileInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CardProps, "Card"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SelectorProps, "Selector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoldProps, "Bold"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ItalicProps, "Italic"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressProps, "Address"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoxProps, "Box"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ContainerProps, "Container"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CopyableProps, "Copyable"> | import("../jsx/index.mjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.mjs").SnapElement<{
|
|
115
|
+
}, "RadioGroup"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").FileInputProps, "FileInput"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CardProps, "Card"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SelectorProps, "Selector"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoldProps, "Bold"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ItalicProps, "Italic"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AvatarProps, "Avatar"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").AddressProps, "Address"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").BoxProps, "Box"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").ContainerProps, "Container"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").CopyableProps, "Copyable"> | import("../jsx/index.mjs").SnapElement<Record<string, never>, "Divider"> | import("../jsx/index.mjs").SnapElement<{
|
|
116
116
|
children: import("../jsx/index.mjs").StringElement;
|
|
117
|
-
size?: "md" | "lg" | undefined;
|
|
117
|
+
size?: "md" | "sm" | "lg" | undefined;
|
|
118
118
|
}, "Heading"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").LinkProps, "Link"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").TextProps, "Text"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").RowProps, "Row"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").SectionProps, "Section"> | import("../jsx/index.mjs").SnapElement<Record<string, never>, "Spinner"> | import("../jsx/index.mjs").SnapElement<import("../jsx/index.mjs").TooltipProps, "Tooltip">, null>;
|
|
119
119
|
export declare const InterfaceContextStruct: import("@metamask/superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
|
|
120
120
|
export type InterfaceContext = Infer<typeof InterfaceContextStruct>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.cjs","sourceRoot":"","sources":["../../../src/types/methods/notify.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"notify.cjs","sourceRoot":"","sources":["../../../src/types/methods/notify.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,qCAAiB,CAAA;AACnB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion<NotificationType>;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n"]}
|