@metamask/snaps-sdk 2.1.0 → 3.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 (263) hide show
  1. package/CHANGELOG.md +8 -2
  2. package/dist/index.js +883 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +810 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/tsconfig.build.tsbuildinfo +1 -0
  7. package/package.json +17 -14
  8. package/dist/cjs/error-wrappers.js +0 -80
  9. package/dist/cjs/error-wrappers.js.map +0 -1
  10. package/dist/cjs/errors.js +0 -162
  11. package/dist/cjs/errors.js.map +0 -1
  12. package/dist/cjs/images.js +0 -54
  13. package/dist/cjs/images.js.map +0 -1
  14. package/dist/cjs/index.js +0 -68
  15. package/dist/cjs/index.js.map +0 -1
  16. package/dist/cjs/internals/error-wrappers.js +0 -39
  17. package/dist/cjs/internals/error-wrappers.js.map +0 -1
  18. package/dist/cjs/internals/errors.js +0 -59
  19. package/dist/cjs/internals/errors.js.map +0 -1
  20. package/dist/cjs/internals/helpers.js +0 -6
  21. package/dist/cjs/internals/helpers.js.map +0 -1
  22. package/dist/cjs/internals/index.js +0 -24
  23. package/dist/cjs/internals/index.js.map +0 -1
  24. package/dist/cjs/internals/structs.js +0 -43
  25. package/dist/cjs/internals/structs.js.map +0 -1
  26. package/dist/cjs/internals/svg.js +0 -49
  27. package/dist/cjs/internals/svg.js.map +0 -1
  28. package/dist/cjs/types/caip.js +0 -10
  29. package/dist/cjs/types/caip.js.map +0 -1
  30. package/dist/cjs/types/global.js +0 -6
  31. package/dist/cjs/types/global.js.map +0 -1
  32. package/dist/cjs/types/handlers/cronjob.js +0 -6
  33. package/dist/cjs/types/handlers/cronjob.js.map +0 -1
  34. package/dist/cjs/types/handlers/home-page.js +0 -6
  35. package/dist/cjs/types/handlers/home-page.js.map +0 -1
  36. package/dist/cjs/types/handlers/index.js +0 -28
  37. package/dist/cjs/types/handlers/index.js.map +0 -1
  38. package/dist/cjs/types/handlers/keyring.js +0 -6
  39. package/dist/cjs/types/handlers/keyring.js.map +0 -1
  40. package/dist/cjs/types/handlers/lifecycle.js +0 -6
  41. package/dist/cjs/types/handlers/lifecycle.js.map +0 -1
  42. package/dist/cjs/types/handlers/name-lookup.js +0 -6
  43. package/dist/cjs/types/handlers/name-lookup.js.map +0 -1
  44. package/dist/cjs/types/handlers/rpc-request.js +0 -6
  45. package/dist/cjs/types/handlers/rpc-request.js.map +0 -1
  46. package/dist/cjs/types/handlers/signature.js +0 -6
  47. package/dist/cjs/types/handlers/signature.js.map +0 -1
  48. package/dist/cjs/types/handlers/transaction.js +0 -16
  49. package/dist/cjs/types/handlers/transaction.js.map +0 -1
  50. package/dist/cjs/types/handlers/user-input.js +0 -51
  51. package/dist/cjs/types/handlers/user-input.js.map +0 -1
  52. package/dist/cjs/types/index.js +0 -29
  53. package/dist/cjs/types/index.js.map +0 -1
  54. package/dist/cjs/types/interface.js +0 -26
  55. package/dist/cjs/types/interface.js.map +0 -1
  56. package/dist/cjs/types/methods/create-interface.js +0 -6
  57. package/dist/cjs/types/methods/create-interface.js.map +0 -1
  58. package/dist/cjs/types/methods/dialog.js +0 -18
  59. package/dist/cjs/types/methods/dialog.js.map +0 -1
  60. package/dist/cjs/types/methods/get-bip32-entropy.js +0 -6
  61. package/dist/cjs/types/methods/get-bip32-entropy.js.map +0 -1
  62. package/dist/cjs/types/methods/get-bip32-public-key.js +0 -6
  63. package/dist/cjs/types/methods/get-bip32-public-key.js.map +0 -1
  64. package/dist/cjs/types/methods/get-bip44-entropy.js +0 -6
  65. package/dist/cjs/types/methods/get-bip44-entropy.js.map +0 -1
  66. package/dist/cjs/types/methods/get-client-status.js +0 -10
  67. package/dist/cjs/types/methods/get-client-status.js.map +0 -1
  68. package/dist/cjs/types/methods/get-entropy.js +0 -6
  69. package/dist/cjs/types/methods/get-entropy.js.map +0 -1
  70. package/dist/cjs/types/methods/get-file.js +0 -18
  71. package/dist/cjs/types/methods/get-file.js.map +0 -1
  72. package/dist/cjs/types/methods/get-interface-state.js +0 -6
  73. package/dist/cjs/types/methods/get-interface-state.js.map +0 -1
  74. package/dist/cjs/types/methods/get-locale.js +0 -10
  75. package/dist/cjs/types/methods/get-locale.js.map +0 -1
  76. package/dist/cjs/types/methods/get-snaps.js +0 -6
  77. package/dist/cjs/types/methods/get-snaps.js.map +0 -1
  78. package/dist/cjs/types/methods/index.js +0 -38
  79. package/dist/cjs/types/methods/index.js.map +0 -1
  80. package/dist/cjs/types/methods/invoke-keyring.js +0 -6
  81. package/dist/cjs/types/methods/invoke-keyring.js.map +0 -1
  82. package/dist/cjs/types/methods/invoke-snap.js +0 -6
  83. package/dist/cjs/types/methods/invoke-snap.js.map +0 -1
  84. package/dist/cjs/types/methods/manage-accounts.js +0 -6
  85. package/dist/cjs/types/methods/manage-accounts.js.map +0 -1
  86. package/dist/cjs/types/methods/manage-state.js +0 -18
  87. package/dist/cjs/types/methods/manage-state.js.map +0 -1
  88. package/dist/cjs/types/methods/methods.js +0 -6
  89. package/dist/cjs/types/methods/methods.js.map +0 -1
  90. package/dist/cjs/types/methods/notify.js +0 -17
  91. package/dist/cjs/types/methods/notify.js.map +0 -1
  92. package/dist/cjs/types/methods/request-snaps.js +0 -6
  93. package/dist/cjs/types/methods/request-snaps.js.map +0 -1
  94. package/dist/cjs/types/methods/update-interface.js +0 -6
  95. package/dist/cjs/types/methods/update-interface.js.map +0 -1
  96. package/dist/cjs/types/permissions.js +0 -6
  97. package/dist/cjs/types/permissions.js.map +0 -1
  98. package/dist/cjs/types/provider.js +0 -6
  99. package/dist/cjs/types/provider.js.map +0 -1
  100. package/dist/cjs/types/snap.js +0 -6
  101. package/dist/cjs/types/snap.js.map +0 -1
  102. package/dist/cjs/ui/builder.js +0 -44
  103. package/dist/cjs/ui/builder.js.map +0 -1
  104. package/dist/cjs/ui/component.js +0 -29
  105. package/dist/cjs/ui/component.js.map +0 -1
  106. package/dist/cjs/ui/components/address.js +0 -30
  107. package/dist/cjs/ui/components/address.js.map +0 -1
  108. package/dist/cjs/ui/components/button.js +0 -59
  109. package/dist/cjs/ui/components/button.js.map +0 -1
  110. package/dist/cjs/ui/components/copyable.js +0 -32
  111. package/dist/cjs/ui/components/copyable.js.map +0 -1
  112. package/dist/cjs/ui/components/divider.js +0 -27
  113. package/dist/cjs/ui/components/divider.js.map +0 -1
  114. package/dist/cjs/ui/components/form.js +0 -41
  115. package/dist/cjs/ui/components/form.js.map +0 -1
  116. package/dist/cjs/ui/components/heading.js +0 -30
  117. package/dist/cjs/ui/components/heading.js.map +0 -1
  118. package/dist/cjs/ui/components/image.js +0 -42
  119. package/dist/cjs/ui/components/image.js.map +0 -1
  120. package/dist/cjs/ui/components/index.js +0 -54
  121. package/dist/cjs/ui/components/index.js.map +0 -1
  122. package/dist/cjs/ui/components/input.js +0 -52
  123. package/dist/cjs/ui/components/input.js.map +0 -1
  124. package/dist/cjs/ui/components/panel.js +0 -65
  125. package/dist/cjs/ui/components/panel.js.map +0 -1
  126. package/dist/cjs/ui/components/row.js +0 -57
  127. package/dist/cjs/ui/components/row.js.map +0 -1
  128. package/dist/cjs/ui/components/spinner.js +0 -27
  129. package/dist/cjs/ui/components/spinner.js.map +0 -1
  130. package/dist/cjs/ui/components/text.js +0 -32
  131. package/dist/cjs/ui/components/text.js.map +0 -1
  132. package/dist/cjs/ui/index.js +0 -28
  133. package/dist/cjs/ui/index.js.map +0 -1
  134. package/dist/cjs/ui/nodes.js +0 -46
  135. package/dist/cjs/ui/nodes.js.map +0 -1
  136. package/dist/esm/error-wrappers.js +0 -128
  137. package/dist/esm/error-wrappers.js.map +0 -1
  138. package/dist/esm/errors.js +0 -155
  139. package/dist/esm/errors.js.map +0 -1
  140. package/dist/esm/images.js +0 -84
  141. package/dist/esm/images.js.map +0 -1
  142. package/dist/esm/index.js +0 -10
  143. package/dist/esm/index.js.map +0 -1
  144. package/dist/esm/internals/error-wrappers.js +0 -39
  145. package/dist/esm/internals/error-wrappers.js.map +0 -1
  146. package/dist/esm/internals/errors.js +0 -58
  147. package/dist/esm/internals/errors.js.map +0 -1
  148. package/dist/esm/internals/helpers.js +0 -3
  149. package/dist/esm/internals/helpers.js.map +0 -1
  150. package/dist/esm/internals/index.js +0 -7
  151. package/dist/esm/internals/index.js.map +0 -1
  152. package/dist/esm/internals/structs.js +0 -59
  153. package/dist/esm/internals/structs.js.map +0 -1
  154. package/dist/esm/internals/svg.js +0 -41
  155. package/dist/esm/internals/svg.js.map +0 -1
  156. package/dist/esm/types/caip.js +0 -7
  157. package/dist/esm/types/caip.js.map +0 -1
  158. package/dist/esm/types/global.js +0 -3
  159. package/dist/esm/types/global.js.map +0 -1
  160. package/dist/esm/types/handlers/cronjob.js +0 -3
  161. package/dist/esm/types/handlers/cronjob.js.map +0 -1
  162. package/dist/esm/types/handlers/home-page.js +0 -3
  163. package/dist/esm/types/handlers/home-page.js.map +0 -1
  164. package/dist/esm/types/handlers/index.js +0 -11
  165. package/dist/esm/types/handlers/index.js.map +0 -1
  166. package/dist/esm/types/handlers/keyring.js +0 -3
  167. package/dist/esm/types/handlers/keyring.js.map +0 -1
  168. package/dist/esm/types/handlers/lifecycle.js +0 -3
  169. package/dist/esm/types/handlers/lifecycle.js.map +0 -1
  170. package/dist/esm/types/handlers/name-lookup.js +0 -3
  171. package/dist/esm/types/handlers/name-lookup.js.map +0 -1
  172. package/dist/esm/types/handlers/rpc-request.js +0 -3
  173. package/dist/esm/types/handlers/rpc-request.js.map +0 -1
  174. package/dist/esm/types/handlers/signature.js +0 -3
  175. package/dist/esm/types/handlers/signature.js.map +0 -1
  176. package/dist/esm/types/handlers/transaction.js +0 -6
  177. package/dist/esm/types/handlers/transaction.js.map +0 -1
  178. package/dist/esm/types/handlers/user-input.js +0 -24
  179. package/dist/esm/types/handlers/user-input.js.map +0 -1
  180. package/dist/esm/types/index.js +0 -12
  181. package/dist/esm/types/index.js.map +0 -1
  182. package/dist/esm/types/interface.js +0 -12
  183. package/dist/esm/types/interface.js.map +0 -1
  184. package/dist/esm/types/methods/create-interface.js +0 -3
  185. package/dist/esm/types/methods/create-interface.js.map +0 -1
  186. package/dist/esm/types/methods/dialog.js +0 -8
  187. package/dist/esm/types/methods/dialog.js.map +0 -1
  188. package/dist/esm/types/methods/get-bip32-entropy.js +0 -3
  189. package/dist/esm/types/methods/get-bip32-entropy.js.map +0 -1
  190. package/dist/esm/types/methods/get-bip32-public-key.js +0 -3
  191. package/dist/esm/types/methods/get-bip32-public-key.js.map +0 -1
  192. package/dist/esm/types/methods/get-bip44-entropy.js +0 -3
  193. package/dist/esm/types/methods/get-bip44-entropy.js.map +0 -1
  194. package/dist/esm/types/methods/get-client-status.js +0 -7
  195. package/dist/esm/types/methods/get-client-status.js.map +0 -1
  196. package/dist/esm/types/methods/get-entropy.js +0 -3
  197. package/dist/esm/types/methods/get-entropy.js.map +0 -1
  198. package/dist/esm/types/methods/get-file.js +0 -8
  199. package/dist/esm/types/methods/get-file.js.map +0 -1
  200. package/dist/esm/types/methods/get-interface-state.js +0 -3
  201. package/dist/esm/types/methods/get-interface-state.js.map +0 -1
  202. package/dist/esm/types/methods/get-locale.js +0 -7
  203. package/dist/esm/types/methods/get-locale.js.map +0 -1
  204. package/dist/esm/types/methods/get-snaps.js +0 -3
  205. package/dist/esm/types/methods/get-snaps.js.map +0 -1
  206. package/dist/esm/types/methods/index.js +0 -21
  207. package/dist/esm/types/methods/index.js.map +0 -1
  208. package/dist/esm/types/methods/invoke-keyring.js +0 -3
  209. package/dist/esm/types/methods/invoke-keyring.js.map +0 -1
  210. package/dist/esm/types/methods/invoke-snap.js +0 -3
  211. package/dist/esm/types/methods/invoke-snap.js.map +0 -1
  212. package/dist/esm/types/methods/manage-accounts.js +0 -3
  213. package/dist/esm/types/methods/manage-accounts.js.map +0 -1
  214. package/dist/esm/types/methods/manage-state.js +0 -8
  215. package/dist/esm/types/methods/manage-state.js.map +0 -1
  216. package/dist/esm/types/methods/methods.js +0 -3
  217. package/dist/esm/types/methods/methods.js.map +0 -1
  218. package/dist/esm/types/methods/notify.js +0 -7
  219. package/dist/esm/types/methods/notify.js.map +0 -1
  220. package/dist/esm/types/methods/request-snaps.js +0 -3
  221. package/dist/esm/types/methods/request-snaps.js.map +0 -1
  222. package/dist/esm/types/methods/update-interface.js +0 -3
  223. package/dist/esm/types/methods/update-interface.js.map +0 -1
  224. package/dist/esm/types/permissions.js +0 -3
  225. package/dist/esm/types/permissions.js.map +0 -1
  226. package/dist/esm/types/provider.js +0 -3
  227. package/dist/esm/types/provider.js.map +0 -1
  228. package/dist/esm/types/snap.js +0 -3
  229. package/dist/esm/types/snap.js.map +0 -1
  230. package/dist/esm/ui/builder.js +0 -50
  231. package/dist/esm/ui/builder.js.map +0 -1
  232. package/dist/esm/ui/component.js +0 -23
  233. package/dist/esm/ui/component.js.map +0 -1
  234. package/dist/esm/ui/components/address.js +0 -22
  235. package/dist/esm/ui/components/address.js.map +0 -1
  236. package/dist/esm/ui/components/button.js +0 -50
  237. package/dist/esm/ui/components/button.js.map +0 -1
  238. package/dist/esm/ui/components/copyable.js +0 -27
  239. package/dist/esm/ui/components/copyable.js.map +0 -1
  240. package/dist/esm/ui/components/divider.js +0 -15
  241. package/dist/esm/ui/components/divider.js.map +0 -1
  242. package/dist/esm/ui/components/form.js +0 -39
  243. package/dist/esm/ui/components/form.js.map +0 -1
  244. package/dist/esm/ui/components/heading.js +0 -22
  245. package/dist/esm/ui/components/heading.js.map +0 -1
  246. package/dist/esm/ui/components/image.js +0 -37
  247. package/dist/esm/ui/components/image.js.map +0 -1
  248. package/dist/esm/ui/components/index.js +0 -14
  249. package/dist/esm/ui/components/index.js.map +0 -1
  250. package/dist/esm/ui/components/input.js +0 -47
  251. package/dist/esm/ui/components/input.js.map +0 -1
  252. package/dist/esm/ui/components/panel.js +0 -66
  253. package/dist/esm/ui/components/panel.js.map +0 -1
  254. package/dist/esm/ui/components/row.js +0 -50
  255. package/dist/esm/ui/components/row.js.map +0 -1
  256. package/dist/esm/ui/components/spinner.js +0 -15
  257. package/dist/esm/ui/components/spinner.js.map +0 -1
  258. package/dist/esm/ui/components/text.js +0 -29
  259. package/dist/esm/ui/components/text.js.map +0 -1
  260. package/dist/esm/ui/index.js +0 -5
  261. package/dist/esm/ui/index.js.map +0 -1
  262. package/dist/esm/ui/nodes.js +0 -29
  263. package/dist/esm/ui/nodes.js.map +0 -1
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=get-snaps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/get-snaps.ts"],"sourcesContent":["import type { JsonRpcError } from '@metamask/utils';\n\nimport type { Snap, SnapId } from '../snap';\n\n/**\n * The request parameters for the `wallet_getSnaps` method.\n *\n * This method does not accept any parameters.\n */\nexport type GetSnapsParams = never;\n\n/**\n * The result returned by the `wallet_getSnaps` method.\n *\n * It consists of a map of Snap IDs to either the Snap object or an error.\n */\nexport type GetSnapsResult = Record<SnapId, { error: JsonRpcError } | Snap>;\n"],"names":[],"mappings":"AAAA,WAgB4E"}
@@ -1,21 +0,0 @@
1
- export * from './create-interface';
2
- export * from './dialog';
3
- export * from './get-bip32-entropy';
4
- export * from './get-bip32-public-key';
5
- export * from './get-bip44-entropy';
6
- export * from './get-client-status';
7
- export * from './get-entropy';
8
- export * from './get-file';
9
- export * from './get-interface-state';
10
- export * from './get-locale';
11
- export * from './get-snaps';
12
- export * from './invoke-keyring';
13
- export * from './invoke-snap';
14
- export * from './manage-accounts';
15
- export * from './manage-state';
16
- export * from './methods';
17
- export * from './notify';
18
- export * from './request-snaps';
19
- export * from './update-interface';
20
-
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/index.ts"],"sourcesContent":["export * from './create-interface';\nexport * from './dialog';\nexport * from './get-bip32-entropy';\nexport * from './get-bip32-public-key';\nexport * from './get-bip44-entropy';\nexport * from './get-client-status';\nexport * from './get-entropy';\nexport * from './get-file';\nexport * from './get-interface-state';\nexport * from './get-locale';\nexport * from './get-snaps';\nexport * from './invoke-keyring';\nexport * from './invoke-snap';\nexport * from './manage-accounts';\nexport * from './manage-state';\nexport * from './methods';\nexport * from './notify';\nexport * from './request-snaps';\nexport * from './update-interface';\n"],"names":[],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,WAAW;AACzB,cAAc,sBAAsB;AACpC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,aAAa;AAC3B,cAAc,wBAAwB;AACtC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,kBAAkB;AAChC,cAAc,qBAAqB"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=invoke-keyring.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/invoke-keyring.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\nimport type { InvokeSnapParams } from './invoke-snap';\n\n/**\n * The request parameters for the `wallet_invokeKeyring` method.\n *\n * @property snapId - The ID of the snap to invoke.\n * @property request - The JSON-RPC request to send to the snap.\n */\nexport type InvokeKeyringParams = InvokeSnapParams;\n\n/**\n * The result returned by the `wallet_invokeKeyring` method, which is the result\n * returned by the Snap.\n */\nexport type InvokeKeyringResult = Json;\n"],"names":[],"mappings":"AAAA,WAgBuC"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=invoke-snap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/invoke-snap.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * The request parameters for the `wallet_invokeSnap` method.\n *\n * @property snapId - The ID of the Snap to invoke.\n * @property request - The JSON-RPC request to send to the Snap.\n */\nexport type InvokeSnapParams = {\n snapId: string;\n request: Record<string, Json>;\n};\n\n/**\n * The result returned by the `wallet_invokeSnap` method, which is the result\n * returned by the Snap.\n */\nexport type InvokeSnapResult = Json;\n"],"names":[],"mappings":"AAAA,WAiBoC"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=manage-accounts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/manage-accounts.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * The request parameters for the `snap_manageAccounts` method.\n *\n * @property method - The method to call on the Snap.\n * @property params - The optional parameters to pass to the Snap method.\n */\nexport type ManageAccountsParams =\n | {\n method: string;\n }\n | {\n method: string;\n params: Json[] | Record<string, Json>;\n };\n\n/**\n * The result returned by the `snap_manageAccounts` method, which is the result\n * returned by the Snap.\n */\nexport type ManageAccountsResult = Json;\n"],"names":[],"mappings":"AAAA,WAqBwC"}
@@ -1,8 +0,0 @@
1
- export var ManageStateOperation;
2
- (function(ManageStateOperation) {
3
- ManageStateOperation["ClearState"] = 'clear';
4
- ManageStateOperation["GetState"] = 'get';
5
- ManageStateOperation["UpdateState"] = 'update';
6
- })(ManageStateOperation || (ManageStateOperation = {}));
7
-
8
- //# sourceMappingURL=manage-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/manage-state.ts"],"sourcesContent":["import type { Json } from '@metamask/utils';\n\nimport type { EnumToUnion } from '../../internals';\n\n/**\n * The operations that can be performed on the state.\n */\nexport enum ManageStateOperation {\n ClearState = 'clear',\n GetState = 'get',\n UpdateState = 'update',\n}\n\n/**\n * The clear state operation, which clears the state.\n *\n * @property operation - The operation to perform on the state. Must be `clear`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type ClearStateOperation = {\n operation: EnumToUnion<ManageStateOperation.ClearState>;\n encrypted?: boolean;\n};\n\n/**\n * The get state operation, which retrieves the state.\n *\n * @property operation - The operation to perform on the state. Must be `get`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n */\nexport type GetStateOperation = {\n operation: EnumToUnion<ManageStateOperation.GetState>;\n encrypted?: boolean;\n};\n\n/**\n * The update state operation, which updates the state.\n *\n * @property operation - The operation to perform on the state. Must be\n * `update`.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state. Encrypted state can only\n * be used if the extension is unlocked, while unencrypted state can be used\n * whether the extension is locked or unlocked.\n * @property newState - The new state to set.\n */\nexport type UpdateStateOperation = {\n operation: EnumToUnion<ManageStateOperation.UpdateState>;\n encrypted?: boolean;\n newState: Record<string, Json>;\n};\n\n/**\n * The request parameters for the `snap_manageState` method.\n *\n * @property operation - The operation to perform on the state.\n * @property encrypted - Whether to use the separate encrypted state, or the\n * unencrypted state. Defaults to the encrypted state.\n * @property newState - The new state to set. Only applicable for the `set`\n * operation.\n */\nexport type ManageStateParams =\n | ClearStateOperation\n | GetStateOperation\n | UpdateStateOperation;\n\n/**\n * The result returned by the `snap_manageState` method.\n *\n * If the operation is `get`, the result is the state. Otherwise, the result is\n * `null`.\n */\nexport type ManageStateResult = Record<string, Json> | null;\n"],"names":["ManageStateOperation","ClearState","GetState","UpdateState"],"mappings":"WAOO;UAAKA,oBAAoB;IAApBA,qBACVC,gBAAa;IADHD,qBAEVE,cAAW;IAFDF,qBAGVG,iBAAc;GAHJH,yBAAAA"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=methods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/methods.ts"],"sourcesContent":["import type { Method } from '../../internals';\nimport type {\n CreateInterfaceParams,\n CreateInterfaceResult,\n} from './create-interface';\nimport type { DialogParams, DialogResult } from './dialog';\nimport type {\n GetBip32EntropyParams,\n GetBip32EntropyResult,\n} from './get-bip32-entropy';\nimport type {\n GetBip32PublicKeyParams,\n GetBip32PublicKeyResult,\n} from './get-bip32-public-key';\nimport type {\n GetBip44EntropyParams,\n GetBip44EntropyResult,\n} from './get-bip44-entropy';\nimport type {\n GetClientStatusParams,\n GetClientStatusResult,\n} from './get-client-status';\nimport type { GetEntropyParams, GetEntropyResult } from './get-entropy';\nimport type { GetFileParams, GetFileResult } from './get-file';\nimport type {\n GetInterfaceStateParams,\n GetInterfaceStateResult,\n} from './get-interface-state';\nimport type { GetLocaleParams, GetLocaleResult } from './get-locale';\nimport type { GetSnapsParams, GetSnapsResult } from './get-snaps';\nimport type {\n InvokeKeyringParams,\n InvokeKeyringResult,\n} from './invoke-keyring';\nimport type { InvokeSnapParams, InvokeSnapResult } from './invoke-snap';\nimport type {\n ManageAccountsParams,\n ManageAccountsResult,\n} from './manage-accounts';\nimport type { ManageStateParams, ManageStateResult } from './manage-state';\nimport type { NotifyParams, NotifyResult } from './notify';\nimport type { RequestSnapsParams, RequestSnapsResult } from './request-snaps';\nimport type {\n UpdateInterfaceParams,\n UpdateInterfaceResult,\n} from './update-interface';\n\n/**\n * The methods that are available to the Snap. Each method is a tuple of the\n * request parameters and the result returned by the method.\n */\nexport type SnapMethods = {\n /* eslint-disable @typescript-eslint/naming-convention */\n snap_dialog: [DialogParams, DialogResult];\n snap_getBip32Entropy: [GetBip32EntropyParams, GetBip32EntropyResult];\n snap_getBip32PublicKey: [GetBip32PublicKeyParams, GetBip32PublicKeyResult];\n snap_getBip44Entropy: [GetBip44EntropyParams, GetBip44EntropyResult];\n snap_getClientStatus: [GetClientStatusParams, GetClientStatusResult];\n snap_getEntropy: [GetEntropyParams, GetEntropyResult];\n snap_getFile: [GetFileParams, GetFileResult];\n snap_getLocale: [GetLocaleParams, GetLocaleResult];\n snap_manageAccounts: [ManageAccountsParams, ManageAccountsResult];\n snap_manageState: [ManageStateParams, ManageStateResult];\n snap_notify: [NotifyParams, NotifyResult];\n snap_createInterface: [CreateInterfaceParams, CreateInterfaceResult];\n snap_updateInterface: [UpdateInterfaceParams, UpdateInterfaceResult];\n snap_getInterfaceState: [GetInterfaceStateParams, GetInterfaceStateResult];\n wallet_getSnaps: [GetSnapsParams, GetSnapsResult];\n wallet_invokeKeyring: [InvokeKeyringParams, InvokeKeyringResult];\n wallet_invokeSnap: [InvokeSnapParams, InvokeSnapResult];\n wallet_snap: [InvokeSnapParams, InvokeSnapResult];\n wallet_requestSnaps: [RequestSnapsParams, RequestSnapsResult];\n /* eslint-enable @typescript-eslint/naming-convention */\n};\n\n/**\n * The request function that is available to the Snap. It takes a request\n * object and returns a promise that resolves to the result of the request.\n *\n * @param request - The request object.\n * @param request.method - The method to call.\n * @param request.params - The parameters to pass to the method. This is\n * inferred from the method, based on the {@link SnapMethods} type, and may be\n * optional.\n * @returns A promise that resolves to the result of the request. This is\n * inferred from the request method, based on the {@link SnapMethods} type.\n * @example\n * // Get the user's locale\n * const result = await request({\n * method: 'snap_getLocale',\n * });\n * @example\n * // Get a file\n * const result = await request({\n * method: 'snap_getFile',\n * params: {\n * path: 'foo/bar.txt',\n * },\n * });\n */\nexport type RequestFunction = <MethodName extends keyof SnapMethods>(\n request: Method<MethodName, SnapMethods[MethodName][0]>,\n) => Promise<SnapMethods[MethodName][1]>;\n"],"names":[],"mappings":"AAAA,WAsGyC"}
@@ -1,7 +0,0 @@
1
- export var NotificationType;
2
- (function(NotificationType) {
3
- NotificationType["InApp"] = 'inApp';
4
- NotificationType["Native"] = 'native';
5
- })(NotificationType || (NotificationType = {}));
6
-
7
- //# sourceMappingURL=notify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/notify.ts"],"sourcesContent":["import type { EnumToUnion } from '../../internals';\n\n/**\n * The types of notifications that can be displayed.\n *\n * - `InApp` - A notification that is displayed in by the MetaMask extension.\n * - `Native` - A notification that is displayed by the operating system.\n */\nexport enum NotificationType {\n InApp = 'inApp',\n Native = 'native',\n}\n\n/**\n * The request parameters for the `snap_notify` method.\n *\n * @property type - The type of notification to display.\n * @property message - The message to display in the notification.\n */\nexport type NotifyParams = {\n type: EnumToUnion<NotificationType>;\n message: string;\n};\n\n/**\n * The result returned by the `snap_notify` method.\n *\n * This method does not return anything.\n */\nexport type NotifyResult = null;\n"],"names":["NotificationType","InApp","Native"],"mappings":"WAQO;UAAKA,gBAAgB;IAAhBA,iBACVC,WAAQ;IADED,iBAEVE,YAAS;GAFCF,qBAAAA"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=request-snaps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/request-snaps.ts"],"sourcesContent":["import type { JsonRpcError } from '@metamask/utils';\n\nimport type { Snap } from '../snap';\n\n/**\n * The request parameters for the `wallet_requestSnaps` method.\n *\n * It consists of a map of Snap IDs to optional version strings to request.\n */\nexport type RequestSnapsParams = Record<string, { version?: string }>;\n\n/**\n * The result returned by the `wallet_requestSnaps` method.\n *\n * It consists of a map of Snap IDs to either the Snap object or an error.\n */\nexport type RequestSnapsResult = Record<string, { error: JsonRpcError } | Snap>;\n"],"names":[],"mappings":"AAAA,WAgBgF"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=update-interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/types/methods/update-interface.ts"],"sourcesContent":["import type { Component } from '../../ui';\n\n/**\n * The request parameters for the `snap_createInterface` method.\n *\n * @property id - The interface id.\n * @property ui - The components to display in the interface.\n */\nexport type UpdateInterfaceParams = {\n id: string;\n ui: Component;\n};\n\n/**\n * The result returned by the `snap_updateInterface` method.\n */\nexport type UpdateInterfaceResult = null;\n"],"names":[],"mappings":"AAAA,WAgByC"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=permissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/permissions.ts"],"sourcesContent":["import type { JsonRpcRequest } from '@metamask/utils';\n\nimport type { ChainId } from './caip';\n\nexport type EmptyObject = Record<string, never>;\n\nexport type Cronjob = {\n expression: string;\n request: Omit<JsonRpcRequest, 'jsonrpc' | 'id'>;\n};\n\nexport type Bip32Entropy = {\n curve: 'secp256k1' | 'ed25519';\n path: string[];\n};\n\nexport type Bip44Entropy = {\n coinType: number;\n};\n\nexport type RequestedSnap = {\n version?: string;\n};\n\nexport type InitialPermissions = Partial<{\n 'endowment:cronjob': {\n jobs: Cronjob[];\n maxRequestTime?: number;\n };\n 'endowment:ethereum-provider': EmptyObject;\n 'endowment:keyring': {\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:lifecycle-hooks'?: {\n maxRequestTime?: number;\n };\n 'endowment:name-lookup': {\n chains?: ChainId[];\n matchers?: { tlds?: string[]; schemes?: string[] };\n maxRequestTime?: number;\n };\n 'endowment:network-access': EmptyObject;\n 'endowment:page-home'?: {\n maxRequestTime?: number;\n };\n 'endowment:rpc': {\n dapps?: boolean;\n snaps?: boolean;\n allowedOrigins?: string[];\n maxRequestTime?: number;\n };\n 'endowment:signature-insight': {\n allowSignatureOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:transaction-insight': {\n allowTransactionOrigin?: boolean;\n maxRequestTime?: number;\n };\n 'endowment:webassembly': EmptyObject;\n\n /* eslint-disable @typescript-eslint/naming-convention */\n snap_dialog: EmptyObject;\n snap_getBip32Entropy: Bip32Entropy[];\n snap_getBip32PublicKey: Bip32Entropy[];\n snap_getBip44Entropy: Bip44Entropy[];\n snap_getEntropy: EmptyObject;\n snap_getLocale: EmptyObject;\n snap_manageAccounts: EmptyObject;\n snap_manageState: EmptyObject;\n snap_notify: EmptyObject;\n wallet_snap: Record<string, RequestedSnap>;\n /* eslint-enable @typescript-eslint/naming-convention */\n}>;\n"],"names":[],"mappings":"AAAA,WA0EG"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/provider.ts"],"sourcesContent":["import type { BaseProvider } from '@metamask/providers';\n\nimport type { RequestFunction } from './methods';\n\ntype BaseProviderInstance = InstanceType<typeof BaseProvider>;\n\n/**\n * The `window.ethereum` provider for Snaps.\n */\nexport type SnapsEthereumProvider = Pick<\n BaseProviderInstance,\n // Snaps have access to a limited set of methods. This is enforced by the\n // `proxyStreamProvider` function in `@metamask/snaps-execution-environments`.\n 'request' | 'on' | 'removeListener'\n>;\n\n/**\n * The `window.snap` provider.\n */\nexport type SnapsProvider = {\n request: RequestFunction;\n};\n"],"names":[],"mappings":"AAAA,WAqBE"}
@@ -1,3 +0,0 @@
1
- export { };
2
-
3
- //# sourceMappingURL=snap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/types/snap.ts"],"sourcesContent":["import type { SemVerVersion, Opaque } from '@metamask/utils';\n\nimport type { InitialPermissions } from './permissions';\n\nexport type SnapId = Opaque<string, typeof snapIdSymbol>;\ndeclare const snapIdSymbol: unique symbol;\n\nexport type Snap = {\n id: SnapId;\n initialPermissions: InitialPermissions;\n version: SemVerVersion;\n enabled: boolean;\n blocked: boolean;\n};\n"],"names":[],"mappings":"AAAA,WAaE"}
@@ -1,50 +0,0 @@
1
- import { assertStruct, isPlainObject } from '@metamask/utils';
2
- /**
3
- * A function that returns a function to "build" a {@link Component}. It infers
4
- * the type of the component from the given struct, and performs validation on
5
- * the created component.
6
- *
7
- * The returned function can handle the node arguments in two ways:
8
- * 1. As a single object, with the keys corresponding to the node's properties,
9
- * excluding the `type` property.
10
- * 2. As an array of arguments, with the order corresponding to the given keys.
11
- *
12
- * @param type - The type of the component to build.
13
- * @param struct - The struct to use to validate the component.
14
- * @param keys - The keys of the component to use as arguments to the builder.
15
- * The order of the keys determines the order of the arguments.
16
- * @returns A function that builds a component of the given type.
17
- * @internal
18
- */ export function createBuilder(type, struct, keys = []) {
19
- return (...args)=>{
20
- // Node passed as a single object.
21
- if (args.length === 1 && isPlainObject(args[0])) {
22
- const node = {
23
- ...args[0],
24
- type
25
- };
26
- // The user could be passing invalid values to the builder, so we need to
27
- // validate them as per the component's struct.
28
- assertStruct(node, struct, `Invalid ${type} component`);
29
- return node;
30
- }
31
- // Node passed as an array of arguments.
32
- const node = keys.reduce((partialNode, key, index)=>{
33
- if (args[index] !== undefined) {
34
- return {
35
- ...partialNode,
36
- [key]: args[index]
37
- };
38
- }
39
- return partialNode;
40
- }, {
41
- type
42
- });
43
- // The user could be passing invalid values to the builder, so we need to
44
- // validate them as per the component's struct.
45
- assertStruct(node, struct, `Invalid ${type} component`);
46
- return node;
47
- };
48
- }
49
-
50
- //# sourceMappingURL=builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/ui/builder.ts"],"sourcesContent":["import { assertStruct, isPlainObject } from '@metamask/utils';\nimport type { Struct } from 'superstruct';\n\nimport type { Component } from './components';\nimport type { NodeType } from './nodes';\n\n/**\n * A function that builds a {@link Component}. This infers the proper args type\n * from the given node.\n *\n * @internal\n */\ntype NodeBuilder<Node extends Component, Keys extends (keyof Node)[]> = Omit<\n Node,\n 'type'\n> extends Record<string, never>\n ? (...args: []) => Node\n : (...args: [Omit<Node, 'type'>] | NodeArrayType<Node, Keys>) => Node;\n\n/**\n * Map from an array of node keys to the corresponding array type.\n *\n * @example\n * type Node = { type: 'node'; a: string; b: number; c: boolean };\n * type Keys = ['a', 'b', 'c'];\n *\n * type NodeArray = NodeArrayType<Node, Keys>; // [string, number, boolean]\n * @internal\n */\ntype NodeArrayType<Node extends Component, Keys extends (keyof Node)[]> = {\n [Key in keyof Keys]: Node[Keys[Key]];\n};\n\n/**\n * A function that returns a function to \"build\" a {@link Component}. It infers\n * the type of the component from the given struct, and performs validation on\n * the created component.\n *\n * The returned function can handle the node arguments in two ways:\n * 1. As a single object, with the keys corresponding to the node's properties,\n * excluding the `type` property.\n * 2. As an array of arguments, with the order corresponding to the given keys.\n *\n * @param type - The type of the component to build.\n * @param struct - The struct to use to validate the component.\n * @param keys - The keys of the component to use as arguments to the builder.\n * The order of the keys determines the order of the arguments.\n * @returns A function that builds a component of the given type.\n * @internal\n */\nexport function createBuilder<\n Node extends Component,\n Keys extends (keyof Node)[] = [],\n>(\n type: NodeType,\n struct: Struct<Node>,\n keys: Keys = [] as unknown as Keys,\n): NodeBuilder<Node, Keys> {\n return (...args: [Omit<Node, 'type'>] | NodeArrayType<Node, Keys> | []) => {\n // Node passed as a single object.\n if (args.length === 1 && isPlainObject(args[0])) {\n const node = { ...args[0], type };\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n }\n\n // Node passed as an array of arguments.\n const node = keys.reduce<Partial<Component>>(\n (partialNode, key, index) => {\n if (args[index] !== undefined) {\n return {\n ...partialNode,\n [key]: args[index],\n };\n }\n\n return partialNode;\n },\n { type },\n );\n\n // The user could be passing invalid values to the builder, so we need to\n // validate them as per the component's struct.\n assertStruct(node, struct, `Invalid ${type} component`);\n return node;\n };\n}\n"],"names":["assertStruct","isPlainObject","createBuilder","type","struct","keys","args","length","node","reduce","partialNode","key","index","undefined"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,kBAAkB;AAiC9D;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,cAIdC,IAAc,EACdC,MAAoB,EACpBC,OAAa,EAAE,AAAmB;IAElC,OAAO,CAAC,GAAGC;QACT,kCAAkC;QAClC,IAAIA,KAAKC,MAAM,KAAK,KAAKN,cAAcK,IAAI,CAAC,EAAE,GAAG;YAC/C,MAAME,OAAO;gBAAE,GAAGF,IAAI,CAAC,EAAE;gBAAEH;YAAK;YAEhC,yEAAyE;YACzE,+CAA+C;YAC/CH,aAAaQ,MAAMJ,QAAQ,CAAC,QAAQ,EAAED,KAAK,UAAU,CAAC;YACtD,OAAOK;QACT;QAEA,wCAAwC;QACxC,MAAMA,OAAOH,KAAKI,MAAM,CACtB,CAACC,aAAaC,KAAKC;YACjB,IAAIN,IAAI,CAACM,MAAM,KAAKC,WAAW;gBAC7B,OAAO;oBACL,GAAGH,WAAW;oBACd,CAACC,IAAI,EAAEL,IAAI,CAACM,MAAM;gBACpB;YACF;YAEA,OAAOF;QACT,GACA;YAAEP;QAAK;QAGT,yEAAyE;QACzE,+CAA+C;QAC/CH,aAAaQ,MAAMJ,QAAQ,CAAC,QAAQ,EAAED,KAAK,UAAU,CAAC;QACtD,OAAOK;IACT;AACF"}
@@ -1,23 +0,0 @@
1
- import { assertStruct } from '@metamask/utils';
2
- import { is } from 'superstruct';
3
- import { ComponentStruct } from './components';
4
- /**
5
- * Check if the given value is a {@link Component}. This performs recursive
6
- * validation of the component's children (if any).
7
- *
8
- * @param value - The value to check.
9
- * @returns `true` if the value is a {@link Component}, `false` otherwise.
10
- */ export function isComponent(value) {
11
- return is(value, ComponentStruct);
12
- }
13
- /**
14
- * Assert that the given value is a {@link Component}. This performs recursive
15
- * validation of the component's children (if any).
16
- *
17
- * @param value - The value to check.
18
- * @throws If the value is not a {@link Component}.
19
- */ export function assertIsComponent(value) {
20
- assertStruct(value, ComponentStruct, 'Invalid component');
21
- }
22
-
23
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/ui/component.ts"],"sourcesContent":["import { assertStruct } from '@metamask/utils';\nimport { is } from 'superstruct';\n\nimport { ComponentStruct } from './components';\nimport type { Component } from './components';\n\n/**\n * Check if the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @returns `true` if the value is a {@link Component}, `false` otherwise.\n */\nexport function isComponent(value: unknown): value is Component {\n return is(value, ComponentStruct);\n}\n\n/**\n * Assert that the given value is a {@link Component}. This performs recursive\n * validation of the component's children (if any).\n *\n * @param value - The value to check.\n * @throws If the value is not a {@link Component}.\n */\nexport function assertIsComponent(value: unknown): asserts value is Component {\n assertStruct(value, ComponentStruct, 'Invalid component');\n}\n"],"names":["assertStruct","is","ComponentStruct","isComponent","value","assertIsComponent"],"mappings":"AAAA,SAASA,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,cAAc;AAEjC,SAASC,eAAe,QAAQ,eAAe;AAG/C;;;;;;CAMC,GACD,OAAO,SAASC,YAAYC,KAAc;IACxC,OAAOH,GAAGG,OAAOF;AACnB;AAEA;;;;;;CAMC,GACD,OAAO,SAASG,kBAAkBD,KAAc;IAC9CJ,aAAaI,OAAOF,iBAAiB;AACvC"}
@@ -1,22 +0,0 @@
1
- import { assign, literal, object, pattern, string } from 'superstruct';
2
- import { createBuilder } from '../builder';
3
- import { LiteralStruct, NodeType } from '../nodes';
4
- export const AddressStruct = assign(LiteralStruct, object({
5
- type: literal(NodeType.Address),
6
- value: pattern(string(), /0x[a-fA-F0-9]{40}/u)
7
- }));
8
- /**
9
- * Create an {@link Address} node.
10
- *
11
- * @param args - The node arguments. This can either be a string, or an object
12
- * with the `value` property.
13
- * @param args.value - The address to be rendered.
14
- * @returns The address node as an object.
15
- * @example
16
- * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });
17
- * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');
18
- */ export const address = createBuilder(NodeType.Address, AddressStruct, [
19
- 'value'
20
- ]);
21
-
22
- //# sourceMappingURL=address.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/address.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { assign, literal, object, pattern, string } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const AddressStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Address),\n value: pattern(string(), /0x[a-fA-F0-9]{40}/u),\n }),\n);\n\n/**\n * A address node, that renders an EVM-like address and its icon.\n *\n * @property type - The type of the node. Must be the string `address`.\n * @property value - The address in hexadecimal, including 0x.\n */\nexport type Address = Infer<typeof AddressStruct>;\n\n/**\n * Create an {@link Address} 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 address to be rendered.\n * @returns The address node as an object.\n * @example\n * const node = address({ value: '0x4bbeeb066ed09b7aed07bf39eee0460dfa261520' });\n * const node = address('0x4bbeeb066ed09b7aed07bf39eee0460dfa261520');\n */\nexport const address = createBuilder(NodeType.Address, AddressStruct, [\n 'value',\n]);\n"],"names":["assign","literal","object","pattern","string","createBuilder","LiteralStruct","NodeType","AddressStruct","type","Address","value","address"],"mappings":"AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,QAAQ,cAAc;AAEvE,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,WAAW;AAEnD,OAAO,MAAMC,gBAAgBR,OAC3BM,eACAJ,OAAO;IACLO,MAAMR,QAAQM,SAASG,OAAO;IAC9BC,OAAOR,QAAQC,UAAU;AAC3B,IACA;AAUF;;;;;;;;;;CAUC,GACD,OAAO,MAAMQ,UAAUP,cAAcE,SAASG,OAAO,EAAEF,eAAe;IACpE;CACD,EAAE"}
@@ -1,50 +0,0 @@
1
- import { assign, literal, object, optional, string, union } from 'superstruct';
2
- import { enumValue } from '../../internals';
3
- import { createBuilder } from '../builder';
4
- import { LiteralStruct, NodeType } from '../nodes';
5
- export var ButtonVariant;
6
- (function(ButtonVariant) {
7
- ButtonVariant["Primary"] = 'primary';
8
- ButtonVariant["Secondary"] = 'secondary';
9
- })(ButtonVariant || (ButtonVariant = {}));
10
- export var ButtonType;
11
- (function(ButtonType) {
12
- ButtonType["Button"] = 'button';
13
- ButtonType["Submit"] = 'submit';
14
- })(ButtonType || (ButtonType = {}));
15
- export const ButtonStruct = assign(LiteralStruct, object({
16
- type: literal(NodeType.Button),
17
- value: string(),
18
- variant: optional(union([
19
- enumValue(ButtonVariant.Primary),
20
- enumValue(ButtonVariant.Secondary)
21
- ])),
22
- buttonType: optional(union([
23
- enumValue(ButtonType.Button),
24
- enumValue(ButtonType.Submit)
25
- ])),
26
- name: optional(string())
27
- }));
28
- /**
29
- * Create a {@link Button} node.
30
- *
31
- * @param args - The node arguments. This can be either a string, or an object
32
- * with a `value` property. A set of optional properties can be passed.
33
- * @param args.variant - The optional variant of the button.
34
- * @param args.value - The text content of the node.
35
- * @param args.name - The optional name of the button.
36
- * @returns The text node as object.
37
- * @example
38
- * ```typescript
39
- * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });
40
- * const node = button('Hello, world!', 'button', 'myButton', 'primary');
41
- * const node = button('Hello, world!');
42
- * ```
43
- */ export const button = createBuilder(NodeType.Button, ButtonStruct, [
44
- 'value',
45
- 'buttonType',
46
- 'name',
47
- 'variant'
48
- ]);
49
-
50
- //# sourceMappingURL=button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/button.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { assign, literal, object, optional, string, union } from 'superstruct';\n\nimport { enumValue } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport enum ButtonVariant {\n Primary = 'primary',\n Secondary = 'secondary',\n}\n\nexport enum ButtonType {\n Button = 'button',\n Submit = 'submit',\n}\n\nexport const ButtonStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Button),\n value: string(),\n variant: optional(\n union([\n enumValue(ButtonVariant.Primary),\n enumValue(ButtonVariant.Secondary),\n ]),\n ),\n buttonType: optional(\n union([enumValue(ButtonType.Button), enumValue(ButtonType.Submit)]),\n ),\n name: optional(string()),\n }),\n);\n\n/**\n * A button node, that renders either a primary or a secondary button.\n *\n * @property type - The type of the node, must be the string 'button'.\n * @property variant - The style variant of the node, must be either 'primary' or 'secondary'.\n * @property value - The text content of the node as plain text.\n * @property buttonType - The type of the button, must be either 'button' or 'submit'.\n * @property name - An optional name to identify the button.\n */\nexport type Button = Infer<typeof ButtonStruct>;\n\n/**\n * Create a {@link Button} node.\n *\n * @param args - The node arguments. This can be either a string, or an object\n * with a `value` property. A set of optional properties can be passed.\n * @param args.variant - The optional variant of the button.\n * @param args.value - The text content of the node.\n * @param args.name - The optional name of the button.\n * @returns The text node as object.\n * @example\n * ```typescript\n * const node = button({ variant: 'primary', text: 'Hello, world!', name: 'myButton' });\n * const node = button('Hello, world!', 'button', 'myButton', 'primary');\n * const node = button('Hello, world!');\n * ```\n */\nexport const button = createBuilder(NodeType.Button, ButtonStruct, [\n 'value',\n 'buttonType',\n 'name',\n 'variant',\n]);\n"],"names":["assign","literal","object","optional","string","union","enumValue","createBuilder","LiteralStruct","NodeType","ButtonVariant","Primary","Secondary","ButtonType","Button","Submit","ButtonStruct","type","value","variant","buttonType","name","button"],"mappings":"AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,QAAQ,cAAc;AAE/E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,WAAW;WAE5C;UAAKC,aAAa;IAAbA,cACVC,aAAU;IADAD,cAEVE,eAAY;GAFFF,kBAAAA;WAKL;UAAKG,UAAU;IAAVA,WACVC,YAAS;IADCD,WAEVE,YAAS;GAFCF,eAAAA;AAKZ,OAAO,MAAMG,eAAehB,OAC1BQ,eACAN,OAAO;IACLe,MAAMhB,QAAQQ,SAASK,MAAM;IAC7BI,OAAOd;IACPe,SAAShB,SACPE,MAAM;QACJC,UAAUI,cAAcC,OAAO;QAC/BL,UAAUI,cAAcE,SAAS;KAClC;IAEHQ,YAAYjB,SACVE,MAAM;QAACC,UAAUO,WAAWC,MAAM;QAAGR,UAAUO,WAAWE,MAAM;KAAE;IAEpEM,MAAMlB,SAASC;AACjB,IACA;AAaF;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMkB,SAASf,cAAcE,SAASK,MAAM,EAAEE,cAAc;IACjE;IACA;IACA;IACA;CACD,EAAE"}
@@ -1,27 +0,0 @@
1
- import { assign, boolean, literal, object, optional, string } from 'superstruct';
2
- import { createBuilder } from '../builder';
3
- import { LiteralStruct, NodeType } from '../nodes';
4
- export const CopyableStruct = assign(LiteralStruct, object({
5
- type: literal(NodeType.Copyable),
6
- value: string(),
7
- sensitive: optional(boolean())
8
- }));
9
- /**
10
- * Create a {@link Copyable} component.
11
- *
12
- * @param args - The node arguments. This can either be a string, or an object
13
- * with the `text` property.
14
- * @param args.value - The text to be copied.
15
- * @param args.sensitive - Whether the value is sensitive or not. Sensitive
16
- * values are only displayed to the user after clicking on the component.
17
- * Defaults to false.
18
- * @returns A {@link Copyable} component.
19
- * @example
20
- * const node = copyable('Hello, world!');
21
- * const node = copyable({ value: 'Hello, world!' });
22
- */ export const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [
23
- 'value',
24
- 'sensitive'
25
- ]);
26
-
27
- //# sourceMappingURL=copyable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/copyable.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport {\n assign,\n boolean,\n literal,\n object,\n optional,\n string,\n} from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { LiteralStruct, NodeType } from '../nodes';\n\nexport const CopyableStruct = assign(\n LiteralStruct,\n object({\n type: literal(NodeType.Copyable),\n value: string(),\n sensitive: optional(boolean()),\n }),\n);\n\n/**\n * Text that can be copied to the clipboard. It can optionally be marked as\n * sensitive, in which case it will only be displayed to the user after clicking\n * on the component.\n *\n * @property type - The type of the node. Must be the string `copyable`.\n * @property value - The text to be copied.\n * @property sensitive - Whether the value is sensitive or not. Sensitive values\n * are only displayed to the user after clicking on the component. Defaults to\n * false.\n */\nexport type Copyable = Infer<typeof CopyableStruct>;\n\n/**\n * Create a {@link Copyable} component.\n *\n * @param args - The node arguments. This can either be a string, or an object\n * with the `text` property.\n * @param args.value - The text to be copied.\n * @param args.sensitive - Whether the value is sensitive or not. Sensitive\n * values are only displayed to the user after clicking on the component.\n * Defaults to false.\n * @returns A {@link Copyable} component.\n * @example\n * const node = copyable('Hello, world!');\n * const node = copyable({ value: 'Hello, world!' });\n */\nexport const copyable = createBuilder(NodeType.Copyable, CopyableStruct, [\n 'value',\n 'sensitive',\n]);\n"],"names":["assign","boolean","literal","object","optional","string","createBuilder","LiteralStruct","NodeType","CopyableStruct","type","Copyable","value","sensitive","copyable"],"mappings":"AACA,SACEA,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,QAAQ,EACRC,MAAM,QACD,cAAc;AAErB,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,WAAW;AAEnD,OAAO,MAAMC,iBAAiBT,OAC5BO,eACAJ,OAAO;IACLO,MAAMR,QAAQM,SAASG,QAAQ;IAC/BC,OAAOP;IACPQ,WAAWT,SAASH;AACtB,IACA;AAeF;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMa,WAAWR,cAAcE,SAASG,QAAQ,EAAEF,gBAAgB;IACvE;IACA;CACD,EAAE"}
@@ -1,15 +0,0 @@
1
- import { assign, literal, object } from 'superstruct';
2
- import { createBuilder } from '../builder';
3
- import { NodeStruct, NodeType } from '../nodes';
4
- export const DividerStruct = assign(NodeStruct, object({
5
- type: literal(NodeType.Divider)
6
- }));
7
- /**
8
- * Create a {@link Divider} node.
9
- *
10
- * @returns The divider node as object.
11
- * @example
12
- * const node = divider();
13
- */ export const divider = createBuilder(NodeType.Divider, DividerStruct);
14
-
15
- //# sourceMappingURL=divider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/divider.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { assign, literal, object } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\n\nexport const DividerStruct = assign(\n NodeStruct,\n object({\n type: literal(NodeType.Divider),\n }),\n);\n\n/**\n * A divider node, that renders a line between other nodes.\n */\nexport type Divider = Infer<typeof DividerStruct>;\n\n/**\n * Create a {@link Divider} node.\n *\n * @returns The divider node as object.\n * @example\n * const node = divider();\n */\nexport const divider = createBuilder(NodeType.Divider, DividerStruct);\n"],"names":["assign","literal","object","createBuilder","NodeStruct","NodeType","DividerStruct","type","Divider","divider"],"mappings":"AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,QAAQ,cAAc;AAEtD,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,WAAW;AAEhD,OAAO,MAAMC,gBAAgBN,OAC3BI,YACAF,OAAO;IACLK,MAAMN,QAAQI,SAASG,OAAO;AAChC,IACA;AAOF;;;;;;CAMC,GACD,OAAO,MAAMC,UAAUN,cAAcE,SAASG,OAAO,EAAEF,eAAe"}
@@ -1,39 +0,0 @@
1
- import { array, assign, literal, object, string, union } from 'superstruct';
2
- import { createBuilder } from '../builder';
3
- import { NodeStruct, NodeType } from '../nodes';
4
- import { ButtonStruct } from './button';
5
- import { InputStruct } from './input';
6
- export const FormComponentStruct = union([
7
- InputStruct,
8
- ButtonStruct
9
- ]);
10
- export const FormStruct = assign(NodeStruct, object({
11
- type: literal(NodeType.Form),
12
- children: array(FormComponentStruct),
13
- name: string()
14
- }));
15
- /**
16
- * Create a {@link Form} node.
17
- *
18
- * @param args - The node arguments. This can be either an array of children and a string, or
19
- * an object with a `name` and `children` property.
20
- * @param args.name - The form name used to identify it.
21
- * @param args.children - The child nodes of the form. This can be any valid
22
- * {@link FormComponent}.
23
- * @returns The form node as object.
24
- * @example
25
- * const node = form({
26
- * name: 'myForm',
27
- * children: [
28
- * input({ name: 'myInput' }),
29
- * button({ value: 'Hello, world!' }),
30
- * ],
31
- * });
32
- *
33
- * const node = form('myForm', [input('myInput'), button('Hello, world!')]);
34
- */ export const form = createBuilder(NodeType.Form, FormStruct, [
35
- 'name',
36
- 'children'
37
- ]);
38
-
39
- //# sourceMappingURL=form.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/form.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { array, assign, literal, object, string, union } from 'superstruct';\n\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\nimport { ButtonStruct } from './button';\nimport { InputStruct } from './input';\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 * @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"],"names":["array","assign","literal","object","string","union","createBuilder","NodeStruct","NodeType","ButtonStruct","InputStruct","FormComponentStruct","FormStruct","type","Form","children","name","form"],"mappings":"AACA,SAASA,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,QAAQ,cAAc;AAE5E,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,WAAW;AAChD,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,WAAW,QAAQ,UAAU;AAEtC,OAAO,MAAMC,sBAAsBN,MAAM;IAACK;IAAaD;CAAa,EAAE;AAOtE,OAAO,MAAMG,aAAaX,OACxBM,YACAJ,OAAO;IACLU,MAAMX,QAAQM,SAASM,IAAI;IAC3BC,UAAUf,MAAMW;IAChBK,MAAMZ;AACR,IACA;AAWF;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMa,OAAOX,cAAcE,SAASM,IAAI,EAAEF,YAAY;IAC3D;IACA;CACD,EAAE"}
@@ -1,22 +0,0 @@
1
- import { assign, literal, object, string } from 'superstruct';
2
- import { createBuilder } from '../builder';
3
- import { LiteralStruct, NodeType } from '../nodes';
4
- export const HeadingStruct = assign(LiteralStruct, object({
5
- type: literal(NodeType.Heading),
6
- value: string()
7
- }));
8
- /**
9
- * Create a {@link Heading} node.
10
- *
11
- * @param args - The node arguments. This can either be a string, or an object
12
- * with the `value` property.
13
- * @param args.value - The heading text.
14
- * @returns The heading node as object.
15
- * @example
16
- * const node = heading({ value: 'Hello, world!' });
17
- * const node = heading('Hello, world!');
18
- */ export const heading = createBuilder(NodeType.Heading, HeadingStruct, [
19
- 'value'
20
- ]);
21
-
22
- //# sourceMappingURL=heading.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/heading.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { assign, literal, object, string } from '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 * @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"],"names":["assign","literal","object","string","createBuilder","LiteralStruct","NodeType","HeadingStruct","type","Heading","value","heading"],"mappings":"AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,QAAQ,cAAc;AAE9D,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,EAAEC,QAAQ,QAAQ,WAAW;AAEnD,OAAO,MAAMC,gBAAgBP,OAC3BK,eACAH,OAAO;IACLM,MAAMP,QAAQK,SAASG,OAAO;IAC9BC,OAAOP;AACT,IACA;AAYF;;;;;;;;;;CAUC,GACD,OAAO,MAAMQ,UAAUP,cAAcE,SAASG,OAAO,EAAEF,eAAe;IACpE;CACD,EAAE"}
@@ -1,37 +0,0 @@
1
- import { assign, literal, object, refine, string } from 'superstruct';
2
- import { isSvg } from '../../internals';
3
- import { createBuilder } from '../builder';
4
- import { NodeStruct, NodeType } from '../nodes';
5
- /**
6
- * Get a Struct that validates a string as a valid SVG.
7
- *
8
- * @returns A Struct that validates a string as a valid SVG.
9
- * @internal
10
- */ export function svg() {
11
- return refine(string(), 'SVG', (value)=>{
12
- if (!isSvg(value)) {
13
- return 'Value is not a valid SVG.';
14
- }
15
- return true;
16
- });
17
- }
18
- export const ImageStruct = assign(NodeStruct, object({
19
- type: literal(NodeType.Image),
20
- value: svg()
21
- }));
22
- /**
23
- * Create an {@link Image} node.
24
- *
25
- * @param args - The node arguments. This can either be a string, or an object
26
- * with the `value` property.
27
- * @param args.value - The SVG image to be rendered. Must be a valid SVG string.
28
- * @returns The image node as object. Other image formats are supported by
29
- * embedding them as data URLs in the SVG.
30
- * @example
31
- * const node = image({ value: '<svg />' });
32
- * const node = image('<svg />');
33
- */ export const image = createBuilder(NodeType.Image, ImageStruct, [
34
- 'value'
35
- ]);
36
-
37
- //# sourceMappingURL=image.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/image.ts"],"sourcesContent":["import type { Infer } from 'superstruct';\nimport { assign, literal, object, refine, string } from 'superstruct';\n\nimport { isSvg } from '../../internals';\nimport { createBuilder } from '../builder';\nimport { NodeStruct, NodeType } from '../nodes';\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 if (!isSvg(value)) {\n return 'Value is not a valid SVG.';\n }\n\n return true;\n });\n}\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 * @example\n * const node = image({ value: '<svg />' });\n * const node = image('<svg />');\n */\nexport const image = createBuilder(NodeType.Image, ImageStruct, ['value']);\n"],"names":["assign","literal","object","refine","string","isSvg","createBuilder","NodeStruct","NodeType","svg","value","ImageStruct","type","Image","image"],"mappings":"AACA,SAASA,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,QAAQ,cAAc;AAEtE,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,UAAU,EAAEC,QAAQ,QAAQ,WAAW;AAEhD;;;;;CAKC,GACD,OAAO,SAASC;IACd,OAAON,OAAOC,UAAU,OAAO,CAACM;QAC9B,IAAI,CAACL,MAAMK,QAAQ;YACjB,OAAO;QACT;QAEA,OAAO;IACT;AACF;AAEA,OAAO,MAAMC,cAAcX,OACzBO,YACAL,OAAO;IACLU,MAAMX,QAAQO,SAASK,KAAK;IAC5BH,OAAOD;AACT,IACA;AAUF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMK,QAAQR,cAAcE,SAASK,KAAK,EAAEF,aAAa;IAAC;CAAQ,EAAE"}
@@ -1,14 +0,0 @@
1
- export * from './address';
2
- export * from './copyable';
3
- export * from './divider';
4
- export * from './heading';
5
- export { image, ImageStruct } from './image';
6
- export { ComponentStruct, panel, PanelStruct } from './panel';
7
- export * from './spinner';
8
- export * from './text';
9
- export * from './row';
10
- export * from './button';
11
- export * from './input';
12
- export * from './form';
13
-
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/ui/components/index.ts"],"sourcesContent":["export * from './address';\nexport * from './copyable';\nexport * from './divider';\nexport * from './heading';\nexport type { Image } from './image';\nexport { image, ImageStruct } from './image';\nexport type { Component, Panel } from './panel';\nexport { ComponentStruct, panel, PanelStruct } from './panel';\nexport * from './spinner';\nexport * from './text';\nexport * from './row';\nexport * from './button';\nexport * from './input';\nexport * from './form';\n"],"names":["image","ImageStruct","ComponentStruct","panel","PanelStruct"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,YAAY;AAE1B,SAASA,KAAK,EAAEC,WAAW,QAAQ,UAAU;AAE7C,SAASC,eAAe,EAAEC,KAAK,EAAEC,WAAW,QAAQ,UAAU;AAC9D,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,SAAS"}
@@ -1,47 +0,0 @@
1
- import { assign, literal, object, optional, string, union } from 'superstruct';
2
- import { enumValue } from '../../internals';
3
- import { createBuilder } from '../builder';
4
- import { LiteralStruct, NodeType } from '../nodes';
5
- export var InputType;
6
- (function(InputType) {
7
- InputType[/* eslint-disable @typescript-eslint/no-shadow */ "Text"] = 'text';
8
- InputType["Number"] = 'number';
9
- InputType[/* eslint-enable @typescript-eslint/no-shadow */ "Password"] = 'password';
10
- })(InputType || (InputType = {}));
11
- export const InputStruct = assign(LiteralStruct, object({
12
- type: literal(NodeType.Input),
13
- value: optional(string()),
14
- name: string(),
15
- inputType: optional(union([
16
- enumValue(InputType.Text),
17
- enumValue(InputType.Password),
18
- enumValue(InputType.Number)
19
- ])),
20
- placeholder: optional(string()),
21
- label: optional(string())
22
- }));
23
- /**
24
- * Create a {@link Input} node.
25
- *
26
- * @param args - The node arguments. This can either be a name and an optional variant, value and placeholder or an object
27
- * with the properties: `inputType`, `value`, `variant`, `placeholder` and `name`.
28
- * @param args.name - The name for the input.
29
- * @param args.value - The value of the input.
30
- * @param args.inputType - An optional type, either `text`, `password` or `number`.
31
- * @param args.placeholder - An optional input placeholder.
32
- * @param args.label - An optional input label.
33
- * @returns The input node as an object.
34
- * @example
35
- * const node = input('myInput');
36
- * const node = input('myInput', InputType.Text, 'my placeholder', 'myValue', 'myLabel');
37
- * const node = input({ name: 'myInput' });
38
- * const node = input({name: 'myInput', value: 'myValue', inputType: InputType.Password, placeholder: 'placeholder'})
39
- */ export const input = createBuilder(NodeType.Input, InputStruct, [
40
- 'name',
41
- 'inputType',
42
- 'placeholder',
43
- 'value',
44
- 'label'
45
- ]);
46
-
47
- //# sourceMappingURL=input.js.map