@metamask/snaps-sdk 5.0.0 → 6.1.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 +35 -1
- package/dist/index.js +226 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +261 -89
- package/dist/index.mjs.map +1 -1
- package/dist/jsx/index.js +237 -89
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +243 -94
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js +167 -51
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.mjs +173 -56
- package/dist/jsx/jsx-dev-runtime.mjs.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/internals/jsx.d.ts +2 -3
- package/dist/types/internals/structs.d.ts +12 -3
- package/dist/types/internals/svg.d.ts +1 -1
- package/dist/types/jsx/component.d.ts +6 -9
- package/dist/types/jsx/components/Box.d.ts +4 -4
- package/dist/types/jsx/components/Card.d.ts +36 -0
- package/dist/types/jsx/components/Container.d.ts +34 -0
- package/dist/types/jsx/components/Footer.d.ts +28 -0
- package/dist/types/jsx/components/Link.d.ts +2 -2
- package/dist/types/jsx/components/Row.d.ts +1 -1
- package/dist/types/jsx/components/Text.d.ts +7 -2
- package/dist/types/jsx/components/Tooltip.d.ts +38 -0
- package/dist/types/jsx/components/form/Checkbox.d.ts +35 -0
- package/dist/types/jsx/components/form/Dropdown.d.ts +4 -5
- package/dist/types/jsx/components/form/Field.d.ts +7 -1
- package/dist/types/jsx/components/form/FileInput.d.ts +47 -0
- package/dist/types/jsx/components/form/Form.d.ts +4 -7
- package/dist/types/jsx/components/form/Input.d.ts +1 -2
- package/dist/types/jsx/components/form/index.d.ts +5 -1
- package/dist/types/jsx/components/formatting/Bold.d.ts +2 -2
- package/dist/types/jsx/components/formatting/Italic.d.ts +2 -2
- package/dist/types/jsx/components/index.d.ts +9 -1
- package/dist/types/jsx/index.d.ts +1 -1
- package/dist/types/jsx/validation.d.ts +67 -40
- package/dist/types/types/handlers/user-input.d.ts +140 -25
- package/dist/types/types/interface.d.ts +32 -24
- package/dist/types/types/methods/dialog.d.ts +8 -2
- package/dist/types/types/methods/index.d.ts +1 -0
- package/dist/types/types/methods/methods.d.ts +2 -0
- package/dist/types/types/methods/resolve-interface.d.ts +15 -0
- package/dist/types/ui/builder.d.ts +1 -1
- package/dist/types/ui/components/address.d.ts +4 -4
- package/dist/types/ui/components/button.d.ts +7 -7
- package/dist/types/ui/components/copyable.d.ts +5 -5
- package/dist/types/ui/components/divider.d.ts +3 -3
- package/dist/types/ui/components/form.d.ts +7 -7
- package/dist/types/ui/components/heading.d.ts +4 -4
- package/dist/types/ui/components/image.d.ts +4 -4
- package/dist/types/ui/components/input.d.ts +9 -9
- package/dist/types/ui/components/panel.d.ts +1 -1
- package/dist/types/ui/components/row.d.ts +6 -6
- package/dist/types/ui/components/spinner.d.ts +3 -3
- package/dist/types/ui/components/text.d.ts +5 -5
- package/dist/types/ui/nodes.d.ts +6 -6
- package/package.json +6 -6
package/dist/jsx/index.mjs
CHANGED
|
@@ -19,77 +19,101 @@ function createSnapComponent(type) {
|
|
|
19
19
|
var TYPE = "Button";
|
|
20
20
|
var Button = createSnapComponent(TYPE);
|
|
21
21
|
|
|
22
|
+
// src/jsx/components/form/Checkbox.ts
|
|
23
|
+
var TYPE2 = "Checkbox";
|
|
24
|
+
var Checkbox = createSnapComponent(TYPE2);
|
|
25
|
+
|
|
22
26
|
// src/jsx/components/form/Dropdown.ts
|
|
23
|
-
var
|
|
24
|
-
var Dropdown = createSnapComponent(
|
|
27
|
+
var TYPE3 = "Dropdown";
|
|
28
|
+
var Dropdown = createSnapComponent(TYPE3);
|
|
25
29
|
|
|
26
30
|
// src/jsx/components/form/Option.ts
|
|
27
|
-
var
|
|
28
|
-
var Option = createSnapComponent(
|
|
31
|
+
var TYPE4 = "Option";
|
|
32
|
+
var Option = createSnapComponent(TYPE4);
|
|
29
33
|
|
|
30
34
|
// src/jsx/components/form/Field.ts
|
|
31
|
-
var
|
|
32
|
-
var Field = createSnapComponent(
|
|
35
|
+
var TYPE5 = "Field";
|
|
36
|
+
var Field = createSnapComponent(TYPE5);
|
|
37
|
+
|
|
38
|
+
// src/jsx/components/form/FileInput.ts
|
|
39
|
+
var TYPE6 = "FileInput";
|
|
40
|
+
var FileInput = createSnapComponent(TYPE6);
|
|
33
41
|
|
|
34
42
|
// src/jsx/components/form/Form.ts
|
|
35
|
-
var
|
|
36
|
-
var Form = createSnapComponent(
|
|
43
|
+
var TYPE7 = "Form";
|
|
44
|
+
var Form = createSnapComponent(TYPE7);
|
|
37
45
|
|
|
38
46
|
// src/jsx/components/form/Input.ts
|
|
39
|
-
var
|
|
40
|
-
var Input = createSnapComponent(
|
|
47
|
+
var TYPE8 = "Input";
|
|
48
|
+
var Input = createSnapComponent(TYPE8);
|
|
41
49
|
|
|
42
50
|
// src/jsx/components/formatting/Bold.ts
|
|
43
|
-
var
|
|
44
|
-
var Bold = createSnapComponent(
|
|
51
|
+
var TYPE9 = "Bold";
|
|
52
|
+
var Bold = createSnapComponent(TYPE9);
|
|
45
53
|
|
|
46
54
|
// src/jsx/components/formatting/Italic.ts
|
|
47
|
-
var
|
|
48
|
-
var Italic = createSnapComponent(
|
|
55
|
+
var TYPE10 = "Italic";
|
|
56
|
+
var Italic = createSnapComponent(TYPE10);
|
|
49
57
|
|
|
50
58
|
// src/jsx/components/Address.ts
|
|
51
|
-
var
|
|
52
|
-
var Address = createSnapComponent(
|
|
59
|
+
var TYPE11 = "Address";
|
|
60
|
+
var Address = createSnapComponent(TYPE11);
|
|
53
61
|
|
|
54
62
|
// src/jsx/components/Box.ts
|
|
55
|
-
var
|
|
56
|
-
var Box = createSnapComponent(
|
|
63
|
+
var TYPE12 = "Box";
|
|
64
|
+
var Box = createSnapComponent(TYPE12);
|
|
65
|
+
|
|
66
|
+
// src/jsx/components/Card.ts
|
|
67
|
+
var TYPE13 = "Card";
|
|
68
|
+
var Card = createSnapComponent(TYPE13);
|
|
57
69
|
|
|
58
70
|
// src/jsx/components/Copyable.ts
|
|
59
|
-
var
|
|
60
|
-
var Copyable = createSnapComponent(
|
|
71
|
+
var TYPE14 = "Copyable";
|
|
72
|
+
var Copyable = createSnapComponent(TYPE14);
|
|
61
73
|
|
|
62
74
|
// src/jsx/components/Divider.ts
|
|
63
|
-
var
|
|
64
|
-
var Divider = createSnapComponent(
|
|
75
|
+
var TYPE15 = "Divider";
|
|
76
|
+
var Divider = createSnapComponent(TYPE15);
|
|
65
77
|
|
|
66
78
|
// src/jsx/components/Value.ts
|
|
67
|
-
var
|
|
68
|
-
var Value = createSnapComponent(
|
|
79
|
+
var TYPE16 = "Value";
|
|
80
|
+
var Value = createSnapComponent(TYPE16);
|
|
69
81
|
|
|
70
82
|
// src/jsx/components/Heading.ts
|
|
71
|
-
var
|
|
72
|
-
var Heading = createSnapComponent(
|
|
83
|
+
var TYPE17 = "Heading";
|
|
84
|
+
var Heading = createSnapComponent(TYPE17);
|
|
73
85
|
|
|
74
86
|
// src/jsx/components/Image.ts
|
|
75
|
-
var
|
|
76
|
-
var Image = createSnapComponent(
|
|
87
|
+
var TYPE18 = "Image";
|
|
88
|
+
var Image = createSnapComponent(TYPE18);
|
|
77
89
|
|
|
78
90
|
// src/jsx/components/Link.ts
|
|
79
|
-
var
|
|
80
|
-
var Link = createSnapComponent(
|
|
91
|
+
var TYPE19 = "Link";
|
|
92
|
+
var Link = createSnapComponent(TYPE19);
|
|
81
93
|
|
|
82
94
|
// src/jsx/components/Row.ts
|
|
83
|
-
var
|
|
84
|
-
var Row = createSnapComponent(
|
|
95
|
+
var TYPE20 = "Row";
|
|
96
|
+
var Row = createSnapComponent(TYPE20);
|
|
85
97
|
|
|
86
98
|
// src/jsx/components/Spinner.ts
|
|
87
|
-
var
|
|
88
|
-
var Spinner = createSnapComponent(
|
|
99
|
+
var TYPE21 = "Spinner";
|
|
100
|
+
var Spinner = createSnapComponent(TYPE21);
|
|
89
101
|
|
|
90
102
|
// src/jsx/components/Text.ts
|
|
91
|
-
var
|
|
92
|
-
var Text = createSnapComponent(
|
|
103
|
+
var TYPE22 = "Text";
|
|
104
|
+
var Text = createSnapComponent(TYPE22);
|
|
105
|
+
|
|
106
|
+
// src/jsx/components/Tooltip.ts
|
|
107
|
+
var TYPE23 = "Tooltip";
|
|
108
|
+
var Tooltip = createSnapComponent(TYPE23);
|
|
109
|
+
|
|
110
|
+
// src/jsx/components/Footer.ts
|
|
111
|
+
var TYPE24 = "Footer";
|
|
112
|
+
var Footer = createSnapComponent(TYPE24);
|
|
113
|
+
|
|
114
|
+
// src/jsx/components/Container.ts
|
|
115
|
+
var TYPE25 = "Container";
|
|
116
|
+
var Container = createSnapComponent(TYPE25);
|
|
93
117
|
|
|
94
118
|
// src/jsx/jsx-runtime.ts
|
|
95
119
|
function jsx(component, props, key) {
|
|
@@ -113,13 +137,7 @@ function jsxs(component, props, key) {
|
|
|
113
137
|
|
|
114
138
|
// src/jsx/validation.ts
|
|
115
139
|
import {
|
|
116
|
-
|
|
117
|
-
HexChecksumAddressStruct,
|
|
118
|
-
isPlainObject,
|
|
119
|
-
JsonStruct
|
|
120
|
-
} from "@metamask/utils";
|
|
121
|
-
import {
|
|
122
|
-
is,
|
|
140
|
+
is as is2,
|
|
123
141
|
boolean,
|
|
124
142
|
optional,
|
|
125
143
|
array,
|
|
@@ -130,15 +148,23 @@ import {
|
|
|
130
148
|
record,
|
|
131
149
|
string as string2,
|
|
132
150
|
tuple
|
|
133
|
-
} from "superstruct";
|
|
151
|
+
} from "@metamask/superstruct";
|
|
152
|
+
import {
|
|
153
|
+
hasProperty as hasProperty2,
|
|
154
|
+
HexChecksumAddressStruct,
|
|
155
|
+
isPlainObject as isPlainObject2,
|
|
156
|
+
JsonStruct
|
|
157
|
+
} from "@metamask/utils";
|
|
134
158
|
|
|
135
159
|
// src/internals/structs.ts
|
|
136
160
|
import {
|
|
137
161
|
Struct,
|
|
138
162
|
define,
|
|
163
|
+
is,
|
|
139
164
|
literal as superstructLiteral,
|
|
140
165
|
union as superstructUnion
|
|
141
|
-
} from "superstruct";
|
|
166
|
+
} from "@metamask/superstruct";
|
|
167
|
+
import { hasProperty, isPlainObject } from "@metamask/utils";
|
|
142
168
|
function literal(value) {
|
|
143
169
|
return define(
|
|
144
170
|
JSON.stringify(value),
|
|
@@ -155,6 +181,41 @@ function union([
|
|
|
155
181
|
schema: [head, ...tail]
|
|
156
182
|
});
|
|
157
183
|
}
|
|
184
|
+
function typedUnion(structs) {
|
|
185
|
+
return new Struct({
|
|
186
|
+
type: "union",
|
|
187
|
+
schema: null,
|
|
188
|
+
*entries(value, context) {
|
|
189
|
+
if (!isPlainObject(value) || !hasProperty(value, "type")) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const { type } = value;
|
|
193
|
+
const struct = structs.find(({ schema }) => is(type, schema.type));
|
|
194
|
+
if (!struct) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
for (const entry of struct.entries(value, context)) {
|
|
198
|
+
yield entry;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
validator(value, context) {
|
|
202
|
+
const types = structs.map(({ schema }) => schema.type.type);
|
|
203
|
+
if (!isPlainObject(value) || !hasProperty(value, "type") || typeof value.type !== "string") {
|
|
204
|
+
return `Expected type to be one of: ${types.join(
|
|
205
|
+
", "
|
|
206
|
+
)}, but received: undefined`;
|
|
207
|
+
}
|
|
208
|
+
const { type } = value;
|
|
209
|
+
const struct = structs.find(({ schema }) => is(type, schema.type));
|
|
210
|
+
if (struct) {
|
|
211
|
+
return struct.validator(value, context);
|
|
212
|
+
}
|
|
213
|
+
return `Expected type to be one of: ${types.join(
|
|
214
|
+
", "
|
|
215
|
+
)}, but received: "${type}"`;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
158
219
|
|
|
159
220
|
// src/internals/jsx.ts
|
|
160
221
|
function nullUnion(structs) {
|
|
@@ -162,7 +223,7 @@ function nullUnion(structs) {
|
|
|
162
223
|
}
|
|
163
224
|
|
|
164
225
|
// src/internals/svg.ts
|
|
165
|
-
import { refine, string } from "superstruct";
|
|
226
|
+
import { refine, string } from "@metamask/superstruct";
|
|
166
227
|
function svg() {
|
|
167
228
|
return refine(string(), "SVG", (value) => {
|
|
168
229
|
if (!value.includes("<svg")) {
|
|
@@ -174,9 +235,9 @@ function svg() {
|
|
|
174
235
|
|
|
175
236
|
// src/jsx/validation.ts
|
|
176
237
|
var KeyStruct = nullUnion([string2(), number()]);
|
|
177
|
-
var StringElementStruct =
|
|
238
|
+
var StringElementStruct = children([
|
|
178
239
|
string2()
|
|
179
|
-
);
|
|
240
|
+
]);
|
|
180
241
|
var ElementStruct = object({
|
|
181
242
|
type: string2(),
|
|
182
243
|
props: record(string2(), JsonStruct),
|
|
@@ -189,8 +250,8 @@ function nestable(struct) {
|
|
|
189
250
|
]);
|
|
190
251
|
return nestableStruct;
|
|
191
252
|
}
|
|
192
|
-
function
|
|
193
|
-
return nestable(
|
|
253
|
+
function children(structs) {
|
|
254
|
+
return nestable(nullable(nullUnion([...structs, boolean()])));
|
|
194
255
|
}
|
|
195
256
|
function element(name, props = {}) {
|
|
196
257
|
return object({
|
|
@@ -206,6 +267,12 @@ var ButtonStruct = element("Button", {
|
|
|
206
267
|
variant: optional(nullUnion([literal("primary"), literal("destructive")])),
|
|
207
268
|
disabled: optional(boolean())
|
|
208
269
|
});
|
|
270
|
+
var CheckboxStruct = element("Checkbox", {
|
|
271
|
+
name: string2(),
|
|
272
|
+
checked: optional(boolean()),
|
|
273
|
+
label: optional(string2()),
|
|
274
|
+
variant: optional(nullUnion([literal("default"), literal("toggle")]))
|
|
275
|
+
});
|
|
209
276
|
var InputStruct = element("Input", {
|
|
210
277
|
name: string2(),
|
|
211
278
|
type: optional(
|
|
@@ -221,42 +288,57 @@ var OptionStruct = element("Option", {
|
|
|
221
288
|
var DropdownStruct = element("Dropdown", {
|
|
222
289
|
name: string2(),
|
|
223
290
|
value: optional(string2()),
|
|
224
|
-
children:
|
|
291
|
+
children: children([OptionStruct])
|
|
225
292
|
});
|
|
293
|
+
var FileInputStruct = element(
|
|
294
|
+
"FileInput",
|
|
295
|
+
{
|
|
296
|
+
name: string2(),
|
|
297
|
+
accept: nullUnion([optional(array(string2()))]),
|
|
298
|
+
compact: optional(boolean())
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
var BUTTON_INPUT = [InputStruct, ButtonStruct];
|
|
302
|
+
var FIELD_CHILDREN_ARRAY = [
|
|
303
|
+
InputStruct,
|
|
304
|
+
DropdownStruct,
|
|
305
|
+
FileInputStruct,
|
|
306
|
+
CheckboxStruct
|
|
307
|
+
];
|
|
308
|
+
var FieldChildUnionStruct = nullUnion([
|
|
309
|
+
...FIELD_CHILDREN_ARRAY,
|
|
310
|
+
...BUTTON_INPUT
|
|
311
|
+
]);
|
|
312
|
+
var FieldChildStruct = nullUnion([
|
|
313
|
+
tuple(BUTTON_INPUT),
|
|
314
|
+
...FIELD_CHILDREN_ARRAY
|
|
315
|
+
]);
|
|
226
316
|
var FieldStruct = element("Field", {
|
|
227
317
|
label: optional(string2()),
|
|
228
318
|
error: optional(string2()),
|
|
229
|
-
children:
|
|
230
|
-
tuple([InputStruct, ButtonStruct]),
|
|
231
|
-
InputStruct,
|
|
232
|
-
DropdownStruct
|
|
233
|
-
])
|
|
319
|
+
children: FieldChildStruct
|
|
234
320
|
});
|
|
321
|
+
var FormChildStruct = children(
|
|
322
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
323
|
+
[FieldStruct, lazy(() => BoxChildStruct)]
|
|
324
|
+
);
|
|
235
325
|
var FormStruct = element("Form", {
|
|
236
|
-
children:
|
|
326
|
+
children: FormChildStruct,
|
|
237
327
|
name: string2()
|
|
238
328
|
});
|
|
239
329
|
var BoldStruct = element("Bold", {
|
|
240
|
-
children:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
lazy(() => ItalicStruct)
|
|
246
|
-
])
|
|
247
|
-
)
|
|
248
|
-
)
|
|
330
|
+
children: children([
|
|
331
|
+
string2(),
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
333
|
+
lazy(() => ItalicStruct)
|
|
334
|
+
])
|
|
249
335
|
});
|
|
250
336
|
var ItalicStruct = element("Italic", {
|
|
251
|
-
children:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
lazy(() => BoldStruct)
|
|
257
|
-
])
|
|
258
|
-
)
|
|
259
|
-
)
|
|
337
|
+
children: children([
|
|
338
|
+
string2(),
|
|
339
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
340
|
+
lazy(() => BoldStruct)
|
|
341
|
+
])
|
|
260
342
|
});
|
|
261
343
|
var FormattingStruct = nullUnion([
|
|
262
344
|
BoldStruct,
|
|
@@ -265,11 +347,12 @@ var FormattingStruct = nullUnion([
|
|
|
265
347
|
var AddressStruct = element("Address", {
|
|
266
348
|
address: HexChecksumAddressStruct
|
|
267
349
|
});
|
|
350
|
+
var BoxChildrenStruct = children(
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
352
|
+
[lazy(() => BoxChildStruct)]
|
|
353
|
+
);
|
|
268
354
|
var BoxStruct = element("Box", {
|
|
269
|
-
children:
|
|
270
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
271
|
-
nullable(lazy(() => BoxChildStruct))
|
|
272
|
-
),
|
|
355
|
+
children: BoxChildrenStruct,
|
|
273
356
|
direction: optional(nullUnion([literal("horizontal"), literal("vertical")])),
|
|
274
357
|
alignment: optional(
|
|
275
358
|
nullUnion([
|
|
@@ -281,6 +364,23 @@ var BoxStruct = element("Box", {
|
|
|
281
364
|
])
|
|
282
365
|
)
|
|
283
366
|
});
|
|
367
|
+
var FooterChildStruct = nullUnion([
|
|
368
|
+
tuple([ButtonStruct, ButtonStruct]),
|
|
369
|
+
ButtonStruct
|
|
370
|
+
]);
|
|
371
|
+
var FooterStruct = element("Footer", {
|
|
372
|
+
children: FooterChildStruct
|
|
373
|
+
});
|
|
374
|
+
var ContainerChildStruct = nullUnion([
|
|
375
|
+
tuple([BoxStruct, FooterStruct]),
|
|
376
|
+
BoxStruct
|
|
377
|
+
]);
|
|
378
|
+
var ContainerStruct = element(
|
|
379
|
+
"Container",
|
|
380
|
+
{
|
|
381
|
+
children: ContainerChildStruct
|
|
382
|
+
}
|
|
383
|
+
);
|
|
284
384
|
var CopyableStruct = element("Copyable", {
|
|
285
385
|
value: string2(),
|
|
286
386
|
sensitive: optional(boolean())
|
|
@@ -290,6 +390,13 @@ var ValueStruct = element("Value", {
|
|
|
290
390
|
value: string2(),
|
|
291
391
|
extra: string2()
|
|
292
392
|
});
|
|
393
|
+
var CardStruct = element("Card", {
|
|
394
|
+
image: optional(string2()),
|
|
395
|
+
title: string2(),
|
|
396
|
+
description: optional(string2()),
|
|
397
|
+
value: string2(),
|
|
398
|
+
extra: optional(string2())
|
|
399
|
+
});
|
|
293
400
|
var HeadingStruct = element("Heading", {
|
|
294
401
|
children: StringElementStruct
|
|
295
402
|
});
|
|
@@ -299,13 +406,33 @@ var ImageStruct = element("Image", {
|
|
|
299
406
|
});
|
|
300
407
|
var LinkStruct = element("Link", {
|
|
301
408
|
href: string2(),
|
|
302
|
-
children:
|
|
409
|
+
children: children([FormattingStruct, string2()])
|
|
303
410
|
});
|
|
304
411
|
var TextStruct = element("Text", {
|
|
305
|
-
children:
|
|
306
|
-
|
|
412
|
+
children: children([string2(), BoldStruct, ItalicStruct, LinkStruct]),
|
|
413
|
+
alignment: optional(
|
|
414
|
+
nullUnion([literal("start"), literal("center"), literal("end")])
|
|
307
415
|
)
|
|
308
416
|
});
|
|
417
|
+
var TooltipChildStruct = nullUnion([
|
|
418
|
+
TextStruct,
|
|
419
|
+
BoldStruct,
|
|
420
|
+
ItalicStruct,
|
|
421
|
+
LinkStruct,
|
|
422
|
+
ImageStruct,
|
|
423
|
+
boolean()
|
|
424
|
+
]);
|
|
425
|
+
var TooltipContentStruct = nullUnion([
|
|
426
|
+
TextStruct,
|
|
427
|
+
BoldStruct,
|
|
428
|
+
ItalicStruct,
|
|
429
|
+
LinkStruct,
|
|
430
|
+
string2()
|
|
431
|
+
]);
|
|
432
|
+
var TooltipStruct = element("Tooltip", {
|
|
433
|
+
children: nullable(TooltipChildStruct),
|
|
434
|
+
content: TooltipContentStruct
|
|
435
|
+
});
|
|
309
436
|
var RowStruct = element("Row", {
|
|
310
437
|
label: string2(),
|
|
311
438
|
children: nullUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),
|
|
@@ -315,28 +442,36 @@ var RowStruct = element("Row", {
|
|
|
315
442
|
tooltip: optional(string2())
|
|
316
443
|
});
|
|
317
444
|
var SpinnerStruct = element("Spinner");
|
|
318
|
-
var BoxChildStruct =
|
|
319
|
-
ButtonStruct,
|
|
320
|
-
InputStruct,
|
|
321
|
-
FormStruct,
|
|
322
|
-
BoldStruct,
|
|
323
|
-
ItalicStruct,
|
|
445
|
+
var BoxChildStruct = typedUnion([
|
|
324
446
|
AddressStruct,
|
|
447
|
+
BoldStruct,
|
|
325
448
|
BoxStruct,
|
|
449
|
+
ButtonStruct,
|
|
326
450
|
CopyableStruct,
|
|
327
451
|
DividerStruct,
|
|
452
|
+
DropdownStruct,
|
|
453
|
+
FileInputStruct,
|
|
454
|
+
FormStruct,
|
|
328
455
|
HeadingStruct,
|
|
456
|
+
InputStruct,
|
|
329
457
|
ImageStruct,
|
|
458
|
+
ItalicStruct,
|
|
330
459
|
LinkStruct,
|
|
331
460
|
RowStruct,
|
|
332
461
|
SpinnerStruct,
|
|
333
462
|
TextStruct,
|
|
334
|
-
|
|
463
|
+
TooltipStruct,
|
|
464
|
+
CheckboxStruct,
|
|
465
|
+
CardStruct
|
|
466
|
+
]);
|
|
467
|
+
var RootJSXElementStruct = nullUnion([
|
|
468
|
+
BoxChildStruct,
|
|
469
|
+
ContainerStruct
|
|
335
470
|
]);
|
|
336
|
-
var
|
|
337
|
-
var JSXElementStruct = nullUnion([
|
|
471
|
+
var JSXElementStruct = typedUnion([
|
|
338
472
|
ButtonStruct,
|
|
339
473
|
InputStruct,
|
|
474
|
+
FileInputStruct,
|
|
340
475
|
FieldStruct,
|
|
341
476
|
FormStruct,
|
|
342
477
|
BoldStruct,
|
|
@@ -353,13 +488,18 @@ var JSXElementStruct = nullUnion([
|
|
|
353
488
|
TextStruct,
|
|
354
489
|
DropdownStruct,
|
|
355
490
|
OptionStruct,
|
|
356
|
-
ValueStruct
|
|
491
|
+
ValueStruct,
|
|
492
|
+
TooltipStruct,
|
|
493
|
+
CheckboxStruct,
|
|
494
|
+
FooterStruct,
|
|
495
|
+
ContainerStruct,
|
|
496
|
+
CardStruct
|
|
357
497
|
]);
|
|
358
498
|
function isJSXElement(value) {
|
|
359
|
-
return
|
|
499
|
+
return is2(value, JSXElementStruct);
|
|
360
500
|
}
|
|
361
501
|
function isJSXElementUnsafe(value) {
|
|
362
|
-
return
|
|
502
|
+
return isPlainObject2(value) && hasProperty2(value, "type") && hasProperty2(value, "props") && hasProperty2(value, "key");
|
|
363
503
|
}
|
|
364
504
|
function assertJSXElement(value) {
|
|
365
505
|
if (!isJSXElement(value)) {
|
|
@@ -381,12 +521,20 @@ export {
|
|
|
381
521
|
Address,
|
|
382
522
|
Bold,
|
|
383
523
|
Box,
|
|
524
|
+
BoxChildStruct,
|
|
384
525
|
Button,
|
|
526
|
+
Card,
|
|
527
|
+
Checkbox,
|
|
528
|
+
Container,
|
|
385
529
|
Copyable,
|
|
386
530
|
Divider,
|
|
387
531
|
Dropdown,
|
|
388
532
|
Field,
|
|
533
|
+
FieldChildUnionStruct,
|
|
534
|
+
FileInput,
|
|
535
|
+
Footer,
|
|
389
536
|
Form,
|
|
537
|
+
FormChildStruct,
|
|
390
538
|
Heading,
|
|
391
539
|
Image,
|
|
392
540
|
Input,
|
|
@@ -398,6 +546,7 @@ export {
|
|
|
398
546
|
Row,
|
|
399
547
|
Spinner,
|
|
400
548
|
Text,
|
|
549
|
+
Tooltip,
|
|
401
550
|
Value,
|
|
402
551
|
assertJSXElement,
|
|
403
552
|
createSnapComponent,
|