@metamask/snaps-sdk 5.0.0 → 6.0.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/index.js +99 -42
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +108 -49
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/jsx/index.js +125 -73
  7. package/dist/jsx/index.js.map +1 -1
  8. package/dist/jsx/index.mjs +125 -73
  9. package/dist/jsx/index.mjs.map +1 -1
  10. package/dist/jsx/jsx-dev-runtime.js +74 -37
  11. package/dist/jsx/jsx-dev-runtime.js.map +1 -1
  12. package/dist/jsx/jsx-dev-runtime.mjs +74 -37
  13. package/dist/jsx/jsx-dev-runtime.mjs.map +1 -1
  14. package/dist/tsconfig.build.tsbuildinfo +1 -1
  15. package/dist/types/internals/jsx.d.ts +1 -1
  16. package/dist/types/jsx/component.d.ts +6 -9
  17. package/dist/types/jsx/components/Box.d.ts +4 -4
  18. package/dist/types/jsx/components/Link.d.ts +2 -2
  19. package/dist/types/jsx/components/Row.d.ts +1 -1
  20. package/dist/types/jsx/components/Text.d.ts +7 -2
  21. package/dist/types/jsx/components/Tooltip.d.ts +38 -0
  22. package/dist/types/jsx/components/form/Checkbox.d.ts +35 -0
  23. package/dist/types/jsx/components/form/Dropdown.d.ts +4 -5
  24. package/dist/types/jsx/components/form/Field.d.ts +7 -1
  25. package/dist/types/jsx/components/form/FileInput.d.ts +47 -0
  26. package/dist/types/jsx/components/form/Form.d.ts +4 -7
  27. package/dist/types/jsx/components/form/Input.d.ts +1 -2
  28. package/dist/types/jsx/components/form/index.d.ts +5 -1
  29. package/dist/types/jsx/components/formatting/Bold.d.ts +2 -2
  30. package/dist/types/jsx/components/formatting/Italic.d.ts +2 -2
  31. package/dist/types/jsx/components/index.d.ts +3 -1
  32. package/dist/types/jsx/validation.d.ts +34 -39
  33. package/dist/types/types/handlers/user-input.d.ts +126 -11
  34. package/dist/types/types/interface.d.ts +29 -21
  35. package/package.json +1 -1
@@ -2,12 +2,35 @@ import type { Infer } from 'superstruct';
2
2
  import type { JSXElement } from '../jsx';
3
3
  import type { Component } from '../ui';
4
4
  /**
5
- * To avoid typing problems with the interface state when manipulating it we have to differentiate the state of
6
- * a form (that will be contained inside the root state) and the root state since a key in the root stat can contain
5
+ * To avoid typing problems with the interface state when manipulating it we
6
+ * have to differentiate the state of a form (that will be contained inside the
7
+ * root state) and the root state since a key in the root stat can contain
7
8
  * either the value of an input or a sub-state of a form.
8
9
  */
9
- export declare const FormStateStruct: import("superstruct").Struct<Record<string, string | null>, null>;
10
- export declare const InterfaceStateStruct: import("superstruct").Struct<Record<string, string | Record<string, string | null> | null>, null>;
10
+ export declare const StateStruct: import("superstruct").Struct<string | boolean | {
11
+ name: string;
12
+ size: number;
13
+ contentType: string;
14
+ contents: string;
15
+ }, null>;
16
+ export declare const FormStateStruct: import("superstruct").Struct<Record<string, string | boolean | {
17
+ name: string;
18
+ size: number;
19
+ contentType: string;
20
+ contents: string;
21
+ } | null>, null>;
22
+ export declare const InterfaceStateStruct: import("superstruct").Struct<Record<string, string | boolean | {
23
+ name: string;
24
+ size: number;
25
+ contentType: string;
26
+ contents: string;
27
+ } | Record<string, string | boolean | {
28
+ name: string;
29
+ size: number;
30
+ contentType: string;
31
+ contents: string;
32
+ } | null> | null>, null>;
33
+ export declare type State = Infer<typeof StateStruct>;
11
34
  export declare type FormState = Infer<typeof FormStateStruct>;
12
35
  export declare type InterfaceState = Infer<typeof InterfaceStateStruct>;
13
36
  export declare type ComponentOrElement = Component | JSXElement;
@@ -79,26 +102,11 @@ export declare const ComponentOrElementStruct: import("superstruct").Struct<{
79
102
  variant?: "primary" | "secondary" | undefined;
80
103
  buttonType?: "button" | "submit" | undefined;
81
104
  })[];
82
- } | import("../jsx").SnapElement<import("../jsx").ButtonProps, "Button"> | import("../jsx").SnapElement<{
83
- name: string;
84
- type?: "number" | "text" | "password" | undefined;
85
- value?: string | undefined;
86
- placeholder?: string | undefined;
87
- }, "Input"> | import("../jsx").SnapElement<{
88
- name: string;
89
- value?: string | undefined;
90
- children: import("../jsx").MaybeArray<import("../jsx").SnapElement<{
91
- value: string;
92
- children: string;
93
- }, "Option">>;
94
- }, "Dropdown"> | import("../jsx").SnapElement<{
95
- children: import("../jsx").MaybeArray<import("../jsx").SnapElement<import("../jsx").ButtonProps, "Button"> | import("../jsx").SnapElement<import("../jsx").FieldProps, "Field">>;
96
- name: string;
97
- }, "Form"> | import("../jsx").SnapElement<import("../jsx").BoldProps, "Bold"> | import("../jsx").SnapElement<import("../jsx").ItalicProps, "Italic"> | import("../jsx").SnapElement<import("../jsx").AddressProps, "Address"> | import("../jsx").SnapElement<import("../jsx").BoxProps, "Box"> | import("../jsx").SnapElement<import("../jsx").CopyableProps, "Copyable"> | import("../jsx").SnapElement<Record<string, never>, "Divider"> | import("../jsx").SnapElement<{
105
+ } | import("../jsx").SnapElement<import("../jsx").ButtonProps, "Button"> | import("../jsx").SnapElement<import("../jsx").CheckboxProps, "Checkbox"> | import("../jsx").SnapElement<import("../jsx").FormProps, "Form"> | import("../jsx").SnapElement<import("../jsx").InputProps, "Input"> | import("../jsx").SnapElement<import("../jsx").DropdownProps, "Dropdown"> | import("../jsx").SnapElement<import("../jsx").FileInputProps, "FileInput"> | import("../jsx").SnapElement<import("../jsx").BoldProps, "Bold"> | import("../jsx").SnapElement<import("../jsx").ItalicProps, "Italic"> | import("../jsx").SnapElement<import("../jsx").AddressProps, "Address"> | import("../jsx").SnapElement<import("../jsx").BoxProps, "Box"> | import("../jsx").SnapElement<import("../jsx").CopyableProps, "Copyable"> | import("../jsx").SnapElement<Record<string, never>, "Divider"> | import("../jsx").SnapElement<{
98
106
  children: import("../jsx").StringElement;
99
107
  }, "Heading"> | import("../jsx").SnapElement<{
100
108
  src: string;
101
109
  alt?: string | undefined;
102
- }, "Image"> | import("../jsx").SnapElement<import("../jsx").LinkProps, "Link"> | import("../jsx").SnapElement<import("../jsx").TextProps, "Text"> | import("../jsx").SnapElement<import("../jsx").RowProps, "Row"> | import("../jsx").SnapElement<Record<string, never>, "Spinner">, null>;
110
+ }, "Image"> | import("../jsx").SnapElement<import("../jsx").LinkProps, "Link"> | import("../jsx").SnapElement<import("../jsx").TextProps, "Text"> | import("../jsx").SnapElement<import("../jsx").RowProps, "Row"> | import("../jsx").SnapElement<Record<string, never>, "Spinner"> | import("../jsx").SnapElement<import("../jsx").TooltipProps, "Tooltip">, null>;
103
111
  export declare const InterfaceContextStruct: import("superstruct").Struct<Record<string, import("@metamask/utils").Json>, null>;
104
112
  export declare type InterfaceContext = Infer<typeof InterfaceContextStruct>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/snaps-sdk",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/MetaMask/snaps.git"