@metamask/snaps-sdk 6.2.1 → 6.3.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 +11 -1
- package/dist/index.js +245 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +245 -17
- package/dist/index.mjs.map +1 -1
- package/dist/jsx/index.js +274 -51
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +274 -51
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js +245 -17
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.mjs +245 -17
- package/dist/jsx/jsx-dev-runtime.mjs.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/jsx/components/Icon.d.ts +189 -0
- package/dist/types/jsx/components/Text.d.ts +7 -1
- package/dist/types/jsx/components/Tooltip.d.ts +3 -2
- package/dist/types/jsx/components/form/Button.d.ts +4 -2
- package/dist/types/jsx/components/form/Field.d.ts +2 -1
- package/dist/types/jsx/components/form/Selector.d.ts +41 -0
- package/dist/types/jsx/components/form/SelectorOption.d.ts +35 -0
- package/dist/types/jsx/components/form/index.d.ts +5 -1
- package/dist/types/jsx/components/index.d.ts +3 -1
- package/dist/types/jsx/validation.d.ts +37 -25
- package/dist/types/types/interface.d.ts +6 -6
- package/package.json +1 -1
|
@@ -113,6 +113,187 @@ function svg() {
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// src/jsx/component.ts
|
|
117
|
+
function removeUndefinedProps(props) {
|
|
118
|
+
return Object.fromEntries(
|
|
119
|
+
Object.entries(props).filter(([, value]) => value !== void 0)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function createSnapComponent(type) {
|
|
123
|
+
return (props) => {
|
|
124
|
+
const { key = null, ...rest } = props;
|
|
125
|
+
return {
|
|
126
|
+
type,
|
|
127
|
+
props: removeUndefinedProps(rest),
|
|
128
|
+
key
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/jsx/components/Icon.ts
|
|
134
|
+
var IconName = /* @__PURE__ */ ((IconName2) => {
|
|
135
|
+
IconName2["AddSquare"] = "add-square";
|
|
136
|
+
IconName2["Add"] = "add";
|
|
137
|
+
IconName2["Arrow2Down"] = "arrow-2-down";
|
|
138
|
+
IconName2["Arrow2Left"] = "arrow-2-left";
|
|
139
|
+
IconName2["Arrow2Right"] = "arrow-2-right";
|
|
140
|
+
IconName2["Arrow2Up"] = "arrow-2-up";
|
|
141
|
+
IconName2["Arrow2UpRight"] = "arrow-2-up-right";
|
|
142
|
+
IconName2["ArrowDoubleLeft"] = "arrow-double-left";
|
|
143
|
+
IconName2["ArrowDoubleRight"] = "arrow-double-right";
|
|
144
|
+
IconName2["ArrowDown"] = "arrow-down";
|
|
145
|
+
IconName2["ArrowLeft"] = "arrow-left";
|
|
146
|
+
IconName2["ArrowRight"] = "arrow-right";
|
|
147
|
+
IconName2["ArrowUp"] = "arrow-up";
|
|
148
|
+
IconName2["BankToken"] = "bank-token";
|
|
149
|
+
IconName2["Bank"] = "bank";
|
|
150
|
+
IconName2["Book"] = "book";
|
|
151
|
+
IconName2["Bookmark"] = "bookmark";
|
|
152
|
+
IconName2["Bridge"] = "bridge";
|
|
153
|
+
IconName2["Calculator"] = "calculator";
|
|
154
|
+
IconName2["CardPos"] = "card-pos";
|
|
155
|
+
IconName2["CardToken"] = "card-token";
|
|
156
|
+
IconName2["Card"] = "card";
|
|
157
|
+
IconName2["Category"] = "category";
|
|
158
|
+
IconName2["Chart"] = "chart";
|
|
159
|
+
IconName2["CheckBold"] = "check-bold";
|
|
160
|
+
IconName2["Check"] = "check";
|
|
161
|
+
IconName2["Clock"] = "clock";
|
|
162
|
+
IconName2["Close"] = "close";
|
|
163
|
+
IconName2["CodeCircle"] = "code-circle";
|
|
164
|
+
IconName2["Coin"] = "coin";
|
|
165
|
+
IconName2["Confirmation"] = "confirmation";
|
|
166
|
+
IconName2["Connect"] = "connect";
|
|
167
|
+
IconName2["CopySuccess"] = "copy-success";
|
|
168
|
+
IconName2["Copy"] = "copy";
|
|
169
|
+
IconName2["Customize"] = "customize";
|
|
170
|
+
IconName2["Danger"] = "danger";
|
|
171
|
+
IconName2["Dark"] = "dark";
|
|
172
|
+
IconName2["Data"] = "data";
|
|
173
|
+
IconName2["Diagram"] = "diagram";
|
|
174
|
+
IconName2["DocumentCode"] = "document-code";
|
|
175
|
+
IconName2["DragDrop"] = "drag-drop";
|
|
176
|
+
IconName2["DraggingAnimation"] = "dragging-animation";
|
|
177
|
+
IconName2["PinningAnimation"] = "pinning-animation";
|
|
178
|
+
IconName2["Edit"] = "edit";
|
|
179
|
+
IconName2["Eraser"] = "eraser";
|
|
180
|
+
IconName2["Ethereum"] = "ethereum";
|
|
181
|
+
IconName2["Expand"] = "expand";
|
|
182
|
+
IconName2["Explore"] = "explore";
|
|
183
|
+
IconName2["Export"] = "export";
|
|
184
|
+
IconName2["EyeSlash"] = "eye-slash";
|
|
185
|
+
IconName2["Eye"] = "eye";
|
|
186
|
+
IconName2["Filter"] = "filter";
|
|
187
|
+
IconName2["Flag"] = "flag";
|
|
188
|
+
IconName2["FlashSlash"] = "flash-slash";
|
|
189
|
+
IconName2["Flash"] = "flash";
|
|
190
|
+
IconName2["FullCircle"] = "full-circle";
|
|
191
|
+
IconName2["Gas"] = "gas";
|
|
192
|
+
IconName2["GlobalSearch"] = "global-search";
|
|
193
|
+
IconName2["Global"] = "global";
|
|
194
|
+
IconName2["Graph"] = "graph";
|
|
195
|
+
IconName2["Hardware"] = "hardware";
|
|
196
|
+
IconName2["Heart"] = "heart";
|
|
197
|
+
IconName2["Hierarchy"] = "hierarchy";
|
|
198
|
+
IconName2["Home"] = "home";
|
|
199
|
+
IconName2["Import"] = "import";
|
|
200
|
+
IconName2["Info"] = "info";
|
|
201
|
+
IconName2["Key"] = "key";
|
|
202
|
+
IconName2["Light"] = "light";
|
|
203
|
+
IconName2["Link"] = "link";
|
|
204
|
+
IconName2["Loading"] = "loading";
|
|
205
|
+
IconName2["LockCircle"] = "lock-circle";
|
|
206
|
+
IconName2["LockSlash"] = "lock-slash";
|
|
207
|
+
IconName2["Lock"] = "lock";
|
|
208
|
+
IconName2["Login"] = "login";
|
|
209
|
+
IconName2["Logout"] = "logout";
|
|
210
|
+
IconName2["Menu"] = "menu";
|
|
211
|
+
IconName2["MessageQuestion"] = "message-question";
|
|
212
|
+
IconName2["Messages"] = "messages";
|
|
213
|
+
IconName2["MinusBold"] = "minus-bold";
|
|
214
|
+
IconName2["MinusSquare"] = "minus-square";
|
|
215
|
+
IconName2["Minus"] = "minus";
|
|
216
|
+
IconName2["Mobile"] = "mobile";
|
|
217
|
+
IconName2["Money"] = "money";
|
|
218
|
+
IconName2["Monitor"] = "monitor";
|
|
219
|
+
IconName2["MoreHorizontal"] = "more-horizontal";
|
|
220
|
+
IconName2["MoreVertical"] = "more-vertical";
|
|
221
|
+
IconName2["NotificationCircle"] = "notification-circle";
|
|
222
|
+
IconName2["Notification"] = "notification";
|
|
223
|
+
IconName2["PasswordCheck"] = "password-check";
|
|
224
|
+
IconName2["People"] = "people";
|
|
225
|
+
IconName2["Pin"] = "pin";
|
|
226
|
+
IconName2["ProgrammingArrows"] = "programming-arrows";
|
|
227
|
+
IconName2["Custody"] = "custody";
|
|
228
|
+
IconName2["Question"] = "question";
|
|
229
|
+
IconName2["Received"] = "received";
|
|
230
|
+
IconName2["Refresh"] = "refresh";
|
|
231
|
+
IconName2["Save"] = "save";
|
|
232
|
+
IconName2["ScanBarcode"] = "scan-barcode";
|
|
233
|
+
IconName2["ScanFocus"] = "scan-focus";
|
|
234
|
+
IconName2["Scan"] = "scan";
|
|
235
|
+
IconName2["Scroll"] = "scroll";
|
|
236
|
+
IconName2["Search"] = "search";
|
|
237
|
+
IconName2["SecurityCard"] = "security-card";
|
|
238
|
+
IconName2["SecurityCross"] = "security-cross";
|
|
239
|
+
IconName2["SecurityKey"] = "security-key";
|
|
240
|
+
IconName2["SecuritySearch"] = "security-search";
|
|
241
|
+
IconName2["SecuritySlash"] = "security-slash";
|
|
242
|
+
IconName2["SecurityTick"] = "security-tick";
|
|
243
|
+
IconName2["SecurityTime"] = "security-time";
|
|
244
|
+
IconName2["SecurityUser"] = "security-user";
|
|
245
|
+
IconName2["Security"] = "security";
|
|
246
|
+
IconName2["Send1"] = "send-1";
|
|
247
|
+
IconName2["Send2"] = "send-2";
|
|
248
|
+
IconName2["Setting"] = "setting";
|
|
249
|
+
IconName2["Slash"] = "slash";
|
|
250
|
+
IconName2["SnapsMobile"] = "snaps-mobile";
|
|
251
|
+
IconName2["SnapsPlus"] = "snaps-plus";
|
|
252
|
+
IconName2["Snaps"] = "snaps";
|
|
253
|
+
IconName2["Speedometer"] = "speedometer";
|
|
254
|
+
IconName2["Star"] = "star";
|
|
255
|
+
IconName2["Stake"] = "stake";
|
|
256
|
+
IconName2["Student"] = "student";
|
|
257
|
+
IconName2["SwapHorizontal"] = "swap-horizontal";
|
|
258
|
+
IconName2["SwapVertical"] = "swap-vertical";
|
|
259
|
+
IconName2["Tag"] = "tag";
|
|
260
|
+
IconName2["Tilde"] = "tilde";
|
|
261
|
+
IconName2["Timer"] = "timer";
|
|
262
|
+
IconName2["Trash"] = "trash";
|
|
263
|
+
IconName2["TrendDown"] = "trend-down";
|
|
264
|
+
IconName2["TrendUp"] = "trend-up";
|
|
265
|
+
IconName2["UserCircleAdd"] = "user-circle-add";
|
|
266
|
+
IconName2["UserCircleLink"] = "user-circle-link";
|
|
267
|
+
IconName2["UserCircleRemove"] = "user-circle-remove";
|
|
268
|
+
IconName2["UserCircle"] = "user-circle";
|
|
269
|
+
IconName2["User"] = "user";
|
|
270
|
+
IconName2["WalletCard"] = "wallet-card";
|
|
271
|
+
IconName2["WalletMoney"] = "wallet-money";
|
|
272
|
+
IconName2["Wallet"] = "wallet";
|
|
273
|
+
IconName2["Warning"] = "warning";
|
|
274
|
+
IconName2["Twitter"] = "twitter";
|
|
275
|
+
IconName2["QrCode"] = "qr-code";
|
|
276
|
+
IconName2["UserCheck"] = "user-check";
|
|
277
|
+
IconName2["Unpin"] = "unpin";
|
|
278
|
+
IconName2["Ban"] = "ban";
|
|
279
|
+
IconName2["Bold"] = "bold";
|
|
280
|
+
IconName2["CircleX"] = "circle-x";
|
|
281
|
+
IconName2["Download"] = "download";
|
|
282
|
+
IconName2["FileIcon"] = "file";
|
|
283
|
+
IconName2["Flask"] = "flask";
|
|
284
|
+
IconName2["Plug"] = "plug";
|
|
285
|
+
IconName2["Share"] = "share";
|
|
286
|
+
IconName2["Square"] = "square";
|
|
287
|
+
IconName2["Tint"] = "tint";
|
|
288
|
+
IconName2["Upload"] = "upload";
|
|
289
|
+
IconName2["Usb"] = "usb";
|
|
290
|
+
IconName2["Wifi"] = "wifi";
|
|
291
|
+
IconName2["PlusMinus"] = "plus-minus";
|
|
292
|
+
return IconName2;
|
|
293
|
+
})(IconName || {});
|
|
294
|
+
var TYPE = "Icon";
|
|
295
|
+
var Icon = createSnapComponent(TYPE);
|
|
296
|
+
|
|
116
297
|
// src/jsx/validation.ts
|
|
117
298
|
var KeyStruct = nullUnion([string2(), number()]);
|
|
118
299
|
var StringElementStruct = children([
|
|
@@ -140,8 +321,22 @@ function element(name, props = {}) {
|
|
|
140
321
|
key: nullable(KeyStruct)
|
|
141
322
|
});
|
|
142
323
|
}
|
|
324
|
+
var ImageStruct = element("Image", {
|
|
325
|
+
src: svg(),
|
|
326
|
+
alt: optional(string2())
|
|
327
|
+
});
|
|
328
|
+
var IconNameStruct = nullUnion(
|
|
329
|
+
Object.values(IconName).map((name) => literal(name))
|
|
330
|
+
);
|
|
331
|
+
var IconStruct = element("Icon", {
|
|
332
|
+
name: IconNameStruct,
|
|
333
|
+
color: optional(
|
|
334
|
+
nullUnion([literal("default"), literal("primary"), literal("muted")])
|
|
335
|
+
),
|
|
336
|
+
size: optional(nullUnion([literal("md"), literal("inherit")]))
|
|
337
|
+
});
|
|
143
338
|
var ButtonStruct = element("Button", {
|
|
144
|
-
children: StringElementStruct,
|
|
339
|
+
children: children([StringElementStruct, ImageStruct, IconStruct]),
|
|
145
340
|
name: optional(string2()),
|
|
146
341
|
type: optional(nullUnion([literal("button"), literal("submit")])),
|
|
147
342
|
variant: optional(nullUnion([literal("primary"), literal("destructive")])),
|
|
@@ -163,13 +358,33 @@ var InputStruct = element("Input", {
|
|
|
163
358
|
});
|
|
164
359
|
var OptionStruct = element("Option", {
|
|
165
360
|
value: string2(),
|
|
166
|
-
children: string2()
|
|
361
|
+
children: nullUnion([string2()])
|
|
167
362
|
});
|
|
168
363
|
var DropdownStruct = element("Dropdown", {
|
|
169
364
|
name: string2(),
|
|
170
365
|
value: optional(string2()),
|
|
171
366
|
children: children([OptionStruct])
|
|
172
367
|
});
|
|
368
|
+
var CardStruct = element("Card", {
|
|
369
|
+
image: optional(string2()),
|
|
370
|
+
title: string2(),
|
|
371
|
+
description: optional(string2()),
|
|
372
|
+
value: string2(),
|
|
373
|
+
extra: optional(string2())
|
|
374
|
+
});
|
|
375
|
+
var SelectorOptionStruct = element(
|
|
376
|
+
"SelectorOption",
|
|
377
|
+
{
|
|
378
|
+
value: string2(),
|
|
379
|
+
children: CardStruct
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
var SelectorStruct = element("Selector", {
|
|
383
|
+
name: string2(),
|
|
384
|
+
title: string2(),
|
|
385
|
+
value: optional(string2()),
|
|
386
|
+
children: children([SelectorOptionStruct])
|
|
387
|
+
});
|
|
173
388
|
var RadioStruct = element("Radio", {
|
|
174
389
|
value: string2(),
|
|
175
390
|
children: string2()
|
|
@@ -196,7 +411,8 @@ var FIELD_CHILDREN_ARRAY = [
|
|
|
196
411
|
DropdownStruct,
|
|
197
412
|
RadioGroupStruct,
|
|
198
413
|
FileInputStruct,
|
|
199
|
-
CheckboxStruct
|
|
414
|
+
CheckboxStruct,
|
|
415
|
+
SelectorStruct
|
|
200
416
|
];
|
|
201
417
|
var FieldChildUnionStruct = nullUnion([
|
|
202
418
|
...FIELD_CHILDREN_ARRAY,
|
|
@@ -283,28 +499,33 @@ var ValueStruct = element("Value", {
|
|
|
283
499
|
value: string2(),
|
|
284
500
|
extra: string2()
|
|
285
501
|
});
|
|
286
|
-
var CardStruct = element("Card", {
|
|
287
|
-
image: optional(string2()),
|
|
288
|
-
title: string2(),
|
|
289
|
-
description: optional(string2()),
|
|
290
|
-
value: string2(),
|
|
291
|
-
extra: optional(string2())
|
|
292
|
-
});
|
|
293
502
|
var HeadingStruct = element("Heading", {
|
|
294
503
|
children: StringElementStruct
|
|
295
504
|
});
|
|
296
|
-
var ImageStruct = element("Image", {
|
|
297
|
-
src: svg(),
|
|
298
|
-
alt: optional(string2())
|
|
299
|
-
});
|
|
300
505
|
var LinkStruct = element("Link", {
|
|
301
506
|
href: string2(),
|
|
302
507
|
children: children([FormattingStruct, string2()])
|
|
303
508
|
});
|
|
304
509
|
var TextStruct = element("Text", {
|
|
305
|
-
children: children([
|
|
510
|
+
children: children([
|
|
511
|
+
string2(),
|
|
512
|
+
BoldStruct,
|
|
513
|
+
ItalicStruct,
|
|
514
|
+
LinkStruct,
|
|
515
|
+
IconStruct
|
|
516
|
+
]),
|
|
306
517
|
alignment: optional(
|
|
307
518
|
nullUnion([literal("start"), literal("center"), literal("end")])
|
|
519
|
+
),
|
|
520
|
+
color: optional(
|
|
521
|
+
nullUnion([
|
|
522
|
+
literal("default"),
|
|
523
|
+
literal("alternative"),
|
|
524
|
+
literal("muted"),
|
|
525
|
+
literal("error"),
|
|
526
|
+
literal("success"),
|
|
527
|
+
literal("warning")
|
|
528
|
+
])
|
|
308
529
|
)
|
|
309
530
|
});
|
|
310
531
|
var TooltipChildStruct = nullUnion([
|
|
@@ -313,6 +534,7 @@ var TooltipChildStruct = nullUnion([
|
|
|
313
534
|
ItalicStruct,
|
|
314
535
|
LinkStruct,
|
|
315
536
|
ImageStruct,
|
|
537
|
+
IconStruct,
|
|
316
538
|
boolean()
|
|
317
539
|
]);
|
|
318
540
|
var TooltipContentStruct = nullUnion([
|
|
@@ -320,6 +542,7 @@ var TooltipContentStruct = nullUnion([
|
|
|
320
542
|
BoldStruct,
|
|
321
543
|
ItalicStruct,
|
|
322
544
|
LinkStruct,
|
|
545
|
+
IconStruct,
|
|
323
546
|
string2()
|
|
324
547
|
]);
|
|
325
548
|
var TooltipStruct = element("Tooltip", {
|
|
@@ -356,7 +579,9 @@ var BoxChildStruct = typedUnion([
|
|
|
356
579
|
TextStruct,
|
|
357
580
|
TooltipStruct,
|
|
358
581
|
CheckboxStruct,
|
|
359
|
-
CardStruct
|
|
582
|
+
CardStruct,
|
|
583
|
+
IconStruct,
|
|
584
|
+
SelectorStruct
|
|
360
585
|
]);
|
|
361
586
|
var RootJSXElementStruct = nullUnion([
|
|
362
587
|
BoxChildStruct,
|
|
@@ -389,7 +614,10 @@ var JSXElementStruct = typedUnion([
|
|
|
389
614
|
CheckboxStruct,
|
|
390
615
|
FooterStruct,
|
|
391
616
|
ContainerStruct,
|
|
392
|
-
CardStruct
|
|
617
|
+
CardStruct,
|
|
618
|
+
IconStruct,
|
|
619
|
+
SelectorStruct,
|
|
620
|
+
SelectorOptionStruct
|
|
393
621
|
]);
|
|
394
622
|
function isJSXElement(value) {
|
|
395
623
|
return is2(value, JSXElementStruct);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...</>` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","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} from '@metamask/superstruct';\nimport {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg, typedUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport type {\n AddressElement,\n BoldElement,\n BoxElement,\n ButtonElement,\n CheckboxElement,\n CardElement,\n CopyableElement,\n DividerElement,\n DropdownElement,\n OptionElement,\n RadioElement,\n RadioGroupElement,\n FieldElement,\n FormElement,\n HeadingElement,\n ImageElement,\n InputElement,\n ItalicElement,\n JSXElement,\n LinkElement,\n RowElement,\n SpinnerElement,\n StandardFormattingElement,\n TextElement,\n TooltipElement,\n ValueElement,\n FileInputElement,\n ContainerElement,\n FooterElement,\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>> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\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(nullable(nullUnion([...structs, boolean()])));\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 ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: StringElementStruct,\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});\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 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 Button + Input of the Field children.\n */\nconst BUTTON_INPUT = [InputStruct, ButtonStruct] as [\n typeof InputStruct,\n typeof ButtonStruct,\n];\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] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\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 ...BUTTON_INPUT,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BUTTON_INPUT),\n ...FIELD_CHILDREN_ARRAY,\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> = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: HexChecksumAddressStruct,\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});\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 */\nexport const FooterChildStruct = nullUnion([\n tuple([ButtonStruct, ButtonStruct]),\n ButtonStruct,\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 subset of JSX elements that are allowed as children of the Container component.\n * This set should include a single Box or a tuple of a Box and a Footer component.\n */\nexport const ContainerChildStruct = nullUnion([\n tuple([BoxStruct, FooterStruct]),\n BoxStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: ContainerChildStruct,\n },\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 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 HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\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\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([string(), BoldStruct, ItalicStruct, LinkStruct]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\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 = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n boolean(),\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 = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n string(),\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: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\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]);\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 = nullUnion([\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]);\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","import type { AnyStruct, Infer, InferStructTuple } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n is,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport { hasProperty, isPlainObject } from '@metamask/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal<Type extends string | number | boolean>(value: Type) {\n return define<Type>(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union<Head extends AnyStruct, Tail extends AnyStruct[]>([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer<Head> | InferStructTuple<Tail>[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue<Type extends string>(\n constant: Type,\n): Struct<EnumToUnion<Type>, null> {\n return literal(constant as EnumToUnion<Type>);\n}\n\n/**\n * Create a custom union struct that validates exclusively based on a `type` field.\n *\n * This should improve error messaging for unions with many structs in them.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function typedUnion<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<Infer<Head> | InferStructTuple<Tail>[number], null> {\n return new Struct({\n type: 'union',\n schema: structs,\n *entries(value, context) {\n if (!isPlainObject(value) || !hasProperty(value, 'type')) {\n return;\n }\n\n const { type } = value;\n const struct = structs.find(({ schema }) => is(type, schema.type));\n\n if (!struct) {\n return;\n }\n\n for (const entry of struct.entries(value, context)) {\n yield entry;\n }\n },\n validator(value, context) {\n const types = structs.map(({ schema }) => schema.type.type);\n\n if (\n !isPlainObject(value) ||\n !hasProperty(value, 'type') ||\n typeof value.type !== 'string'\n ) {\n return `Expected type to be one of: ${types.join(\n ', ',\n )}, but received: undefined`;\n }\n\n const { type } = value;\n\n const struct = structs.find(({ schema }) => is(type, schema.type));\n\n if (struct) {\n // This only validates the root of the struct, entries does the rest of the work.\n return struct.validator(value, context);\n }\n\n return `Expected type to be one of: ${types.join(\n ', ',\n )}, but received: \"${type}\"`;\n },\n }) as unknown as Struct<Infer<Head> | InferStructTuple<Tail>[number], null>;\n}\n","import type {\n AnyStruct,\n EnumSchema,\n Infer,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n Struct,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion<Type> = [Type] extends [UnionToIntersection<Type>] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema<Type> = IsUnion<Type> extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch<Type, string | undefined | null>]\n ? null\n : [Type] extends [IsUnion<Type>]\n ? EnumSchema<Type>\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch<Type, number | undefined | null>]\n ? null\n : [Type] extends [IsUnion<Type>]\n ? EnumSchema<Type>\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch<Type, boolean>]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n | Promise<any>\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple<Type>\n ? null\n : Struct<E>\n : Type extends object\n ? Type extends IsRecord<Type>\n ? null\n : {\n [InnerKey in keyof Type]: Describe<Type[InnerKey]>;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe<Type> = Struct<Type, StructSchema<Type>>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<Infer<Head> | InferStructTuple<Tail>[number], null> {\n return union(structs) as unknown as Struct<\n Infer<Head> | InferStructTuple<Tail>[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('<svg')) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;AClCA;AAAA,EACE,MAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAC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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB,UAAU;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAKM,IAAM,mBAAyC,WAAW;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAOC,IAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AIzlBO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["is","string","hasProperty","isPlainObject","string","is","element"]}
|
|
1
|
+
{"version":3,"sources":["../../src/jsx/jsx-runtime.ts","../../src/jsx/validation.ts","../../src/internals/structs.ts","../../src/internals/jsx.ts","../../src/internals/svg.ts","../../src/jsx/component.ts","../../src/jsx/components/Icon.ts","../../src/jsx/jsx-dev-runtime.ts"],"sourcesContent":["import type { JsonObject, Key, SnapComponent } from './component';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsx<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n if (typeof component === 'string') {\n // If component is a string, it is a built-in HTML element. This is not\n // supported in Snaps, so we throw an error.\n throw new Error(\n `An HTML element (\"${String(\n component,\n )}\") was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.`,\n );\n }\n\n if (!component) {\n // If component is undefined, a JSX fragment `<>...</>` was used, which is\n // not supported in Snaps.\n throw new Error(\n 'A JSX fragment was used in a Snap component, which is not supported by Snaps UI. Please use one of the supported Snap components.',\n );\n }\n\n return component({ ...props, key });\n}\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * The `jsxs` function is used for rendering nested components.\n *\n * This is the \"production\" version of the runtime, which does not include\n * additional validation, as it is handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use `react-jsx`\n * as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxs<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n return jsx(component, props, key);\n}\n","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} from '@metamask/superstruct';\nimport {\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport { literal, nullUnion, svg, typedUnion } from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\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 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>> = nullUnion([\n struct,\n array(lazy(() => nestableStruct)),\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(nullable(nullUnion([...structs, boolean()])));\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});\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: nullUnion([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 Button + Input of the Field children.\n */\nconst BUTTON_INPUT = [InputStruct, ButtonStruct] as [\n typeof InputStruct,\n typeof ButtonStruct,\n];\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 ...BUTTON_INPUT,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BUTTON_INPUT),\n ...FIELD_CHILDREN_ARRAY,\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> = nullUnion([\n BoldStruct,\n ItalicStruct,\n]);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: HexChecksumAddressStruct,\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});\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 */\nexport const FooterChildStruct = nullUnion([\n tuple([ButtonStruct, ButtonStruct]),\n ButtonStruct,\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 subset of JSX elements that are allowed as children of the Container component.\n * This set should include a single Box or a tuple of a Box and a Footer component.\n */\nexport const ContainerChildStruct = nullUnion([\n tuple([BoxStruct, FooterStruct]),\n BoxStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: ContainerChildStruct,\n },\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});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n string(),\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\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 = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n boolean(),\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 = nullUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n string(),\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: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\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]);\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 = nullUnion([\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]);\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","import type { AnyStruct, Infer, InferStructTuple } from '@metamask/superstruct';\nimport {\n Struct,\n define,\n is,\n literal as superstructLiteral,\n union as superstructUnion,\n} from '@metamask/superstruct';\nimport { hasProperty, isPlainObject } from '@metamask/utils';\n\nimport type { EnumToUnion } from './helpers';\n\n/**\n * A wrapper of `superstruct`'s `literal` struct that also defines the name of\n * the struct as the literal value.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n * For example, instead of returning an error like:\n *\n * ```\n * Expected the value to satisfy a union of `literal | literal`, but received: \\\"baz\\\"\n * ```\n *\n * This struct will return an error like:\n *\n * ```\n * Expected the value to satisfy a union of `\"foo\" | \"bar\"`, but received: \\\"baz\\\"\n * ```\n *\n * @param value - The literal value.\n * @returns The `superstruct` struct, which validates that the value is equal\n * to the literal value.\n */\nexport function literal<Type extends string | number | boolean>(value: Type) {\n return define<Type>(\n JSON.stringify(value),\n superstructLiteral(value).validator,\n );\n}\n\n/**\n * A wrapper of `superstruct`'s `union` struct that also defines the schema as\n * the union of the schemas of the structs.\n *\n * This is useful for improving the error messages returned by `superstruct`.\n *\n * @param structs - The structs to union.\n * @param structs.\"0\" - The first struct.\n * @param structs.\"1\" - The remaining structs.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function union<Head extends AnyStruct, Tail extends AnyStruct[]>([\n head,\n ...tail\n]: [head: Head, ...tail: Tail]): Struct<\n Infer<Head> | InferStructTuple<Tail>[number],\n [head: Head, ...tail: Tail]\n> {\n const struct = superstructUnion([head, ...tail]);\n\n return new Struct({\n ...struct,\n schema: [head, ...tail],\n });\n}\n\n/**\n * Superstruct struct for validating an enum value. This allows using both the\n * enum string values and the enum itself as values.\n *\n * @param constant - The enum to validate against.\n * @returns The superstruct struct.\n */\nexport function enumValue<Type extends string>(\n constant: Type,\n): Struct<EnumToUnion<Type>, null> {\n return literal(constant as EnumToUnion<Type>);\n}\n\n/**\n * Create a custom union struct that validates exclusively based on a `type` field.\n *\n * This should improve error messaging for unions with many structs in them.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function typedUnion<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<Infer<Head> | InferStructTuple<Tail>[number], null> {\n return new Struct({\n type: 'union',\n schema: structs,\n *entries(value, context) {\n if (!isPlainObject(value) || !hasProperty(value, 'type')) {\n return;\n }\n\n const { type } = value;\n const struct = structs.find(({ schema }) => is(type, schema.type));\n\n if (!struct) {\n return;\n }\n\n for (const entry of struct.entries(value, context)) {\n yield entry;\n }\n },\n validator(value, context) {\n const types = structs.map(({ schema }) => schema.type.type);\n\n if (\n !isPlainObject(value) ||\n !hasProperty(value, 'type') ||\n typeof value.type !== 'string'\n ) {\n return `Expected type to be one of: ${types.join(\n ', ',\n )}, but received: undefined`;\n }\n\n const { type } = value;\n\n const struct = structs.find(({ schema }) => is(type, schema.type));\n\n if (struct) {\n // This only validates the root of the struct, entries does the rest of the work.\n return struct.validator(value, context);\n }\n\n return `Expected type to be one of: ${types.join(\n ', ',\n )}, but received: \"${type}\"`;\n },\n }) as unknown as Struct<Infer<Head> | InferStructTuple<Tail>[number], null>;\n}\n","import type {\n AnyStruct,\n EnumSchema,\n Infer,\n InferStructTuple,\n IsExactMatch,\n IsMatch,\n IsRecord,\n IsTuple,\n Struct,\n UnionToIntersection,\n} from '@metamask/superstruct';\n\nimport type { EmptyObject } from '../types';\nimport { union } from './structs';\n\n/**\n * Check if a type is a union. Infers `true` if it is a union, otherwise\n * `false`.\n */\ntype IsUnion<Type> = [Type] extends [UnionToIntersection<Type>] ? false : true;\n\n/**\n * Get a struct schema for a type.\n *\n * This is copied from `superstruct` but fixes some issues with the original\n * implementation.\n */\ntype StructSchema<Type> = IsUnion<Type> extends true\n ? null\n : [Type] extends [EmptyObject]\n ? EmptyObject\n : [Type] extends [string | undefined | null]\n ? [Type] extends [`0x${string}`]\n ? null\n : [Type] extends [IsMatch<Type, string | undefined | null>]\n ? null\n : [Type] extends [IsUnion<Type>]\n ? EnumSchema<Type>\n : Type\n : [Type] extends [number | undefined | null]\n ? [Type] extends [IsMatch<Type, number | undefined | null>]\n ? null\n : [Type] extends [IsUnion<Type>]\n ? EnumSchema<Type>\n : Type\n : [Type] extends [boolean]\n ? [Type] extends [IsExactMatch<Type, boolean>]\n ? null\n : Type\n : Type extends\n | bigint\n | symbol\n | undefined\n | null\n // eslint-disable-next-line @typescript-eslint/ban-types\n | Function\n | Date\n | Error\n | RegExp\n | Map<any, any>\n | WeakMap<any, any>\n | Set<any>\n | WeakSet<any>\n | Promise<any>\n ? null\n : Type extends (infer E)[]\n ? Type extends IsTuple<Type>\n ? null\n : Struct<E>\n : Type extends object\n ? Type extends IsRecord<Type>\n ? null\n : {\n [InnerKey in keyof Type]: Describe<Type[InnerKey]>;\n }\n : null;\n\n/**\n * Describe a struct type.\n */\nexport type Describe<Type> = Struct<Type, StructSchema<Type>>;\n\n/**\n * Create a union struct that uses `null` for the schema type, for better\n * compatibility with `Describe`.\n *\n * @param structs - The structs to union.\n * @returns The `superstruct` struct, which validates that the value satisfies\n * one of the structs.\n */\nexport function nullUnion<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<Infer<Head> | InferStructTuple<Tail>[number], null> {\n return union(structs) as unknown as Struct<\n Infer<Head> | InferStructTuple<Tail>[number],\n null\n >;\n}\n","import { refine, string } from '@metamask/superstruct';\n\n/**\n * Get a Struct that validates a string as a valid SVG.\n *\n * @returns A Struct that validates a string as a valid SVG.\n * @internal\n */\nexport function svg() {\n return refine(string(), 'SVG', (value) => {\n // This validation is intentionally very basic, we don't need to be that strict\n // and merely have this extra validation as a helpful error if devs aren't\n // passing in SVGs.\n if (!value.includes('<svg')) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\n","import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record<string, Json>;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable<string>;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable<Type> = Type | Nestable<Type>[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren<Type> = Nestable<Type | boolean | null>;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren<GenericSnapElement | string>;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren<string>;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement<Props, Type>;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps<Props extends JsonObject>(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n>(type: Type): SnapComponent<Props, Type> {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n","import { createSnapComponent } from '../component';\n\n// Copied from https://github.com/MetaMask/metamask-extension/blob/develop/ui/components/component-library/icon/icon.types.ts\n// Currently requires manual syncing when new icon is added.\nexport enum IconName {\n AddSquare = 'add-square',\n Add = 'add',\n Arrow2Down = 'arrow-2-down',\n Arrow2Left = 'arrow-2-left',\n Arrow2Right = 'arrow-2-right',\n Arrow2Up = 'arrow-2-up',\n Arrow2UpRight = 'arrow-2-up-right',\n ArrowDoubleLeft = 'arrow-double-left',\n ArrowDoubleRight = 'arrow-double-right',\n ArrowDown = 'arrow-down',\n ArrowLeft = 'arrow-left',\n ArrowRight = 'arrow-right',\n ArrowUp = 'arrow-up',\n BankToken = 'bank-token',\n Bank = 'bank',\n Book = 'book',\n Bookmark = 'bookmark',\n Bridge = 'bridge',\n Calculator = 'calculator',\n CardPos = 'card-pos',\n CardToken = 'card-token',\n Card = 'card',\n Category = 'category',\n Chart = 'chart',\n CheckBold = 'check-bold',\n Check = 'check',\n Clock = 'clock',\n Close = 'close',\n CodeCircle = 'code-circle',\n Coin = 'coin',\n Confirmation = 'confirmation',\n Connect = 'connect',\n CopySuccess = 'copy-success',\n Copy = 'copy',\n Customize = 'customize',\n Danger = 'danger',\n Dark = 'dark',\n Data = 'data',\n Diagram = 'diagram',\n DocumentCode = 'document-code',\n DragDrop = 'drag-drop',\n DraggingAnimation = 'dragging-animation',\n PinningAnimation = 'pinning-animation',\n Edit = 'edit',\n Eraser = 'eraser',\n Ethereum = 'ethereum',\n Expand = 'expand',\n Explore = 'explore',\n Export = 'export',\n EyeSlash = 'eye-slash',\n Eye = 'eye',\n Filter = 'filter',\n Flag = 'flag',\n FlashSlash = 'flash-slash',\n Flash = 'flash',\n FullCircle = 'full-circle',\n Gas = 'gas',\n GlobalSearch = 'global-search',\n Global = 'global',\n Graph = 'graph',\n Hardware = 'hardware',\n Heart = 'heart',\n Hierarchy = 'hierarchy',\n Home = 'home',\n Import = 'import',\n Info = 'info',\n Key = 'key',\n Light = 'light',\n Link = 'link',\n Loading = 'loading',\n LockCircle = 'lock-circle',\n LockSlash = 'lock-slash',\n Lock = 'lock',\n Login = 'login',\n Logout = 'logout',\n Menu = 'menu',\n MessageQuestion = 'message-question',\n Messages = 'messages',\n MinusBold = 'minus-bold',\n MinusSquare = 'minus-square',\n Minus = 'minus',\n Mobile = 'mobile',\n Money = 'money',\n Monitor = 'monitor',\n MoreHorizontal = 'more-horizontal',\n MoreVertical = 'more-vertical',\n NotificationCircle = 'notification-circle',\n Notification = 'notification',\n PasswordCheck = 'password-check',\n People = 'people',\n Pin = 'pin',\n ProgrammingArrows = 'programming-arrows',\n Custody = 'custody',\n Question = 'question',\n Received = 'received',\n Refresh = 'refresh',\n Save = 'save',\n ScanBarcode = 'scan-barcode',\n ScanFocus = 'scan-focus',\n Scan = 'scan',\n Scroll = 'scroll',\n Search = 'search',\n SecurityCard = 'security-card',\n SecurityCross = 'security-cross',\n SecurityKey = 'security-key',\n SecuritySearch = 'security-search',\n SecuritySlash = 'security-slash',\n SecurityTick = 'security-tick',\n SecurityTime = 'security-time',\n SecurityUser = 'security-user',\n Security = 'security',\n Send1 = 'send-1',\n Send2 = 'send-2',\n Setting = 'setting',\n Slash = 'slash',\n SnapsMobile = 'snaps-mobile',\n SnapsPlus = 'snaps-plus',\n Snaps = 'snaps',\n Speedometer = 'speedometer',\n Star = 'star',\n Stake = 'stake',\n Student = 'student',\n SwapHorizontal = 'swap-horizontal',\n SwapVertical = 'swap-vertical',\n Tag = 'tag',\n Tilde = 'tilde',\n Timer = 'timer',\n Trash = 'trash',\n TrendDown = 'trend-down',\n TrendUp = 'trend-up',\n UserCircleAdd = 'user-circle-add',\n UserCircleLink = 'user-circle-link',\n UserCircleRemove = 'user-circle-remove',\n UserCircle = 'user-circle',\n User = 'user',\n WalletCard = 'wallet-card',\n WalletMoney = 'wallet-money',\n Wallet = 'wallet',\n Warning = 'warning',\n Twitter = 'twitter',\n QrCode = 'qr-code',\n UserCheck = 'user-check',\n Unpin = 'unpin',\n Ban = 'ban',\n Bold = 'bold',\n CircleX = 'circle-x',\n Download = 'download',\n FileIcon = 'file',\n Flask = 'flask',\n Plug = 'plug',\n Share = 'share',\n Square = 'square',\n Tint = 'tint',\n Upload = 'upload',\n Usb = 'usb',\n Wifi = 'wifi',\n PlusMinus = 'plus-minus',\n}\n\n/**\n * The props of the {@link Icon} component.\n *\n * @property name - The name of the icon to display from a pre-defined list.\n * @property color - The color of the displayed icon.\n * @property size - The size of the displayed icon. Use `inherit` to size it the same as the text.\n */\nexport type IconProps = {\n name: `${IconName}`;\n color?: 'default' | 'primary' | 'muted' | undefined;\n size?: 'md' | 'inherit' | undefined;\n};\n\nconst TYPE = 'Icon';\n\n/**\n * An icon component which is used to display an icon from a pre-defined list.\n *\n * @param props - The props of the component.\n * @param props.name - The name of the icon to display from a pre-defined list.\n * @param props.color - The color of the displayed icon.\n * @param props.size - The size of the displayed icon. Use `inherit` to size it the same as the text.\n * @returns An icon element.\n * @example\n * <Icon name=\"warning\" color=\"warning\" size=\"md\" />\n */\nexport const Icon = createSnapComponent<IconProps, typeof TYPE>(TYPE);\n\n/**\n * An icon element.\n *\n * @see Icon\n */\nexport type IconElement = ReturnType<typeof Icon>;\n","import type { JsonObject, Key, SnapComponent } from './component';\nimport { jsx } from './jsx-runtime';\nimport { assertJSXElement } from './validation';\n\n/**\n * The JSX runtime for Snaps SDK components. This function is used to render\n * Snap components into a format that can be used by the Snaps.\n *\n * This is the \"development\" version of the runtime, which includes additional\n * validation, which is otherwise handled by MetaMask. To use this runtime,\n * specify `@metamask/snaps-sdk` as import source for JSX, and use\n * `react-jsxdev` as the pragma.\n *\n * @param component - The component to render.\n * @param props - The props to pass to the component.\n * @param key - The key of the component.\n * @returns The rendered component.\n * @see https://www.typescriptlang.org/tsconfig/#jsx\n */\nexport function jsxDEV<Props extends JsonObject>(\n component: SnapComponent<Props>,\n props: Props,\n key: Key | null,\n): unknown | null {\n const element = jsx(component, props, key);\n assertJSXElement(element);\n\n return element;\n}\n"],"mappings":";AAiBO,SAAS,IACd,WACA,OACA,KACgB;AAChB,MAAI,OAAO,cAAc,UAAU;AAGjC,UAAM,IAAI;AAAA,MACR,qBAAqB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AAGd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAU,EAAE,GAAG,OAAO,IAAI,CAAC;AACpC;;;AClCA;AAAA,EACE,MAAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAAC;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE,eAAAC;AAAA,EACA;AAAA,EACA,iBAAAC;AAAA,EACA;AAAA,OACK;;;ACxBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,OACJ;AACP,SAAS,aAAa,qBAAqB;AAyBpC,SAAS,QAAgD,OAAa;AAC3E,SAAO;AAAA,IACL,KAAK,UAAU,KAAK;AAAA,IACpB,mBAAmB,KAAK,EAAE;AAAA,EAC5B;AACF;AAcO,SAAS,MAAwD;AAAA,EACtE;AAAA,EACA,GAAG;AACL,GAGE;AACA,QAAM,SAAS,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC;AAE/C,SAAO,IAAI,OAAO;AAAA,IAChB,GAAG;AAAA,IACH,QAAQ,CAAC,MAAM,GAAG,IAAI;AAAA,EACxB,CAAC;AACH;AAwBO,SAAS,WACd,SAC4D;AAC5D,SAAO,IAAI,OAAO;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A;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAuB,UAAU;AAAA,EAC5C;AAAA,EACA;AACF,CAAC;AAKM,IAAM,mBAAyC,WAAW;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAQM,SAAS,aAAa,OAAqC;AAChE,SAAOC,IAAG,OAAO,gBAAgB;AACnC;AA4BO,SAAS,iBAAiB,OAA6C;AAI5E,MAAI,CAAC,aAAa,KAAK,GAAG;AACxB,UAAM,IAAI;AAAA,MACR,wCAAwC,KAAK;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;;;AM1pBO,SAAS,OACd,WACA,OACA,KACgB;AAChB,QAAMC,WAAU,IAAI,WAAW,OAAO,GAAG;AACzC,mBAAiBA,QAAO;AAExB,SAAOA;AACT;","names":["is","string","hasProperty","isPlainObject","IconName","string","is","element"]}
|