@metamask/snaps-sdk 6.20.0 → 6.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/dist/error-wrappers.d.cts +192 -192
  3. package/dist/error-wrappers.d.mts +192 -192
  4. package/dist/images.d.cts +1 -1
  5. package/dist/images.d.mts +1 -1
  6. package/dist/index.cjs +2 -1
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +1 -1
  9. package/dist/index.d.cts.map +1 -1
  10. package/dist/index.d.mts +1 -1
  11. package/dist/index.d.mts.map +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/internals/error-wrappers.d.cts +12 -12
  15. package/dist/internals/error-wrappers.d.mts +12 -12
  16. package/dist/internals/structs.cjs +29 -8
  17. package/dist/internals/structs.cjs.map +1 -1
  18. package/dist/internals/structs.d.cts +8 -0
  19. package/dist/internals/structs.d.cts.map +1 -1
  20. package/dist/internals/structs.d.mts +8 -0
  21. package/dist/internals/structs.d.mts.map +1 -1
  22. package/dist/internals/structs.mjs +29 -9
  23. package/dist/internals/structs.mjs.map +1 -1
  24. package/dist/jsx/components/form/AddressInput.cjs +1 -0
  25. package/dist/jsx/components/form/AddressInput.cjs.map +1 -1
  26. package/dist/jsx/components/form/AddressInput.d.cts +2 -0
  27. package/dist/jsx/components/form/AddressInput.d.cts.map +1 -1
  28. package/dist/jsx/components/form/AddressInput.d.mts +2 -0
  29. package/dist/jsx/components/form/AddressInput.d.mts.map +1 -1
  30. package/dist/jsx/components/form/AddressInput.mjs +1 -0
  31. package/dist/jsx/components/form/AddressInput.mjs.map +1 -1
  32. package/dist/jsx/validation.cjs +9 -5
  33. package/dist/jsx/validation.cjs.map +1 -1
  34. package/dist/jsx/validation.d.cts +15 -15
  35. package/dist/jsx/validation.d.cts.map +1 -1
  36. package/dist/jsx/validation.d.mts +15 -15
  37. package/dist/jsx/validation.d.mts.map +1 -1
  38. package/dist/jsx/validation.mjs +9 -5
  39. package/dist/jsx/validation.mjs.map +1 -1
  40. package/dist/types/handlers/asset-historical-price.cjs +3 -0
  41. package/dist/types/handlers/asset-historical-price.cjs.map +1 -0
  42. package/dist/types/handlers/asset-historical-price.d.cts +46 -0
  43. package/dist/types/handlers/asset-historical-price.d.cts.map +1 -0
  44. package/dist/types/handlers/asset-historical-price.d.mts +46 -0
  45. package/dist/types/handlers/asset-historical-price.d.mts.map +1 -0
  46. package/dist/types/handlers/asset-historical-price.mjs +2 -0
  47. package/dist/types/handlers/asset-historical-price.mjs.map +1 -0
  48. package/dist/types/handlers/assets-conversion.cjs +0 -11
  49. package/dist/types/handlers/assets-conversion.cjs.map +1 -1
  50. package/dist/types/handlers/assets-conversion.d.cts +43 -22
  51. package/dist/types/handlers/assets-conversion.d.cts.map +1 -1
  52. package/dist/types/handlers/assets-conversion.d.mts +43 -22
  53. package/dist/types/handlers/assets-conversion.d.mts.map +1 -1
  54. package/dist/types/handlers/assets-conversion.mjs +1 -10
  55. package/dist/types/handlers/assets-conversion.mjs.map +1 -1
  56. package/dist/types/handlers/assets-lookup.cjs +4 -4
  57. package/dist/types/handlers/assets-lookup.cjs.map +1 -1
  58. package/dist/types/handlers/assets-lookup.d.cts +24 -24
  59. package/dist/types/handlers/assets-lookup.d.cts.map +1 -1
  60. package/dist/types/handlers/assets-lookup.d.mts +24 -24
  61. package/dist/types/handlers/assets-lookup.d.mts.map +1 -1
  62. package/dist/types/handlers/assets-lookup.mjs +5 -5
  63. package/dist/types/handlers/assets-lookup.mjs.map +1 -1
  64. package/dist/types/handlers/index.cjs +0 -1
  65. package/dist/types/handlers/index.cjs.map +1 -1
  66. package/dist/types/handlers/index.d.cts +2 -1
  67. package/dist/types/handlers/index.d.cts.map +1 -1
  68. package/dist/types/handlers/index.d.mts +2 -1
  69. package/dist/types/handlers/index.d.mts.map +1 -1
  70. package/dist/types/handlers/index.mjs +0 -1
  71. package/dist/types/handlers/index.mjs.map +1 -1
  72. package/dist/types/handlers/user-input.d.cts +10 -10
  73. package/dist/types/handlers/user-input.d.mts +10 -10
  74. package/dist/types/interface.d.cts +21 -21
  75. package/dist/types/interface.d.mts +21 -21
  76. package/dist/ui/components/address.cjs +2 -1
  77. package/dist/ui/components/address.cjs.map +1 -1
  78. package/dist/ui/components/address.d.cts +4 -4
  79. package/dist/ui/components/address.d.cts.map +1 -1
  80. package/dist/ui/components/address.d.mts +4 -4
  81. package/dist/ui/components/address.d.mts.map +1 -1
  82. package/dist/ui/components/address.mjs +2 -1
  83. package/dist/ui/components/address.mjs.map +1 -1
  84. package/dist/ui/components/button.cjs +1 -1
  85. package/dist/ui/components/button.cjs.map +1 -1
  86. package/dist/ui/components/button.d.cts +7 -7
  87. package/dist/ui/components/button.d.cts.map +1 -1
  88. package/dist/ui/components/button.d.mts +7 -7
  89. package/dist/ui/components/button.d.mts.map +1 -1
  90. package/dist/ui/components/button.mjs +2 -2
  91. package/dist/ui/components/button.mjs.map +1 -1
  92. package/dist/ui/components/copyable.cjs +2 -1
  93. package/dist/ui/components/copyable.cjs.map +1 -1
  94. package/dist/ui/components/copyable.d.cts +4 -4
  95. package/dist/ui/components/copyable.d.mts +4 -4
  96. package/dist/ui/components/copyable.mjs +2 -1
  97. package/dist/ui/components/copyable.mjs.map +1 -1
  98. package/dist/ui/components/divider.cjs +2 -1
  99. package/dist/ui/components/divider.cjs.map +1 -1
  100. package/dist/ui/components/divider.d.cts +1 -1
  101. package/dist/ui/components/divider.d.cts.map +1 -1
  102. package/dist/ui/components/divider.d.mts +1 -1
  103. package/dist/ui/components/divider.d.mts.map +1 -1
  104. package/dist/ui/components/divider.mjs +2 -1
  105. package/dist/ui/components/divider.mjs.map +1 -1
  106. package/dist/ui/components/form.cjs +2 -1
  107. package/dist/ui/components/form.cjs.map +1 -1
  108. package/dist/ui/components/form.d.cts +39 -39
  109. package/dist/ui/components/form.d.cts.map +1 -1
  110. package/dist/ui/components/form.d.mts +39 -39
  111. package/dist/ui/components/form.d.mts.map +1 -1
  112. package/dist/ui/components/form.mjs +2 -1
  113. package/dist/ui/components/form.mjs.map +1 -1
  114. package/dist/ui/components/heading.cjs +2 -1
  115. package/dist/ui/components/heading.cjs.map +1 -1
  116. package/dist/ui/components/heading.d.cts +4 -4
  117. package/dist/ui/components/heading.d.cts.map +1 -1
  118. package/dist/ui/components/heading.d.mts +4 -4
  119. package/dist/ui/components/heading.d.mts.map +1 -1
  120. package/dist/ui/components/heading.mjs +2 -1
  121. package/dist/ui/components/heading.mjs.map +1 -1
  122. package/dist/ui/components/image.cjs +1 -1
  123. package/dist/ui/components/image.cjs.map +1 -1
  124. package/dist/ui/components/image.d.cts +4 -4
  125. package/dist/ui/components/image.d.mts +4 -4
  126. package/dist/ui/components/image.mjs +2 -2
  127. package/dist/ui/components/image.mjs.map +1 -1
  128. package/dist/ui/components/input.cjs +1 -1
  129. package/dist/ui/components/input.cjs.map +1 -1
  130. package/dist/ui/components/input.d.cts +10 -10
  131. package/dist/ui/components/input.d.cts.map +1 -1
  132. package/dist/ui/components/input.d.mts +10 -10
  133. package/dist/ui/components/input.d.mts.map +1 -1
  134. package/dist/ui/components/input.mjs +2 -2
  135. package/dist/ui/components/input.mjs.map +1 -1
  136. package/dist/ui/components/panel.cjs +1 -1
  137. package/dist/ui/components/panel.cjs.map +1 -1
  138. package/dist/ui/components/panel.d.cts +105 -105
  139. package/dist/ui/components/panel.d.mts +105 -105
  140. package/dist/ui/components/panel.mjs +2 -2
  141. package/dist/ui/components/panel.mjs.map +1 -1
  142. package/dist/ui/components/row.cjs +1 -1
  143. package/dist/ui/components/row.cjs.map +1 -1
  144. package/dist/ui/components/row.d.cts +23 -23
  145. package/dist/ui/components/row.d.cts.map +1 -1
  146. package/dist/ui/components/row.d.mts +23 -23
  147. package/dist/ui/components/row.d.mts.map +1 -1
  148. package/dist/ui/components/row.mjs +2 -2
  149. package/dist/ui/components/row.mjs.map +1 -1
  150. package/dist/ui/components/spinner.cjs +2 -1
  151. package/dist/ui/components/spinner.cjs.map +1 -1
  152. package/dist/ui/components/spinner.d.cts +1 -1
  153. package/dist/ui/components/spinner.d.cts.map +1 -1
  154. package/dist/ui/components/spinner.d.mts +1 -1
  155. package/dist/ui/components/spinner.d.mts.map +1 -1
  156. package/dist/ui/components/spinner.mjs +2 -1
  157. package/dist/ui/components/spinner.mjs.map +1 -1
  158. package/dist/ui/components/text.cjs +2 -1
  159. package/dist/ui/components/text.cjs.map +1 -1
  160. package/dist/ui/components/text.d.cts +4 -4
  161. package/dist/ui/components/text.d.mts +4 -4
  162. package/dist/ui/components/text.mjs +2 -1
  163. package/dist/ui/components/text.mjs.map +1 -1
  164. package/dist/ui/nodes.d.cts +1 -1
  165. package/dist/ui/nodes.d.mts +1 -1
  166. package/package.json +3 -3
@@ -1,18 +1,18 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.cjs";
3
3
  export declare const FormComponentStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Input;
5
4
  name: string;
6
- error?: string | undefined;
7
- inputType?: "number" | "text" | "password" | undefined;
5
+ type: NodeType.Input;
8
6
  value?: string | undefined;
9
7
  label?: string | undefined;
8
+ inputType?: "number" | "text" | "password" | undefined;
10
9
  placeholder?: string | undefined;
10
+ error?: string | undefined;
11
11
  } | {
12
- type: NodeType.Button;
13
12
  value: string;
14
- variant?: "primary" | "secondary" | undefined;
13
+ type: NodeType.Button;
15
14
  name?: string | undefined;
15
+ variant?: "primary" | "secondary" | undefined;
16
16
  buttonType?: "button" | "submit" | undefined;
17
17
  }, null>;
18
18
  /**
@@ -20,52 +20,52 @@ export declare const FormComponentStruct: import("@metamask/superstruct").Struct
20
20
  */
21
21
  export type FormComponent = Infer<typeof FormComponentStruct>;
22
22
  export declare const FormStruct: import("@metamask/superstruct").Struct<{
23
- type: NodeType.Form;
24
23
  name: string;
24
+ type: NodeType.Form;
25
25
  children: ({
26
- type: NodeType.Input;
27
26
  name: string;
28
- error?: string | undefined;
29
- inputType?: "number" | "text" | "password" | undefined;
27
+ type: NodeType.Input;
30
28
  value?: string | undefined;
31
29
  label?: string | undefined;
30
+ inputType?: "number" | "text" | "password" | undefined;
32
31
  placeholder?: string | undefined;
32
+ error?: string | undefined;
33
33
  } | {
34
- type: NodeType.Button;
35
34
  value: string;
36
- variant?: "primary" | "secondary" | undefined;
35
+ type: NodeType.Button;
37
36
  name?: string | undefined;
37
+ variant?: "primary" | "secondary" | undefined;
38
38
  buttonType?: "button" | "submit" | undefined;
39
39
  })[];
40
40
  }, {
41
- type: import("@metamask/superstruct").Struct<NodeType.Form, NodeType.Form>;
41
+ type: import("@metamask/superstruct").Struct<NodeType.Form, null>;
42
42
  children: import("@metamask/superstruct").Struct<({
43
- type: NodeType.Input;
44
43
  name: string;
45
- error?: string | undefined;
46
- inputType?: "number" | "text" | "password" | undefined;
44
+ type: NodeType.Input;
47
45
  value?: string | undefined;
48
46
  label?: string | undefined;
47
+ inputType?: "number" | "text" | "password" | undefined;
49
48
  placeholder?: string | undefined;
49
+ error?: string | undefined;
50
50
  } | {
51
- type: NodeType.Button;
52
51
  value: string;
53
- variant?: "primary" | "secondary" | undefined;
52
+ type: NodeType.Button;
54
53
  name?: string | undefined;
54
+ variant?: "primary" | "secondary" | undefined;
55
55
  buttonType?: "button" | "submit" | undefined;
56
56
  })[], import("@metamask/superstruct").Struct<{
57
- type: NodeType.Input;
58
57
  name: string;
59
- error?: string | undefined;
60
- inputType?: "number" | "text" | "password" | undefined;
58
+ type: NodeType.Input;
61
59
  value?: string | undefined;
62
60
  label?: string | undefined;
61
+ inputType?: "number" | "text" | "password" | undefined;
63
62
  placeholder?: string | undefined;
63
+ error?: string | undefined;
64
64
  } | {
65
- type: NodeType.Button;
66
65
  value: string;
67
- variant?: "primary" | "secondary" | undefined;
66
+ type: NodeType.Button;
68
67
  name?: string | undefined;
68
+ variant?: "primary" | "secondary" | undefined;
69
69
  buttonType?: "button" | "submit" | undefined;
70
70
  }, null>>;
71
71
  name: import("@metamask/superstruct").Struct<string, null>;
@@ -101,53 +101,53 @@ export type Form = Infer<typeof FormStruct>;
101
101
  * const node = form('myForm', [input('myInput'), button('Hello, world!')]);
102
102
  */
103
103
  export declare const form: (...args: [Omit<{
104
- type: NodeType.Form;
105
104
  name: string;
105
+ type: NodeType.Form;
106
106
  children: ({
107
- type: NodeType.Input;
108
107
  name: string;
109
- error?: string | undefined;
110
- inputType?: "number" | "text" | "password" | undefined;
108
+ type: NodeType.Input;
111
109
  value?: string | undefined;
112
110
  label?: string | undefined;
111
+ inputType?: "number" | "text" | "password" | undefined;
113
112
  placeholder?: string | undefined;
113
+ error?: string | undefined;
114
114
  } | {
115
- type: NodeType.Button;
116
115
  value: string;
117
- variant?: "primary" | "secondary" | undefined;
116
+ type: NodeType.Button;
118
117
  name?: string | undefined;
118
+ variant?: "primary" | "secondary" | undefined;
119
119
  buttonType?: "button" | "submit" | undefined;
120
120
  })[];
121
121
  }, "type">] | (string | ({
122
- type: NodeType.Input;
123
122
  name: string;
124
- error?: string | undefined;
125
- inputType?: "number" | "text" | "password" | undefined;
123
+ type: NodeType.Input;
126
124
  value?: string | undefined;
127
125
  label?: string | undefined;
126
+ inputType?: "number" | "text" | "password" | undefined;
128
127
  placeholder?: string | undefined;
128
+ error?: string | undefined;
129
129
  } | {
130
- type: NodeType.Button;
131
130
  value: string;
132
- variant?: "primary" | "secondary" | undefined;
131
+ type: NodeType.Button;
133
132
  name?: string | undefined;
133
+ variant?: "primary" | "secondary" | undefined;
134
134
  buttonType?: "button" | "submit" | undefined;
135
135
  })[])[]) => {
136
- type: NodeType.Form;
137
136
  name: string;
137
+ type: NodeType.Form;
138
138
  children: ({
139
- type: NodeType.Input;
140
139
  name: string;
141
- error?: string | undefined;
142
- inputType?: "number" | "text" | "password" | undefined;
140
+ type: NodeType.Input;
143
141
  value?: string | undefined;
144
142
  label?: string | undefined;
143
+ inputType?: "number" | "text" | "password" | undefined;
145
144
  placeholder?: string | undefined;
145
+ error?: string | undefined;
146
146
  } | {
147
- type: NodeType.Button;
148
147
  value: string;
149
- variant?: "primary" | "secondary" | undefined;
148
+ type: NodeType.Button;
150
149
  name?: string | undefined;
150
+ variant?: "primary" | "secondary" | undefined;
151
151
  buttonType?: "button" | "submit" | undefined;
152
152
  })[];
153
153
  };
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;QAAqC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGf,CAAC"}
1
+ {"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;QAAqC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGf,CAAC"}
@@ -1,18 +1,18 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.mjs";
3
3
  export declare const FormComponentStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Input;
5
4
  name: string;
6
- error?: string | undefined;
7
- inputType?: "number" | "text" | "password" | undefined;
5
+ type: NodeType.Input;
8
6
  value?: string | undefined;
9
7
  label?: string | undefined;
8
+ inputType?: "number" | "text" | "password" | undefined;
10
9
  placeholder?: string | undefined;
10
+ error?: string | undefined;
11
11
  } | {
12
- type: NodeType.Button;
13
12
  value: string;
14
- variant?: "primary" | "secondary" | undefined;
13
+ type: NodeType.Button;
15
14
  name?: string | undefined;
15
+ variant?: "primary" | "secondary" | undefined;
16
16
  buttonType?: "button" | "submit" | undefined;
17
17
  }, null>;
18
18
  /**
@@ -20,52 +20,52 @@ export declare const FormComponentStruct: import("@metamask/superstruct").Struct
20
20
  */
21
21
  export type FormComponent = Infer<typeof FormComponentStruct>;
22
22
  export declare const FormStruct: import("@metamask/superstruct").Struct<{
23
- type: NodeType.Form;
24
23
  name: string;
24
+ type: NodeType.Form;
25
25
  children: ({
26
- type: NodeType.Input;
27
26
  name: string;
28
- error?: string | undefined;
29
- inputType?: "number" | "text" | "password" | undefined;
27
+ type: NodeType.Input;
30
28
  value?: string | undefined;
31
29
  label?: string | undefined;
30
+ inputType?: "number" | "text" | "password" | undefined;
32
31
  placeholder?: string | undefined;
32
+ error?: string | undefined;
33
33
  } | {
34
- type: NodeType.Button;
35
34
  value: string;
36
- variant?: "primary" | "secondary" | undefined;
35
+ type: NodeType.Button;
37
36
  name?: string | undefined;
37
+ variant?: "primary" | "secondary" | undefined;
38
38
  buttonType?: "button" | "submit" | undefined;
39
39
  })[];
40
40
  }, {
41
- type: import("@metamask/superstruct").Struct<NodeType.Form, NodeType.Form>;
41
+ type: import("@metamask/superstruct").Struct<NodeType.Form, null>;
42
42
  children: import("@metamask/superstruct").Struct<({
43
- type: NodeType.Input;
44
43
  name: string;
45
- error?: string | undefined;
46
- inputType?: "number" | "text" | "password" | undefined;
44
+ type: NodeType.Input;
47
45
  value?: string | undefined;
48
46
  label?: string | undefined;
47
+ inputType?: "number" | "text" | "password" | undefined;
49
48
  placeholder?: string | undefined;
49
+ error?: string | undefined;
50
50
  } | {
51
- type: NodeType.Button;
52
51
  value: string;
53
- variant?: "primary" | "secondary" | undefined;
52
+ type: NodeType.Button;
54
53
  name?: string | undefined;
54
+ variant?: "primary" | "secondary" | undefined;
55
55
  buttonType?: "button" | "submit" | undefined;
56
56
  })[], import("@metamask/superstruct").Struct<{
57
- type: NodeType.Input;
58
57
  name: string;
59
- error?: string | undefined;
60
- inputType?: "number" | "text" | "password" | undefined;
58
+ type: NodeType.Input;
61
59
  value?: string | undefined;
62
60
  label?: string | undefined;
61
+ inputType?: "number" | "text" | "password" | undefined;
63
62
  placeholder?: string | undefined;
63
+ error?: string | undefined;
64
64
  } | {
65
- type: NodeType.Button;
66
65
  value: string;
67
- variant?: "primary" | "secondary" | undefined;
66
+ type: NodeType.Button;
68
67
  name?: string | undefined;
68
+ variant?: "primary" | "secondary" | undefined;
69
69
  buttonType?: "button" | "submit" | undefined;
70
70
  }, null>>;
71
71
  name: import("@metamask/superstruct").Struct<string, null>;
@@ -101,53 +101,53 @@ export type Form = Infer<typeof FormStruct>;
101
101
  * const node = form('myForm', [input('myInput'), button('Hello, world!')]);
102
102
  */
103
103
  export declare const form: (...args: [Omit<{
104
- type: NodeType.Form;
105
104
  name: string;
105
+ type: NodeType.Form;
106
106
  children: ({
107
- type: NodeType.Input;
108
107
  name: string;
109
- error?: string | undefined;
110
- inputType?: "number" | "text" | "password" | undefined;
108
+ type: NodeType.Input;
111
109
  value?: string | undefined;
112
110
  label?: string | undefined;
111
+ inputType?: "number" | "text" | "password" | undefined;
113
112
  placeholder?: string | undefined;
113
+ error?: string | undefined;
114
114
  } | {
115
- type: NodeType.Button;
116
115
  value: string;
117
- variant?: "primary" | "secondary" | undefined;
116
+ type: NodeType.Button;
118
117
  name?: string | undefined;
118
+ variant?: "primary" | "secondary" | undefined;
119
119
  buttonType?: "button" | "submit" | undefined;
120
120
  })[];
121
121
  }, "type">] | (string | ({
122
- type: NodeType.Input;
123
122
  name: string;
124
- error?: string | undefined;
125
- inputType?: "number" | "text" | "password" | undefined;
123
+ type: NodeType.Input;
126
124
  value?: string | undefined;
127
125
  label?: string | undefined;
126
+ inputType?: "number" | "text" | "password" | undefined;
128
127
  placeholder?: string | undefined;
128
+ error?: string | undefined;
129
129
  } | {
130
- type: NodeType.Button;
131
130
  value: string;
132
- variant?: "primary" | "secondary" | undefined;
131
+ type: NodeType.Button;
133
132
  name?: string | undefined;
133
+ variant?: "primary" | "secondary" | undefined;
134
134
  buttonType?: "button" | "submit" | undefined;
135
135
  })[])[]) => {
136
- type: NodeType.Form;
137
136
  name: string;
137
+ type: NodeType.Form;
138
138
  children: ({
139
- type: NodeType.Input;
140
139
  name: string;
141
- error?: string | undefined;
142
- inputType?: "number" | "text" | "password" | undefined;
140
+ type: NodeType.Input;
143
141
  value?: string | undefined;
144
142
  label?: string | undefined;
143
+ inputType?: "number" | "text" | "password" | undefined;
145
144
  placeholder?: string | undefined;
145
+ error?: string | undefined;
146
146
  } | {
147
- type: NodeType.Button;
148
147
  value: string;
149
- variant?: "primary" | "secondary" | undefined;
148
+ type: NodeType.Button;
150
149
  name?: string | undefined;
150
+ variant?: "primary" | "secondary" | undefined;
151
151
  buttonType?: "button" | "submit" | undefined;
152
152
  })[];
153
153
  };
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.mts","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAanD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;QAAqC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGf,CAAC"}
1
+ {"version":3,"file":"form.d.mts","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAOnD,OAAO,EAAc,QAAQ,EAAE,qBAAiB;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;QAAqC,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGf,CAAC"}
@@ -1,6 +1,7 @@
1
- import { array, assign, literal, object, string, union } from "@metamask/superstruct";
1
+ import { array, assign, object, string, union } from "@metamask/superstruct";
2
2
  import { ButtonStruct } from "./button.mjs";
3
3
  import { InputStruct } from "./input.mjs";
4
+ import { literal } from "../../internals/index.mjs";
4
5
  import { createBuilder } from "../builder.mjs";
5
6
  import { NodeStruct, NodeType } from "../nodes.mjs";
6
7
  export const FormComponentStruct = union([InputStruct, ButtonStruct]);
@@ -1 +1 @@
1
- {"version":3,"file":"form.mjs","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,YAAY,EAAE,qBAAiB;AACxC,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAiB;AAEhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAOtE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAC9B,UAAU,EACV,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,mBAAmB,CAAC;IACpC,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CACH,CAAC;AAWF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE;IAC3D,MAAM;IACN,UAAU;CACX,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n array,\n assign,\n literal,\n object,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer<typeof FormComponentStruct>;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer<typeof FormStruct>;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n"]}
1
+ {"version":3,"file":"form.mjs","sourceRoot":"","sources":["../../../src/ui/components/form.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,8BAA8B;AAE7E,OAAO,EAAE,YAAY,EAAE,qBAAiB;AACxC,OAAO,EAAE,WAAW,EAAE,oBAAgB;AACtC,OAAO,EAAE,OAAO,EAAE,kCAAwB;AAC1C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAiB;AAEhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;AAOtE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAC9B,UAAU,EACV,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,mBAAmB,CAAC;IACpC,IAAI,EAAE,MAAM,EAAE;CACf,CAAC,CACH,CAAC;AAWF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE;IAC3D,MAAM;IACN,UAAU;CACX,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { array, assign, object, string, union } from '@metamask/superstruct';\n\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const FormComponentStruct = union([InputStruct, ButtonStruct]);\n\n/**\n * The subset of nodes allowed as children in the {@link Form} node.\n */\nexport type FormComponent = Infer<typeof FormComponentStruct>;\n\nexport const FormStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Form),\n children: array(FormComponentStruct),\n name: string(),\n }),\n);\n\n/**\n * A form node that takes children {@link FormComponent} nodes and renders a form.\n *\n * @property type - The type of the node. Must be the string `form`.\n * @property children - The children of the node. Only {@link FormComponent} nodes are allowed.\n * @property name - The form name used to identify it.\n */\nexport type Form = Infer<typeof FormStruct>;\n\n/**\n * Create a {@link Form} node.\n *\n * @param args - The node arguments. This can be either an array of children and a string, or\n * an object with a `name` and `children` property.\n * @param args.name - The form name used to identify it.\n * @param args.children - The child nodes of the form. This can be any valid\n * {@link FormComponent}.\n * @returns The form node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = form({\n * name: 'myForm',\n * children: [\n * input({ name: 'myInput' }),\n * button({ value: 'Hello, world!' }),\n * ],\n * });\n *\n * const node = form('myForm', [input('myInput'), button('Hello, world!')]);\n */\nexport const form = createBuilder(NodeType.Form, FormStruct, [\n 'name',\n 'children',\n]);\n"]}
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.heading = exports.HeadingStruct = void 0;
4
4
  const superstruct_1 = require("@metamask/superstruct");
5
+ const internals_1 = require("../../internals/index.cjs");
5
6
  const builder_1 = require("../builder.cjs");
6
7
  const nodes_1 = require("../nodes.cjs");
7
8
  exports.HeadingStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
8
- type: (0, superstruct_1.literal)(nodes_1.NodeType.Heading),
9
+ type: (0, internals_1.literal)(nodes_1.NodeType.Heading),
9
10
  value: (0, superstruct_1.string)(),
10
11
  }));
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"heading.cjs","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":";;;AACA,uDAAwE;AAExE,4CAA2C;AAC3C,wCAAmD;AAEtC,QAAA,aAAa,GAAG,IAAA,oBAAM,EACjC,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,IAAA,oBAAM,GAAE;CAChB,CAAC,CACH,CAAC;AAYF;;;;;;;;;;;;GAYG;AACU,QAAA,OAAO,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,OAAO,EAAE,qBAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer<typeof HeadingStruct>;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n"]}
1
+ {"version":3,"file":"heading.cjs","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":";;;AACA,uDAA+D;AAE/D,yDAA0C;AAC1C,4CAA2C;AAC3C,wCAAmD;AAEtC,QAAA,aAAa,GAAG,IAAA,oBAAM,EACjC,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,IAAA,oBAAM,GAAE;CAChB,CAAC,CACH,CAAC;AAYF;;;;;;;;;;;;GAYG;AACU,QAAA,OAAO,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,OAAO,EAAE,qBAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string } from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer<typeof HeadingStruct>;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.cjs";
3
3
  export declare const HeadingStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Heading;
5
4
  value: string;
5
+ type: NodeType.Heading;
6
6
  }, {
7
- type: import("@metamask/superstruct").Struct<NodeType.Heading, NodeType.Heading>;
7
+ type: import("@metamask/superstruct").Struct<NodeType.Heading, null>;
8
8
  value: import("@metamask/superstruct").Struct<string, null>;
9
9
  }>;
10
10
  /**
@@ -30,10 +30,10 @@ export type Heading = Infer<typeof HeadingStruct>;
30
30
  * const node = heading('Hello, world!');
31
31
  */
32
32
  export declare const heading: (...args: string[] | [Omit<{
33
- type: NodeType.Heading;
34
33
  value: string;
35
- }, "type">]) => {
36
34
  type: NodeType.Heading;
35
+ }, "type">]) => {
37
36
  value: string;
37
+ type: NodeType.Heading;
38
38
  };
39
39
  //# sourceMappingURL=heading.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.d.cts","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
1
+ {"version":3,"file":"heading.d.cts","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.mjs";
3
3
  export declare const HeadingStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Heading;
5
4
  value: string;
5
+ type: NodeType.Heading;
6
6
  }, {
7
- type: import("@metamask/superstruct").Struct<NodeType.Heading, NodeType.Heading>;
7
+ type: import("@metamask/superstruct").Struct<NodeType.Heading, null>;
8
8
  value: import("@metamask/superstruct").Struct<string, null>;
9
9
  }>;
10
10
  /**
@@ -30,10 +30,10 @@ export type Heading = Infer<typeof HeadingStruct>;
30
30
  * const node = heading('Hello, world!');
31
31
  */
32
32
  export declare const heading: (...args: string[] | [Omit<{
33
- type: NodeType.Heading;
34
33
  value: string;
35
- }, "type">]) => {
36
34
  type: NodeType.Heading;
35
+ }, "type">]) => {
37
36
  value: string;
37
+ type: NodeType.Heading;
38
38
  };
39
39
  //# sourceMappingURL=heading.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.d.mts","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAInD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
1
+ {"version":3,"file":"heading.d.mts","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAKnD,OAAO,EAAiB,QAAQ,EAAE,qBAAiB;AAEnD,eAAO,MAAM,aAAa;;;;;;EAMzB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO;;;;;;CAElB,CAAC"}
@@ -1,4 +1,5 @@
1
- import { assign, literal, object, string } from "@metamask/superstruct";
1
+ import { assign, object, string } from "@metamask/superstruct";
2
+ import { literal } from "../../internals/index.mjs";
2
3
  import { createBuilder } from "../builder.mjs";
3
4
  import { LiteralStruct, NodeType } from "../nodes.mjs";
4
5
  export const HeadingStruct = assign(LiteralStruct, object({
@@ -1 +1 @@
1
- {"version":3,"file":"heading.mjs","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAExE,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAiB;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CACjC,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE;CAChB,CAAC,CACH,CAAC;AAYF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object, string } from '@metamask/superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer<typeof HeadingStruct>;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n"]}
1
+ {"version":3,"file":"heading.mjs","sourceRoot":"","sources":["../../../src/ui/components/heading.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAE/D,OAAO,EAAE,OAAO,EAAE,kCAAwB;AAC1C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAiB;AAEnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CACjC,aAAa,EACb,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE;CAChB,CAAC,CACH,CAAC;AAYF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE;IACpE,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, string } from '@metamask/superstruct';\n\nimport { literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const HeadingStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Heading),\n value: string(),\n }),\n);\n\n/**\n * A heading node, that renders the text as a heading. The level of the heading\n * is determined by the depth of the heading in the document.\n *\n * @property type - The type of the node, must be the string 'text'.\n * @property value - The text content of the node, either as plain text, or as a\n * markdown string.\n */\nexport type Heading = Infer<typeof HeadingStruct>;\n\n/**\n * Create a {@link Heading} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The heading text.\n * @returns The heading node as object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = heading({ value: 'Hello, world!' });\n * const node = heading('Hello, world!');\n */\nexport const heading = createBuilder(NodeType.Heading, HeadingStruct, [\n 'value',\n]);\n"]}
@@ -6,7 +6,7 @@ const internals_1 = require("../../internals/index.cjs");
6
6
  const builder_1 = require("../builder.cjs");
7
7
  const nodes_1 = require("../nodes.cjs");
8
8
  exports.ImageStruct = (0, superstruct_1.assign)(nodes_1.NodeStruct, (0, superstruct_1.object)({
9
- type: (0, superstruct_1.literal)(nodes_1.NodeType.Image),
9
+ type: (0, internals_1.literal)(nodes_1.NodeType.Image),
10
10
  value: (0, internals_1.svg)(),
11
11
  }));
12
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"image.cjs","sourceRoot":"","sources":["../../../src/ui/components/image.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE,yDAAsC;AACtC,4CAA2C;AAC3C,wCAAgD;AAEnC,QAAA,WAAW,GAAG,IAAA,oBAAM,EAC/B,kBAAU,EACV,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,IAAA,eAAG,GAAE;CACb,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;;GAaG;AACU,QAAA,KAAK,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,KAAK,EAAE,mBAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer<typeof ImageStruct>;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '<svg />' });\n * const node = image('<svg />');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n"]}
1
+ {"version":3,"file":"image.cjs","sourceRoot":"","sources":["../../../src/ui/components/image.ts"],"names":[],"mappings":";;;AACA,uDAAuD;AAEvD,yDAA+C;AAC/C,4CAA2C;AAC3C,wCAAgD;AAEnC,QAAA,WAAW,GAAG,IAAA,oBAAM,EAC/B,kBAAU,EACV,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,IAAA,eAAG,GAAE;CACb,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;;GAaG;AACU,QAAA,KAAK,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,KAAK,EAAE,mBAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\n\nimport { svg, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer<typeof ImageStruct>;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '<svg />' });\n * const node = image('<svg />');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n"]}
@@ -1,10 +1,10 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.cjs";
3
3
  export declare const ImageStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Image;
5
4
  value: string;
5
+ type: NodeType.Image;
6
6
  }, {
7
- type: import("@metamask/superstruct").Struct<NodeType.Image, NodeType.Image>;
7
+ type: import("@metamask/superstruct").Struct<NodeType.Image, null>;
8
8
  value: import("@metamask/superstruct").Struct<string, null>;
9
9
  }>;
10
10
  /**
@@ -29,10 +29,10 @@ export type Image = Infer<typeof ImageStruct>;
29
29
  * const node = image('<svg />');
30
30
  */
31
31
  export declare const image: (...args: string[] | [Omit<{
32
- type: NodeType.Image;
33
32
  value: string;
34
- }, "type">]) => {
35
33
  type: NodeType.Image;
34
+ }, "type">]) => {
36
35
  value: string;
36
+ type: NodeType.Image;
37
37
  };
38
38
  //# sourceMappingURL=image.d.cts.map
@@ -1,10 +1,10 @@
1
1
  import type { Infer } from "@metamask/superstruct";
2
2
  import { NodeType } from "../nodes.mjs";
3
3
  export declare const ImageStruct: import("@metamask/superstruct").Struct<{
4
- type: NodeType.Image;
5
4
  value: string;
5
+ type: NodeType.Image;
6
6
  }, {
7
- type: import("@metamask/superstruct").Struct<NodeType.Image, NodeType.Image>;
7
+ type: import("@metamask/superstruct").Struct<NodeType.Image, null>;
8
8
  value: import("@metamask/superstruct").Struct<string, null>;
9
9
  }>;
10
10
  /**
@@ -29,10 +29,10 @@ export type Image = Infer<typeof ImageStruct>;
29
29
  * const node = image('<svg />');
30
30
  */
31
31
  export declare const image: (...args: string[] | [Omit<{
32
- type: NodeType.Image;
33
32
  value: string;
34
- }, "type">]) => {
35
33
  type: NodeType.Image;
34
+ }, "type">]) => {
36
35
  value: string;
36
+ type: NodeType.Image;
37
37
  };
38
38
  //# sourceMappingURL=image.d.mts.map
@@ -1,5 +1,5 @@
1
- import { assign, literal, object } from "@metamask/superstruct";
2
- import { svg } from "../../internals/index.mjs";
1
+ import { assign, object } from "@metamask/superstruct";
2
+ import { svg, literal } from "../../internals/index.mjs";
3
3
  import { createBuilder } from "../builder.mjs";
4
4
  import { NodeStruct, NodeType } from "../nodes.mjs";
5
5
  export const ImageStruct = assign(NodeStruct, object({
@@ -1 +1 @@
1
- {"version":3,"file":"image.mjs","sourceRoot":"","sources":["../../../src/ui/components/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,8BAA8B;AAEhE,OAAO,EAAE,GAAG,EAAE,kCAAwB;AACtC,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAiB;AAEhD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAC/B,UAAU,EACV,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,GAAG,EAAE;CACb,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, literal, object } from '@metamask/superstruct';\n\nimport { svg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer<typeof ImageStruct>;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '<svg />' });\n * const node = image('<svg />');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n"]}
1
+ {"version":3,"file":"image.mjs","sourceRoot":"","sources":["../../../src/ui/components/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8BAA8B;AAEvD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,kCAAwB;AAC/C,OAAO,EAAE,aAAa,EAAE,uBAAmB;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAiB;AAEhD,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAC/B,UAAU,EACV,MAAM,CAAC;IACL,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,GAAG,EAAE;CACb,CAAC,CACH,CAAC;AAUF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object } from '@metamask/superstruct';\n\nimport { svg, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const ImageStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Image),\n value: svg(),\n }),\n);\n\n/**\n * An image node, that renders an SVG image.\n *\n * @property type - The type of the node. Must be the string `image`.\n * @property value - The SVG image to be rendered.\n */\nexport type Image = Infer<typeof ImageStruct>;\n\n/**\n * Create an {@link Image} node.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `value` property.\n * @param args.value - The SVG image to be rendered. Must be a valid SVG string.\n * @returns The image node as object. Other image formats are supported by\n * embedding them as data URLs in the SVG.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = image({ value: '<svg />' });\n * const node = image('<svg />');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n"]}
@@ -16,7 +16,7 @@ var InputType;
16
16
  InputType["Password"] = "password";
17
17
  })(InputType || (exports.InputType = InputType = {}));
18
18
  exports.InputStruct = (0, superstruct_1.assign)(nodes_1.LiteralStruct, (0, superstruct_1.object)({
19
- type: (0, superstruct_1.literal)(nodes_1.NodeType.Input),
19
+ type: (0, internals_1.literal)(nodes_1.NodeType.Input),
20
20
  value: (0, superstruct_1.optional)((0, superstruct_1.string)()),
21
21
  name: (0, superstruct_1.string)(),
22
22
  inputType: (0, superstruct_1.optional)((0, superstruct_1.union)([
@@ -1 +1 @@
1
- {"version":3,"file":"input.cjs","sourceRoot":"","sources":["../../../src/ui/components/input.ts"],"names":[],"mappings":";;;AACA,uDAO+B;AAE/B,yDAA4C;AAC5C,4CAA2C;AAC3C,wCAAmD;AAEnD;;;GAGG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAEY,QAAA,WAAW,GAAG,IAAA,oBAAM,EAC/B,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,qBAAO,EAAC,gBAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IACzB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,SAAS,EAAE,IAAA,sBAAQ,EACjB,IAAA,mBAAK,EAAC;QACJ,IAAA,qBAAS,EAAC,SAAS,CAAC,IAAI,CAAC;QACzB,IAAA,qBAAS,EAAC,SAAS,CAAC,QAAQ,CAAC;QAC7B,IAAA,qBAAS,EAAC,SAAS,CAAC,MAAM,CAAC;KAC5B,CAAC,CACH;IACD,WAAW,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IAC/B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IACzB,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CAC1B,CAAC,CACH,CAAC;AAeF;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,KAAK,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,KAAK,EAAE,mBAAW,EAAE;IAC9D,MAAM;IACN,WAAW;IACX,aAAa;IACb,OAAO;IACP,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport {\n assign,\n literal,\n object,\n optional,\n string,\n union,\n} from '@metamask/superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/main/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n Text = 'text',\n Number = 'number',\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer<typeof InputStruct>;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n"]}
1
+ {"version":3,"file":"input.cjs","sourceRoot":"","sources":["../../../src/ui/components/input.ts"],"names":[],"mappings":";;;AACA,uDAAgF;AAEhF,yDAAqD;AACrD,4CAA2C;AAC3C,wCAAmD;AAEnD;;;GAGG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB;AAEY,QAAA,WAAW,GAAG,IAAA,oBAAM,EAC/B,qBAAa,EACb,IAAA,oBAAM,EAAC;IACL,IAAI,EAAE,IAAA,mBAAO,EAAC,gBAAQ,CAAC,KAAK,CAAC;IAC7B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IACzB,IAAI,EAAE,IAAA,oBAAM,GAAE;IACd,SAAS,EAAE,IAAA,sBAAQ,EACjB,IAAA,mBAAK,EAAC;QACJ,IAAA,qBAAS,EAAC,SAAS,CAAC,IAAI,CAAC;QACzB,IAAA,qBAAS,EAAC,SAAS,CAAC,QAAQ,CAAC;QAC7B,IAAA,qBAAS,EAAC,SAAS,CAAC,MAAM,CAAC;KAC5B,CAAC,CACH;IACD,WAAW,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IAC/B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IACzB,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CAC1B,CAAC,CACH,CAAC;AAeF;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,KAAK,GAAG,IAAA,uBAAa,EAAC,gBAAQ,CAAC,KAAK,EAAE,mBAAW,EAAE;IAC9D,MAAM;IACN,WAAW;IACX,aAAa;IACb,OAAO;IACP,OAAO;CACR,CAAC,CAAC","sourcesContent":["import type { Infer } from '@metamask/superstruct';\nimport { assign, object, optional, string, union } from '@metamask/superstruct';\n\nimport { enumValue, literal } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\n/**\n * This replicates the available input types from the metamask extension.\n * https://github.com/MetaMask/metamask-extension/main/ui/components/component-library/input/input.constants.js\n */\nexport enum InputType {\n Text = 'text',\n Number = 'number',\n Password = 'password',\n}\n\nexport const InputStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Input),\n value: optional(string()),\n name: string(),\n inputType: optional(\n union([\n enumValue(InputType.Text),\n enumValue(InputType.Password),\n enumValue(InputType.Number),\n ]),\n ),\n placeholder: optional(string()),\n label: optional(string()),\n error: optional(string()),\n }),\n);\n\n/**\n * An input node, that renders an input.\n *\n * @property type - The type of the node, must be the string 'input'.\n * @property name - The name for the input.\n * @property value - The value of the input.\n * @property inputType - An optional type, either `text`, `password` or `number`.\n * @property placeholder - An optional input placeholder.\n * @property label - An optional input label.\n * @property error - An optional error text.\n */\nexport type Input = Infer<typeof InputStruct>;\n\n/**\n * Create a {@link Input} node.\n *\n * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object\n * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.\n * @param args.name - The name for the input.\n * @param args.value - The value of the input.\n * @param args.inputType - An optional type, either `text`, `password` or `number`.\n * @param args.placeholder - An optional input placeholder.\n * @param args.label - An optional input label.\n * @param args.error - An optional error text.\n * @returns The input node as an object.\n * @deprecated Snaps component functions are deprecated, in favor of the new JSX\n * components. This function will be removed in a future release.\n * @example\n * const node = input('myInput');\n * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');\n * const node = input({ name: 'myInput' });\n * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})\n */\nexport const input = createBuilder(NodeType.Input, InputStruct, [\n 'name',\n 'inputType',\n 'placeholder',\n 'value',\n 'label',\n]);\n"]}