@metamask/snaps-sdk 6.4.0 → 6.5.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 (98) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/error-wrappers.d.cts +288 -288
  3. package/dist/error-wrappers.d.mts +288 -288
  4. package/dist/images.d.cts +1 -1
  5. package/dist/images.d.mts +1 -1
  6. package/dist/internals/error-wrappers.d.cts +18 -18
  7. package/dist/internals/error-wrappers.d.mts +18 -18
  8. package/dist/jsx/component.cjs.map +1 -1
  9. package/dist/jsx/component.d.cts +4 -0
  10. package/dist/jsx/component.d.cts.map +1 -1
  11. package/dist/jsx/component.d.mts +4 -0
  12. package/dist/jsx/component.d.mts.map +1 -1
  13. package/dist/jsx/component.mjs.map +1 -1
  14. package/dist/jsx/components/Address.d.cts +1 -1
  15. package/dist/jsx/components/Address.d.mts +1 -1
  16. package/dist/jsx/components/Box.cjs.map +1 -1
  17. package/dist/jsx/components/Box.d.cts +3 -1
  18. package/dist/jsx/components/Box.d.cts.map +1 -1
  19. package/dist/jsx/components/Box.d.mts +3 -1
  20. package/dist/jsx/components/Box.d.mts.map +1 -1
  21. package/dist/jsx/components/Box.mjs.map +1 -1
  22. package/dist/jsx/components/Card.d.cts +1 -1
  23. package/dist/jsx/components/Card.d.mts +1 -1
  24. package/dist/jsx/components/Container.d.cts +1 -1
  25. package/dist/jsx/components/Container.d.mts +1 -1
  26. package/dist/jsx/components/Copyable.d.cts +1 -1
  27. package/dist/jsx/components/Copyable.d.mts +1 -1
  28. package/dist/jsx/components/Divider.d.cts +1 -1
  29. package/dist/jsx/components/Divider.d.mts +1 -1
  30. package/dist/jsx/components/Footer.d.cts +1 -1
  31. package/dist/jsx/components/Footer.d.mts +1 -1
  32. package/dist/jsx/components/Heading.d.cts +1 -1
  33. package/dist/jsx/components/Heading.d.mts +1 -1
  34. package/dist/jsx/components/Icon.d.cts +1 -1
  35. package/dist/jsx/components/Icon.d.mts +1 -1
  36. package/dist/jsx/components/Image.d.cts +1 -1
  37. package/dist/jsx/components/Image.d.mts +1 -1
  38. package/dist/jsx/components/Link.d.cts +1 -1
  39. package/dist/jsx/components/Link.d.mts +1 -1
  40. package/dist/jsx/components/Row.d.cts +1 -1
  41. package/dist/jsx/components/Row.d.mts +1 -1
  42. package/dist/jsx/components/Section.d.cts +1 -1
  43. package/dist/jsx/components/Section.d.mts +1 -1
  44. package/dist/jsx/components/Spinner.d.cts +1 -1
  45. package/dist/jsx/components/Spinner.d.mts +1 -1
  46. package/dist/jsx/components/Text.d.cts +1 -1
  47. package/dist/jsx/components/Text.d.mts +1 -1
  48. package/dist/jsx/components/Tooltip.d.cts +1 -1
  49. package/dist/jsx/components/Tooltip.d.mts +1 -1
  50. package/dist/jsx/components/Value.d.cts +1 -1
  51. package/dist/jsx/components/Value.d.mts +1 -1
  52. package/dist/jsx/components/form/Button.cjs.map +1 -1
  53. package/dist/jsx/components/form/Button.d.cts +3 -1
  54. package/dist/jsx/components/form/Button.d.cts.map +1 -1
  55. package/dist/jsx/components/form/Button.d.mts +3 -1
  56. package/dist/jsx/components/form/Button.d.mts.map +1 -1
  57. package/dist/jsx/components/form/Button.mjs.map +1 -1
  58. package/dist/jsx/components/form/Checkbox.d.cts +1 -1
  59. package/dist/jsx/components/form/Checkbox.d.mts +1 -1
  60. package/dist/jsx/components/form/Dropdown.d.cts +1 -1
  61. package/dist/jsx/components/form/Dropdown.d.mts +1 -1
  62. package/dist/jsx/components/form/Field.cjs.map +1 -1
  63. package/dist/jsx/components/form/Field.d.cts +3 -3
  64. package/dist/jsx/components/form/Field.d.cts.map +1 -1
  65. package/dist/jsx/components/form/Field.d.mts +3 -3
  66. package/dist/jsx/components/form/Field.d.mts.map +1 -1
  67. package/dist/jsx/components/form/Field.mjs.map +1 -1
  68. package/dist/jsx/components/form/FileInput.d.cts +1 -1
  69. package/dist/jsx/components/form/FileInput.d.mts +1 -1
  70. package/dist/jsx/components/form/Form.d.cts +1 -1
  71. package/dist/jsx/components/form/Form.d.mts +1 -1
  72. package/dist/jsx/components/form/Input.d.cts +1 -1
  73. package/dist/jsx/components/form/Input.d.mts +1 -1
  74. package/dist/jsx/components/form/Option.d.cts +1 -1
  75. package/dist/jsx/components/form/Option.d.mts +1 -1
  76. package/dist/jsx/components/form/Radio.d.cts +1 -1
  77. package/dist/jsx/components/form/Radio.d.mts +1 -1
  78. package/dist/jsx/components/form/RadioGroup.d.cts +1 -1
  79. package/dist/jsx/components/form/RadioGroup.d.mts +1 -1
  80. package/dist/jsx/components/form/Selector.d.cts +1 -1
  81. package/dist/jsx/components/form/Selector.d.mts +1 -1
  82. package/dist/jsx/components/form/SelectorOption.d.cts +1 -1
  83. package/dist/jsx/components/form/SelectorOption.d.mts +1 -1
  84. package/dist/jsx/components/formatting/Bold.d.cts +1 -1
  85. package/dist/jsx/components/formatting/Bold.d.mts +1 -1
  86. package/dist/jsx/components/formatting/Italic.d.cts +1 -1
  87. package/dist/jsx/components/formatting/Italic.d.mts +1 -1
  88. package/dist/jsx/validation.cjs +29 -6
  89. package/dist/jsx/validation.cjs.map +1 -1
  90. package/dist/jsx/validation.d.cts +16 -16
  91. package/dist/jsx/validation.d.cts.map +1 -1
  92. package/dist/jsx/validation.d.mts +16 -16
  93. package/dist/jsx/validation.d.mts.map +1 -1
  94. package/dist/jsx/validation.mjs +29 -6
  95. package/dist/jsx/validation.mjs.map +1 -1
  96. package/dist/types/interface.d.cts +23 -23
  97. package/dist/types/interface.d.mts +23 -23
  98. package/package.json +2 -2
package/dist/images.d.cts CHANGED
@@ -64,7 +64,7 @@ export type ImageOptions = {
64
64
  * @returns A promise that resolves to the image data as an image component.
65
65
  */
66
66
  export declare function getImageComponent(url: string, { width, height, request }: ImageOptions): Promise<{
67
- type: import("./ui").NodeType.Image;
67
+ type: import("./ui/index.cjs").NodeType.Image;
68
68
  value: string;
69
69
  }>;
70
70
  //# sourceMappingURL=images.d.cts.map
package/dist/images.d.mts CHANGED
@@ -64,7 +64,7 @@ export type ImageOptions = {
64
64
  * @returns A promise that resolves to the image data as an image component.
65
65
  */
66
66
  export declare function getImageComponent(url: string, { width, height, request }: ImageOptions): Promise<{
67
- type: import("./ui").NodeType.Image;
67
+ type: import("./ui/index.mjs").NodeType.Image;
68
68
  value: string;
69
69
  }>;
70
70
  //# sourceMappingURL=images.d.mts.map
@@ -15,43 +15,43 @@ export type JsonRpcErrorFunction = typeof rpcErrors.parse;
15
15
  */
16
16
  export declare function createSnapError(fn: JsonRpcErrorFunction): {
17
17
  new (message?: string): {
18
- readonly "__#181027@#code": number;
19
- readonly "__#181027@#message": string;
20
- readonly "__#181027@#data"?: Record<string, Json> | undefined;
21
- readonly "__#181027@#stack"?: string | undefined;
18
+ readonly "__#181049@#code": number;
19
+ readonly "__#181049@#message": string;
20
+ readonly "__#181049@#data"?: Record<string, Json> | undefined;
21
+ readonly "__#181049@#stack"?: string | undefined;
22
22
  readonly name: string;
23
23
  readonly code: number;
24
24
  readonly message: string;
25
25
  readonly data: Record<string, Json> | undefined;
26
26
  readonly stack: string | undefined;
27
- toJSON(): import("../errors").SerializedSnapError;
28
- serialize(): import("../errors").SerializedSnapError;
27
+ toJSON(): import("../errors.cjs").SerializedSnapError;
28
+ serialize(): import("../errors.cjs").SerializedSnapError;
29
29
  };
30
30
  new (data?: Record<string, Json>): {
31
- readonly "__#181027@#code": number;
32
- readonly "__#181027@#message": string;
33
- readonly "__#181027@#data"?: Record<string, Json> | undefined;
34
- readonly "__#181027@#stack"?: string | undefined;
31
+ readonly "__#181049@#code": number;
32
+ readonly "__#181049@#message": string;
33
+ readonly "__#181049@#data"?: Record<string, Json> | undefined;
34
+ readonly "__#181049@#stack"?: string | undefined;
35
35
  readonly name: string;
36
36
  readonly code: number;
37
37
  readonly message: string;
38
38
  readonly data: Record<string, Json> | undefined;
39
39
  readonly stack: string | undefined;
40
- toJSON(): import("../errors").SerializedSnapError;
41
- serialize(): import("../errors").SerializedSnapError;
40
+ toJSON(): import("../errors.cjs").SerializedSnapError;
41
+ serialize(): import("../errors.cjs").SerializedSnapError;
42
42
  };
43
43
  new (message?: string | Record<string, Json>, data?: Record<string, Json>): {
44
- readonly "__#181027@#code": number;
45
- readonly "__#181027@#message": string;
46
- readonly "__#181027@#data"?: Record<string, Json> | undefined;
47
- readonly "__#181027@#stack"?: string | undefined;
44
+ readonly "__#181049@#code": number;
45
+ readonly "__#181049@#message": string;
46
+ readonly "__#181049@#data"?: Record<string, Json> | undefined;
47
+ readonly "__#181049@#stack"?: string | undefined;
48
48
  readonly name: string;
49
49
  readonly code: number;
50
50
  readonly message: string;
51
51
  readonly data: Record<string, Json> | undefined;
52
52
  readonly stack: string | undefined;
53
- toJSON(): import("../errors").SerializedSnapError;
54
- serialize(): import("../errors").SerializedSnapError;
53
+ toJSON(): import("../errors.cjs").SerializedSnapError;
54
+ serialize(): import("../errors.cjs").SerializedSnapError;
55
55
  };
56
56
  captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
57
57
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -15,43 +15,43 @@ export type JsonRpcErrorFunction = typeof rpcErrors.parse;
15
15
  */
16
16
  export declare function createSnapError(fn: JsonRpcErrorFunction): {
17
17
  new (message?: string): {
18
- readonly "__#90515@#code": number;
19
- readonly "__#90515@#message": string;
20
- readonly "__#90515@#data"?: Record<string, Json> | undefined;
21
- readonly "__#90515@#stack"?: string | undefined;
18
+ readonly "__#90526@#code": number;
19
+ readonly "__#90526@#message": string;
20
+ readonly "__#90526@#data"?: Record<string, Json> | undefined;
21
+ readonly "__#90526@#stack"?: string | undefined;
22
22
  readonly name: string;
23
23
  readonly code: number;
24
24
  readonly message: string;
25
25
  readonly data: Record<string, Json> | undefined;
26
26
  readonly stack: string | undefined;
27
- toJSON(): import("../errors").SerializedSnapError;
28
- serialize(): import("../errors").SerializedSnapError;
27
+ toJSON(): import("../errors.mjs").SerializedSnapError;
28
+ serialize(): import("../errors.mjs").SerializedSnapError;
29
29
  };
30
30
  new (data?: Record<string, Json>): {
31
- readonly "__#90515@#code": number;
32
- readonly "__#90515@#message": string;
33
- readonly "__#90515@#data"?: Record<string, Json> | undefined;
34
- readonly "__#90515@#stack"?: string | undefined;
31
+ readonly "__#90526@#code": number;
32
+ readonly "__#90526@#message": string;
33
+ readonly "__#90526@#data"?: Record<string, Json> | undefined;
34
+ readonly "__#90526@#stack"?: string | undefined;
35
35
  readonly name: string;
36
36
  readonly code: number;
37
37
  readonly message: string;
38
38
  readonly data: Record<string, Json> | undefined;
39
39
  readonly stack: string | undefined;
40
- toJSON(): import("../errors").SerializedSnapError;
41
- serialize(): import("../errors").SerializedSnapError;
40
+ toJSON(): import("../errors.mjs").SerializedSnapError;
41
+ serialize(): import("../errors.mjs").SerializedSnapError;
42
42
  };
43
43
  new (message?: string | Record<string, Json>, data?: Record<string, Json>): {
44
- readonly "__#90515@#code": number;
45
- readonly "__#90515@#message": string;
46
- readonly "__#90515@#data"?: Record<string, Json> | undefined;
47
- readonly "__#90515@#stack"?: string | undefined;
44
+ readonly "__#90526@#code": number;
45
+ readonly "__#90526@#message": string;
46
+ readonly "__#90526@#data"?: Record<string, Json> | undefined;
47
+ readonly "__#90526@#stack"?: string | undefined;
48
48
  readonly name: string;
49
49
  readonly code: number;
50
50
  readonly message: string;
51
51
  readonly data: Record<string, Json> | undefined;
52
52
  readonly stack: string | undefined;
53
- toJSON(): import("../errors").SerializedSnapError;
54
- serialize(): import("../errors").SerializedSnapError;
53
+ toJSON(): import("../errors.mjs").SerializedSnapError;
54
+ serialize(): import("../errors.mjs").SerializedSnapError;
55
55
  };
56
56
  captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
57
57
  prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"component.cjs","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":";;;AA8EA;;;;;GAKG;AACH,SAAS,oBAAoB,CAA2B,KAAY;IAClE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACxD,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAGjC,IAAU;IACV,OAAO,CAAC,KAAmC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,oBAAoB,CAAC,IAAa,CAAC;YAC1C,GAAG;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAZD,kDAYC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record<string, Json>;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable<string>;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable<Type> = Type | Nestable<Type>[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren<Type> = Nestable<Type | boolean | null>;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren<GenericSnapElement | string>;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren<string>;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement<Props, Type>;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps<Props extends JsonObject>(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n>(type: Type): SnapComponent<Props, Type> {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"component.cjs","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":";;;AAmFA;;;;;GAKG;AACH,SAAS,oBAAoB,CAA2B,KAAY;IAClE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACxD,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAGjC,IAAU;IACV,OAAO,CAAC,KAAmC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,oBAAoB,CAAC,IAAa,CAAC;YAC1C,GAAG;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAZD,kDAYC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record<string, Json>;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable<string>;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable<Type> = Type | Nestable<Type>[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren<Type> = Nestable<Type | boolean | null>;\n\n/**\n * A type type that can be a generic JSX element, a boolean, or null.\n */\nexport type GenericSnapChildren = GenericSnapElement | boolean | null;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren<GenericSnapElement | string>;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren<string>;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement<Props, Type>;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps<Props extends JsonObject>(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n>(type: Type): SnapComponent<Props, Type> {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n"]}
@@ -47,6 +47,10 @@ export type Nestable<Type> = Type | Nestable<Type>[];
47
47
  * @template Type - The type that can be an array.
48
48
  */
49
49
  export type SnapsChildren<Type> = Nestable<Type | boolean | null>;
50
+ /**
51
+ * A type type that can be a generic JSX element, a boolean, or null.
52
+ */
53
+ export type GenericSnapChildren = GenericSnapElement | boolean | null;
50
54
  /**
51
55
  * A JSX node, which can be an element, a string, null, or an array of nodes.
52
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.cts","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACjB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CACrB,KAAK,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChD,IAAI,SAAS,MAAM,GAAG,MAAM,IAC1B;IACF,IAAI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jC,KAAK,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChD,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CASxC"}
@@ -47,6 +47,10 @@ export type Nestable<Type> = Type | Nestable<Type>[];
47
47
  * @template Type - The type that can be an array.
48
48
  */
49
49
  export type SnapsChildren<Type> = Nestable<Type | boolean | null>;
50
+ /**
51
+ * A type type that can be a generic JSX element, a boolean, or null.
52
+ */
53
+ export type GenericSnapChildren = GenericSnapElement | boolean | null;
50
54
  /**
51
55
  * A JSX node, which can be an element, a string, null, or an array of nodes.
52
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.mts","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAE5C;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACjB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,CACrB,KAAK,SAAS,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAChD,IAAI,SAAS,MAAM,GAAG,MAAM,IAC1B;IACF,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,QAAQ,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+1 @@
1
- {"version":3,"file":"component.mjs","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":"AA8EA;;;;;GAKG;AACH,SAAS,oBAAoB,CAA2B,KAAY;IAClE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACxD,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAGjC,IAAU;IACV,OAAO,CAAC,KAAmC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,oBAAoB,CAAC,IAAa,CAAC;YAC1C,GAAG;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record<string, Json>;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable<string>;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable<Type> = Type | Nestable<Type>[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren<Type> = Nestable<Type | boolean | null>;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren<GenericSnapElement | string>;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren<string>;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement<Props, Type>;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps<Props extends JsonObject>(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n>(type: Type): SnapComponent<Props, Type> {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n"]}
1
+ {"version":3,"file":"component.mjs","sourceRoot":"","sources":["../../src/jsx/component.ts"],"names":[],"mappings":"AAmFA;;;;;GAKG;AACH,SAAS,oBAAoB,CAA2B,KAAY;IAClE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACxD,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAGjC,IAAU;IACV,OAAO,CAAC,KAAmC,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,oBAAoB,CAAC,IAAa,CAAC;YAC1C,GAAG;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Json } from '@metamask/utils';\n\n/**\n * A key, which can be a string or a number.\n */\nexport type Key = string | number;\n\n/**\n * A JSON object.\n */\nexport type JsonObject = Record<string, Json>;\n\n/**\n * A generic JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type GenericSnapElement = {\n type: string;\n props: JsonObject;\n key: Key | null;\n};\n\n/**\n * A JSX element.\n *\n * @property type - The type of the element.\n * @property props - The props of the element.\n * @property key - The key of the element.\n */\nexport type SnapElement<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = {\n type: Type;\n props: Props;\n key: Key | null;\n};\n\n/**\n * A type that can be a single value or an infinitely nestable array of values.\n *\n * @template Type - The type that can be an array.\n * @example\n * type NestableString = Nestable<string>;\n * const nestableString: NestableString = 'hello';\n * const nestableStringArray: NestableString = ['hello', 'world', ['foo', ['bar']]];\n */\nexport type Nestable<Type> = Type | Nestable<Type>[];\n\n/**\n * A type that can be a single value or an array of values, a boolean, or null.\n *\n * @template Type - The type that can be an array.\n */\nexport type SnapsChildren<Type> = Nestable<Type | boolean | null>;\n\n/**\n * A type type that can be a generic JSX element, a boolean, or null.\n */\nexport type GenericSnapChildren = GenericSnapElement | boolean | null;\n\n/**\n * A JSX node, which can be an element, a string, null, or an array of nodes.\n */\nexport type SnapNode = SnapsChildren<GenericSnapElement | string>;\n\n/**\n * A JSX string element, which can be a string or an array of strings, or\n * booleans (for conditional rendering).\n */\nexport type StringElement = SnapsChildren<string>;\n\n/**\n * A JSX component.\n */\nexport type SnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n> = (props: Props & { key?: Key | null }) => SnapElement<Props, Type>;\n\n/**\n * Remove undefined props from an object.\n *\n * @param props - The object to remove undefined props from.\n * @returns The object without undefined props.\n */\nfunction removeUndefinedProps<Props extends JsonObject>(props: Props): Props {\n return Object.fromEntries(\n Object.entries(props).filter(([, value]) => value !== undefined),\n ) as Props;\n}\n\n/**\n * Create a Snap component from a type. This is a helper function that creates a\n * Snap component function.\n *\n * @param type - The type of the component.\n * @returns A function that creates a Snap element.\n * @see SnapComponent\n */\nexport function createSnapComponent<\n Props extends JsonObject = Record<string, never>,\n Type extends string = string,\n>(type: Type): SnapComponent<Props, Type> {\n return (props: Props & { key?: Key | null }) => {\n const { key = null, ...rest } = props;\n return {\n type,\n props: removeUndefinedProps(rest as Props),\n key,\n };\n };\n}\n"]}
@@ -24,7 +24,7 @@ export type AddressProps = {
24
24
  * @example
25
25
  * <Address address="bip122:000000000019d6689c085ae165831e93:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6" />
26
26
  */
27
- export declare const Address: import("../component").SnapComponent<AddressProps, "Address">;
27
+ export declare const Address: import("../component.cjs").SnapComponent<AddressProps, "Address">;
28
28
  /**
29
29
  * An address element.
30
30
  *
@@ -24,7 +24,7 @@ export type AddressProps = {
24
24
  * @example
25
25
  * <Address address="bip122:000000000019d6689c085ae165831e93:128Lkh3S7CkDTBZ8W7BbpsN3YYizJMp8p6" />
26
26
  */
27
- export declare const Address: import("../component").SnapComponent<AddressProps, "Address">;
27
+ export declare const Address: import("../component.mjs").SnapComponent<AddressProps, "Address">;
28
28
  /**
29
29
  * An address element.
30
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Box.cjs","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":";;;AACA,gDAAmD;AAsBnD,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;;;;;;;GAUG;AACU,QAAA,GAAG,GAAG,IAAA,+BAAmB,EAAwB,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren<GenericSnapElement>;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * <Box>\n * <Text>Hello world!</Text>\n * </Box>\n */\nexport const Box = createSnapComponent<BoxProps, typeof TYPE>(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType<typeof Box>;\n"]}
1
+ {"version":3,"file":"Box.cjs","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":";;;AACA,gDAAmD;AAwBnD,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;;;;;;;GAUG;AACU,QAAA,GAAG,GAAG,IAAA,+BAAmB,EAAwB,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n * @property center - Whether to center the children within the box. Defaults to `false`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren<GenericSnapElement>;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n center?: boolean | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * <Box>\n * <Text>Hello world!</Text>\n * </Box>\n */\nexport const Box = createSnapComponent<BoxProps, typeof TYPE>(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType<typeof Box>;\n"]}
@@ -5,11 +5,13 @@ import type { GenericSnapElement, SnapsChildren } from "../component.cjs";
5
5
  * @property children - The children of the box.
6
6
  * @property direction - The direction to stack the components within the box. Defaults to `vertical`.
7
7
  * @property alignment - The alignment mode to use within the box. Defaults to `start`.
8
+ * @property center - Whether to center the children within the box. Defaults to `false`.
8
9
  */
9
10
  export type BoxProps = {
10
11
  children: SnapsChildren<GenericSnapElement>;
11
12
  direction?: 'vertical' | 'horizontal' | undefined;
12
13
  alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | undefined;
14
+ center?: boolean | undefined;
13
15
  };
14
16
  /**
15
17
  * A box component, which is used to group multiple components together.
@@ -22,7 +24,7 @@ export type BoxProps = {
22
24
  * <Text>Hello world!</Text>
23
25
  * </Box>
24
26
  */
25
- export declare const Box: import("../component").SnapComponent<BoxProps, "Box">;
27
+ export declare const Box: import("../component.cjs").SnapComponent<BoxProps, "Box">;
26
28
  /**
27
29
  * A box element.
28
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.cts","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,yBAAqB;AAGtE;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG;IAErB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,eAAe,GACf,cAAc,GACd,SAAS,CAAC;CACf,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,uDAAmD,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"Box.d.cts","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,yBAAqB;AAGtE;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG;IAErB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,eAAe,GACf,cAAc,GACd,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,uDAAmD,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC"}
@@ -5,11 +5,13 @@ import type { GenericSnapElement, SnapsChildren } from "../component.mjs";
5
5
  * @property children - The children of the box.
6
6
  * @property direction - The direction to stack the components within the box. Defaults to `vertical`.
7
7
  * @property alignment - The alignment mode to use within the box. Defaults to `start`.
8
+ * @property center - Whether to center the children within the box. Defaults to `false`.
8
9
  */
9
10
  export type BoxProps = {
10
11
  children: SnapsChildren<GenericSnapElement>;
11
12
  direction?: 'vertical' | 'horizontal' | undefined;
12
13
  alignment?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | undefined;
14
+ center?: boolean | undefined;
13
15
  };
14
16
  /**
15
17
  * A box component, which is used to group multiple components together.
@@ -22,7 +24,7 @@ export type BoxProps = {
22
24
  * <Text>Hello world!</Text>
23
25
  * </Box>
24
26
  */
25
- export declare const Box: import("../component").SnapComponent<BoxProps, "Box">;
27
+ export declare const Box: import("../component.mjs").SnapComponent<BoxProps, "Box">;
26
28
  /**
27
29
  * A box element.
28
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.mts","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,yBAAqB;AAGtE;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG;IAErB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,eAAe,GACf,cAAc,GACd,SAAS,CAAC;CACf,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,uDAAmD,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"Box.d.mts","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,yBAAqB;AAGtE;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG;IAErB,QAAQ,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EACN,OAAO,GACP,QAAQ,GACR,KAAK,GACL,eAAe,GACf,cAAc,GACd,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG,uDAAmD,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Box.mjs","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,yBAAqB;AAsBnD,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,mBAAmB,CAAwB,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren<GenericSnapElement>;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * <Box>\n * <Text>Hello world!</Text>\n * </Box>\n */\nexport const Box = createSnapComponent<BoxProps, typeof TYPE>(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType<typeof Box>;\n"]}
1
+ {"version":3,"file":"Box.mjs","sourceRoot":"","sources":["../../../src/jsx/components/Box.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,yBAAqB;AAwBnD,MAAM,IAAI,GAAG,KAAK,CAAC;AAEnB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,mBAAmB,CAAwB,IAAI,CAAC,CAAC","sourcesContent":["import type { GenericSnapElement, SnapsChildren } from '../component';\nimport { createSnapComponent } from '../component';\n\n/**\n * The props of the {@link Box} component.\n *\n * @property children - The children of the box.\n * @property direction - The direction to stack the components within the box. Defaults to `vertical`.\n * @property alignment - The alignment mode to use within the box. Defaults to `start`.\n * @property center - Whether to center the children within the box. Defaults to `false`.\n */\nexport type BoxProps = {\n // We can't use `JSXElement` because it causes a circular reference.\n children: SnapsChildren<GenericSnapElement>;\n direction?: 'vertical' | 'horizontal' | undefined;\n alignment?:\n | 'start'\n | 'center'\n | 'end'\n | 'space-between'\n | 'space-around'\n | undefined;\n center?: boolean | undefined;\n};\n\nconst TYPE = 'Box';\n\n/**\n * A box component, which is used to group multiple components together.\n *\n * @param props - The props of the component.\n * @param props.children - The children of the box.\n * @returns A box element.\n * @example\n * <Box>\n * <Text>Hello world!</Text>\n * </Box>\n */\nexport const Box = createSnapComponent<BoxProps, typeof TYPE>(TYPE);\n\n/**\n * A box element.\n *\n * @see Box\n */\nexport type BoxElement = ReturnType<typeof Box>;\n"]}
@@ -27,7 +27,7 @@ export type CardProps = {
27
27
  * @example
28
28
  * <Card image="<svg />" title="Title" description="Description" value="$1200" extra="0.12 ETH" />
29
29
  */
30
- export declare const Card: import("../component").SnapComponent<CardProps, "Card">;
30
+ export declare const Card: import("../component.cjs").SnapComponent<CardProps, "Card">;
31
31
  /**
32
32
  * A card element.
33
33
  *
@@ -27,7 +27,7 @@ export type CardProps = {
27
27
  * @example
28
28
  * <Card image="<svg />" title="Title" description="Description" value="$1200" extra="0.12 ETH" />
29
29
  */
30
- export declare const Card: import("../component").SnapComponent<CardProps, "Card">;
30
+ export declare const Card: import("../component.mjs").SnapComponent<CardProps, "Card">;
31
31
  /**
32
32
  * A card element.
33
33
  *
@@ -25,7 +25,7 @@ export type ContainerProps = {
25
25
  * </Footer>
26
26
  * </Container>
27
27
  */
28
- export declare const Container: import("../component").SnapComponent<ContainerProps, "Container">;
28
+ export declare const Container: import("../component.cjs").SnapComponent<ContainerProps, "Container">;
29
29
  /**
30
30
  * A container element.
31
31
  *
@@ -25,7 +25,7 @@ export type ContainerProps = {
25
25
  * </Footer>
26
26
  * </Container>
27
27
  */
28
- export declare const Container: import("../component").SnapComponent<ContainerProps, "Container">;
28
+ export declare const Container: import("../component.mjs").SnapComponent<ContainerProps, "Container">;
29
29
  /**
30
30
  * A container element.
31
31
  *
@@ -23,7 +23,7 @@ export type CopyableProps = {
23
23
  * <Copyable value="0x1234567890123456789012345678901234567890" />
24
24
  * <Copyable value="0x1234567890123456789012345678901234567890" sensitive />
25
25
  */
26
- export declare const Copyable: import("../component").SnapComponent<CopyableProps, "Copyable">;
26
+ export declare const Copyable: import("../component.cjs").SnapComponent<CopyableProps, "Copyable">;
27
27
  /**
28
28
  * A copyable element.
29
29
  *
@@ -23,7 +23,7 @@ export type CopyableProps = {
23
23
  * <Copyable value="0x1234567890123456789012345678901234567890" />
24
24
  * <Copyable value="0x1234567890123456789012345678901234567890" sensitive />
25
25
  */
26
- export declare const Copyable: import("../component").SnapComponent<CopyableProps, "Copyable">;
26
+ export declare const Copyable: import("../component.mjs").SnapComponent<CopyableProps, "Copyable">;
27
27
  /**
28
28
  * A copyable element.
29
29
  *
@@ -8,7 +8,7 @@
8
8
  * @example
9
9
  * <Divider />
10
10
  */
11
- export declare const Divider: import("../component").SnapComponent<Record<string, never>, "Divider">;
11
+ export declare const Divider: import("../component.cjs").SnapComponent<Record<string, never>, "Divider">;
12
12
  /**
13
13
  * A divider element.
14
14
  *
@@ -8,7 +8,7 @@
8
8
  * @example
9
9
  * <Divider />
10
10
  */
11
- export declare const Divider: import("../component").SnapComponent<Record<string, never>, "Divider">;
11
+ export declare const Divider: import("../component.mjs").SnapComponent<Record<string, never>, "Divider">;
12
12
  /**
13
13
  * A divider element.
14
14
  *
@@ -19,7 +19,7 @@ export type FooterProps = {
19
19
  * <Button name="confirm">Confirm</Button>
20
20
  * </Footer>
21
21
  */
22
- export declare const Footer: import("../component").SnapComponent<FooterProps, "Footer">;
22
+ export declare const Footer: import("../component.cjs").SnapComponent<FooterProps, "Footer">;
23
23
  /**
24
24
  * A footer element.
25
25
  *
@@ -19,7 +19,7 @@ export type FooterProps = {
19
19
  * <Button name="confirm">Confirm</Button>
20
20
  * </Footer>
21
21
  */
22
- export declare const Footer: import("../component").SnapComponent<FooterProps, "Footer">;
22
+ export declare const Footer: import("../component.mjs").SnapComponent<FooterProps, "Footer">;
23
23
  /**
24
24
  * A footer element.
25
25
  *
@@ -16,7 +16,7 @@ type HeadingProps = {
16
16
  * @example
17
17
  * <Heading>Hello world!</Heading>
18
18
  */
19
- export declare const Heading: import("../component").SnapComponent<HeadingProps, "Heading">;
19
+ export declare const Heading: import("../component.cjs").SnapComponent<HeadingProps, "Heading">;
20
20
  /**
21
21
  * A heading element.
22
22
  *
@@ -16,7 +16,7 @@ type HeadingProps = {
16
16
  * @example
17
17
  * <Heading>Hello world!</Heading>
18
18
  */
19
- export declare const Heading: import("../component").SnapComponent<HeadingProps, "Heading">;
19
+ export declare const Heading: import("../component.mjs").SnapComponent<HeadingProps, "Heading">;
20
20
  /**
21
21
  * A heading element.
22
22
  *
@@ -180,7 +180,7 @@ export type IconProps = {
180
180
  * @example
181
181
  * <Icon name="warning" color="warning" size="md" />
182
182
  */
183
- export declare const Icon: import("../component").SnapComponent<IconProps, "Icon">;
183
+ export declare const Icon: import("../component.cjs").SnapComponent<IconProps, "Icon">;
184
184
  /**
185
185
  * An icon element.
186
186
  *
@@ -180,7 +180,7 @@ export type IconProps = {
180
180
  * @example
181
181
  * <Icon name="warning" color="warning" size="md" />
182
182
  */
183
- export declare const Icon: import("../component").SnapComponent<IconProps, "Icon">;
183
+ export declare const Icon: import("../component.mjs").SnapComponent<IconProps, "Icon">;
184
184
  /**
185
185
  * An icon element.
186
186
  *
@@ -26,7 +26,7 @@ type ImageProps = {
26
26
  * @example
27
27
  * <Image src="<svg>...</svg>" alt="An example image" />
28
28
  */
29
- export declare const Image: import("../component").SnapComponent<ImageProps, "Image">;
29
+ export declare const Image: import("../component.cjs").SnapComponent<ImageProps, "Image">;
30
30
  /**
31
31
  * An image element.
32
32
  *
@@ -26,7 +26,7 @@ type ImageProps = {
26
26
  * @example
27
27
  * <Image src="<svg>...</svg>" alt="An example image" />
28
28
  */
29
- export declare const Image: import("../component").SnapComponent<ImageProps, "Image">;
29
+ export declare const Image: import("../component.mjs").SnapComponent<ImageProps, "Image">;
30
30
  /**
31
31
  * An image element.
32
32
  *
@@ -26,7 +26,7 @@ export type LinkProps = {
26
26
  * @example
27
27
  * <Link href="https://example.com">Click here</Link>
28
28
  */
29
- export declare const Link: import("../component").SnapComponent<LinkProps, "Link">;
29
+ export declare const Link: import("../component.cjs").SnapComponent<LinkProps, "Link">;
30
30
  /**
31
31
  * A link element.
32
32
  *
@@ -26,7 +26,7 @@ export type LinkProps = {
26
26
  * @example
27
27
  * <Link href="https://example.com">Click here</Link>
28
28
  */
29
- export declare const Link: import("../component").SnapComponent<LinkProps, "Link">;
29
+ export declare const Link: import("../component.mjs").SnapComponent<LinkProps, "Link">;
30
30
  /**
31
31
  * A link element.
32
32
  *
@@ -36,7 +36,7 @@ export type RowProps = {
36
36
  * <Address address="0x1234567890123456789012345678901234567890" />
37
37
  * </Row>
38
38
  */
39
- export declare const Row: import("../component").SnapComponent<RowProps, "Row">;
39
+ export declare const Row: import("../component.cjs").SnapComponent<RowProps, "Row">;
40
40
  /**
41
41
  * A row element.
42
42
  *
@@ -36,7 +36,7 @@ export type RowProps = {
36
36
  * <Address address="0x1234567890123456789012345678901234567890" />
37
37
  * </Row>
38
38
  */
39
- export declare const Row: import("../component").SnapComponent<RowProps, "Row">;
39
+ export declare const Row: import("../component.mjs").SnapComponent<RowProps, "Row">;
40
40
  /**
41
41
  * A row element.
42
42
  *
@@ -28,7 +28,7 @@ export type SectionProps = {
28
28
  * </Row>
29
29
  * </Section>
30
30
  */
31
- export declare const Section: import("../component").SnapComponent<SectionProps, "Section">;
31
+ export declare const Section: import("../component.cjs").SnapComponent<SectionProps, "Section">;
32
32
  /**
33
33
  * A section element.
34
34
  *
@@ -28,7 +28,7 @@ export type SectionProps = {
28
28
  * </Row>
29
29
  * </Section>
30
30
  */
31
- export declare const Section: import("../component").SnapComponent<SectionProps, "Section">;
31
+ export declare const Section: import("../component.mjs").SnapComponent<SectionProps, "Section">;
32
32
  /**
33
33
  * A section element.
34
34
  *
@@ -8,7 +8,7 @@
8
8
  * @example
9
9
  * <Spinner />
10
10
  */
11
- export declare const Spinner: import("../component").SnapComponent<Record<string, never>, "Spinner">;
11
+ export declare const Spinner: import("../component.cjs").SnapComponent<Record<string, never>, "Spinner">;
12
12
  /**
13
13
  * A spinner element.
14
14
  *
@@ -8,7 +8,7 @@
8
8
  * @example
9
9
  * <Spinner />
10
10
  */
11
- export declare const Spinner: import("../component").SnapComponent<Record<string, never>, "Spinner">;
11
+ export declare const Spinner: import("../component.mjs").SnapComponent<Record<string, never>, "Spinner">;
12
12
  /**
13
13
  * A spinner element.
14
14
  *
@@ -35,7 +35,7 @@ export type TextProps = {
35
35
  * Hello <Bold>world</Bold>!
36
36
  * </Text>
37
37
  */
38
- export declare const Text: import("../component").SnapComponent<TextProps, "Text">;
38
+ export declare const Text: import("../component.cjs").SnapComponent<TextProps, "Text">;
39
39
  /**
40
40
  * A text element.
41
41
  *
@@ -35,7 +35,7 @@ export type TextProps = {
35
35
  * Hello <Bold>world</Bold>!
36
36
  * </Text>
37
37
  */
38
- export declare const Text: import("../component").SnapComponent<TextProps, "Text">;
38
+ export declare const Text: import("../component.mjs").SnapComponent<TextProps, "Text">;
39
39
  /**
40
40
  * A text element.
41
41
  *