@metamask/snaps-sdk 6.2.1 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/dist/error-wrappers.cjs +146 -0
- package/dist/error-wrappers.cjs.map +1 -0
- package/dist/error-wrappers.d.cts +830 -0
- package/dist/error-wrappers.d.cts.map +1 -0
- package/dist/{types/error-wrappers.d.ts → error-wrappers.d.mts} +193 -192
- package/dist/error-wrappers.d.mts.map +1 -0
- package/dist/error-wrappers.mjs +143 -0
- package/dist/error-wrappers.mjs.map +1 -0
- package/dist/errors.cjs +124 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{types/errors.d.ts → errors.d.cts} +3 -2
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +87 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +120 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/images.cjs +91 -0
- package/dist/images.cjs.map +1 -0
- package/dist/{types/images.d.ts → images.d.cts} +2 -1
- package/dist/images.d.cts.map +1 -0
- package/dist/images.d.mts +70 -0
- package/dist/images.d.mts.map +1 -0
- package/dist/images.mjs +86 -0
- package/dist/images.mjs.map +1 -0
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +7 -1201
- package/dist/index.mjs.map +1 -1
- package/dist/internals/error-wrappers.cjs +44 -0
- package/dist/internals/error-wrappers.cjs.map +1 -0
- package/dist/internals/error-wrappers.d.cts +60 -0
- package/dist/internals/error-wrappers.d.cts.map +1 -0
- package/dist/{types/internals/error-wrappers.d.ts → internals/error-wrappers.d.mts} +15 -14
- package/dist/internals/error-wrappers.d.mts.map +1 -0
- package/dist/internals/error-wrappers.mjs +40 -0
- package/dist/internals/error-wrappers.mjs.map +1 -0
- package/dist/internals/errors.cjs +80 -0
- package/dist/internals/errors.cjs.map +1 -0
- package/dist/{types/internals/errors.d.ts → internals/errors.d.cts} +1 -0
- package/dist/internals/errors.d.cts.map +1 -0
- package/dist/internals/errors.d.mts +42 -0
- package/dist/internals/errors.d.mts.map +1 -0
- package/dist/internals/errors.mjs +73 -0
- package/dist/internals/errors.mjs.map +1 -0
- package/dist/internals/helpers.cjs +3 -0
- package/dist/internals/helpers.cjs.map +1 -0
- package/dist/{types/internals/helpers.d.ts → internals/helpers.d.cts} +2 -1
- package/dist/internals/helpers.d.cts.map +1 -0
- package/dist/internals/helpers.d.mts +37 -0
- package/dist/internals/helpers.d.mts.map +1 -0
- package/dist/internals/helpers.mjs +2 -0
- package/dist/internals/helpers.mjs.map +1 -0
- package/dist/internals/index.cjs +23 -0
- package/dist/internals/index.cjs.map +1 -0
- package/dist/internals/index.d.cts +7 -0
- package/dist/internals/index.d.cts.map +1 -0
- package/dist/internals/index.d.mts +7 -0
- package/dist/internals/index.d.mts.map +1 -0
- package/dist/internals/index.mjs +7 -0
- package/dist/internals/index.mjs.map +1 -0
- package/dist/internals/jsx.cjs +17 -0
- package/dist/internals/jsx.cjs.map +1 -0
- package/dist/{types/internals/jsx.d.ts → internals/jsx.d.cts} +3 -2
- package/dist/internals/jsx.d.cts.map +1 -0
- package/dist/internals/jsx.d.mts +31 -0
- package/dist/internals/jsx.d.mts.map +1 -0
- package/dist/internals/jsx.mjs +13 -0
- package/dist/internals/jsx.mjs.map +1 -0
- package/dist/internals/structs.cjs +161 -0
- package/dist/internals/structs.cjs.map +1 -0
- package/dist/{types/internals/structs.d.ts → internals/structs.d.cts} +13 -3
- package/dist/internals/structs.d.cts.map +1 -0
- package/dist/internals/structs.d.mts +69 -0
- package/dist/internals/structs.d.mts.map +1 -0
- package/dist/internals/structs.mjs +153 -0
- package/dist/internals/structs.mjs.map +1 -0
- package/dist/internals/svg.cjs +23 -0
- package/dist/internals/svg.cjs.map +1 -0
- package/dist/{types/internals/svg.d.ts → internals/svg.d.cts} +1 -0
- package/dist/internals/svg.d.cts.map +1 -0
- package/dist/internals/svg.d.mts +8 -0
- package/dist/internals/svg.d.mts.map +1 -0
- package/dist/internals/svg.mjs +19 -0
- package/dist/internals/svg.mjs.map +1 -0
- package/dist/jsx/component.cjs +32 -0
- package/dist/jsx/component.cjs.map +1 -0
- package/dist/{types/jsx/component.d.ts → jsx/component.d.cts} +2 -1
- package/dist/jsx/component.d.cts.map +1 -0
- package/dist/jsx/component.d.mts +74 -0
- package/dist/jsx/component.d.mts.map +1 -0
- package/dist/jsx/component.mjs +28 -0
- package/dist/jsx/component.mjs.map +1 -0
- package/dist/jsx/components/Address.cjs +23 -0
- package/dist/jsx/components/Address.cjs.map +1 -0
- package/dist/jsx/components/Address.d.cts +34 -0
- package/dist/jsx/components/Address.d.cts.map +1 -0
- package/dist/jsx/components/Address.d.mts +34 -0
- package/dist/jsx/components/Address.d.mts.map +1 -0
- package/dist/jsx/components/Address.mjs +20 -0
- package/dist/jsx/components/Address.mjs.map +1 -0
- package/dist/jsx/components/Box.cjs +18 -0
- package/dist/jsx/components/Box.cjs.map +1 -0
- package/dist/{types/jsx/components/Box.d.ts → jsx/components/Box.d.cts} +2 -1
- package/dist/jsx/components/Box.d.cts.map +1 -0
- package/dist/jsx/components/Box.d.mts +32 -0
- package/dist/jsx/components/Box.d.mts.map +1 -0
- package/dist/jsx/components/Box.mjs +15 -0
- package/dist/jsx/components/Box.mjs.map +1 -0
- package/dist/jsx/components/Card.cjs +20 -0
- package/dist/jsx/components/Card.cjs.map +1 -0
- package/dist/{types/jsx/components/Card.d.ts → jsx/components/Card.d.cts} +1 -0
- package/dist/jsx/components/Card.d.cts.map +1 -0
- package/dist/jsx/components/Card.d.mts +37 -0
- package/dist/jsx/components/Card.d.mts.map +1 -0
- package/dist/jsx/components/Card.mjs +17 -0
- package/dist/jsx/components/Card.mjs.map +1 -0
- package/dist/jsx/components/Container.cjs +24 -0
- package/dist/jsx/components/Container.cjs.map +1 -0
- package/dist/{types/jsx/components/Container.d.ts → jsx/components/Container.d.cts} +4 -3
- package/dist/jsx/components/Container.d.cts.map +1 -0
- package/dist/jsx/components/Container.d.mts +35 -0
- package/dist/jsx/components/Container.d.mts.map +1 -0
- package/dist/jsx/components/Container.mjs +21 -0
- package/dist/jsx/components/Container.mjs.map +1 -0
- package/dist/jsx/components/Copyable.cjs +20 -0
- package/dist/jsx/components/Copyable.cjs.map +1 -0
- package/dist/{types/jsx/components/Copyable.d.ts → jsx/components/Copyable.d.cts} +1 -0
- package/dist/jsx/components/Copyable.d.cts.map +1 -0
- package/dist/jsx/components/Copyable.d.mts +33 -0
- package/dist/jsx/components/Copyable.d.mts.map +1 -0
- package/dist/jsx/components/Copyable.mjs +17 -0
- package/dist/jsx/components/Copyable.mjs.map +1 -0
- package/dist/jsx/components/Divider.cjs +17 -0
- package/dist/jsx/components/Divider.cjs.map +1 -0
- package/dist/{types/jsx/components/Divider.d.ts → jsx/components/Divider.d.cts} +1 -0
- package/dist/jsx/components/Divider.d.cts.map +1 -0
- package/dist/jsx/components/Divider.d.mts +18 -0
- package/dist/jsx/components/Divider.d.mts.map +1 -0
- package/dist/jsx/components/Divider.mjs +14 -0
- package/dist/jsx/components/Divider.mjs.map +1 -0
- package/dist/jsx/components/Footer.cjs +19 -0
- package/dist/jsx/components/Footer.cjs.map +1 -0
- package/dist/{types/jsx/components/Footer.d.ts → jsx/components/Footer.d.cts} +2 -1
- package/dist/jsx/components/Footer.d.cts.map +1 -0
- package/dist/jsx/components/Footer.d.mts +29 -0
- package/dist/jsx/components/Footer.d.mts.map +1 -0
- package/dist/jsx/components/Footer.mjs +16 -0
- package/dist/jsx/components/Footer.mjs.map +1 -0
- package/dist/jsx/components/Heading.cjs +16 -0
- package/dist/jsx/components/Heading.cjs.map +1 -0
- package/dist/{types/jsx/components/Heading.d.ts → jsx/components/Heading.d.cts} +2 -1
- package/dist/jsx/components/Heading.d.cts.map +1 -0
- package/dist/jsx/components/Heading.d.mts +27 -0
- package/dist/jsx/components/Heading.d.mts.map +1 -0
- package/dist/jsx/components/Heading.mjs +13 -0
- package/dist/jsx/components/Heading.mjs.map +1 -0
- package/dist/jsx/components/Icon.cjs +180 -0
- package/dist/jsx/components/Icon.cjs.map +1 -0
- package/dist/jsx/components/Icon.d.cts +190 -0
- package/dist/jsx/components/Icon.d.cts.map +1 -0
- package/dist/jsx/components/Icon.d.mts +190 -0
- package/dist/jsx/components/Icon.d.mts.map +1 -0
- package/dist/jsx/components/Icon.mjs +177 -0
- package/dist/jsx/components/Icon.mjs.map +1 -0
- package/dist/jsx/components/Image.cjs +22 -0
- package/dist/jsx/components/Image.cjs.map +1 -0
- package/dist/{types/jsx/components/Image.d.ts → jsx/components/Image.d.cts} +1 -0
- package/dist/jsx/components/Image.d.cts.map +1 -0
- package/dist/jsx/components/Image.d.mts +37 -0
- package/dist/jsx/components/Image.d.mts.map +1 -0
- package/dist/jsx/components/Image.mjs +19 -0
- package/dist/jsx/components/Image.mjs.map +1 -0
- package/dist/jsx/components/Link.cjs +18 -0
- package/dist/jsx/components/Link.cjs.map +1 -0
- package/dist/{types/jsx/components/Link.d.ts → jsx/components/Link.d.cts} +3 -2
- package/dist/jsx/components/Link.d.cts.map +1 -0
- package/dist/jsx/components/Link.d.mts +36 -0
- package/dist/jsx/components/Link.d.mts.map +1 -0
- package/dist/jsx/components/Link.mjs +15 -0
- package/dist/jsx/components/Link.mjs.map +1 -0
- package/dist/jsx/components/Row.cjs +22 -0
- package/dist/jsx/components/Row.cjs.map +1 -0
- package/dist/{types/jsx/components/Row.d.ts → jsx/components/Row.d.cts} +5 -4
- package/dist/jsx/components/Row.d.cts.map +1 -0
- package/dist/jsx/components/Row.d.mts +46 -0
- package/dist/jsx/components/Row.d.mts.map +1 -0
- package/dist/jsx/components/Row.mjs +19 -0
- package/dist/jsx/components/Row.mjs.map +1 -0
- package/dist/jsx/components/Section.cjs +26 -0
- package/dist/jsx/components/Section.cjs.map +1 -0
- package/dist/jsx/components/Section.d.cts +38 -0
- package/dist/jsx/components/Section.d.cts.map +1 -0
- package/dist/jsx/components/Section.d.mts +38 -0
- package/dist/jsx/components/Section.d.mts.map +1 -0
- package/dist/jsx/components/Section.mjs +23 -0
- package/dist/jsx/components/Section.mjs.map +1 -0
- package/dist/jsx/components/Spinner.cjs +17 -0
- package/dist/jsx/components/Spinner.cjs.map +1 -0
- package/dist/{types/jsx/components/Spinner.d.ts → jsx/components/Spinner.d.cts} +1 -0
- package/dist/jsx/components/Spinner.d.cts.map +1 -0
- package/dist/jsx/components/Spinner.d.mts +18 -0
- package/dist/jsx/components/Spinner.d.mts.map +1 -0
- package/dist/jsx/components/Spinner.mjs +14 -0
- package/dist/jsx/components/Spinner.mjs.map +1 -0
- package/dist/jsx/components/Text.cjs +22 -0
- package/dist/jsx/components/Text.cjs.map +1 -0
- package/dist/{types/jsx/components/Text.d.ts → jsx/components/Text.d.cts} +11 -4
- package/dist/jsx/components/Text.d.cts.map +1 -0
- package/dist/jsx/components/Text.d.mts +45 -0
- package/dist/jsx/components/Text.d.mts.map +1 -0
- package/dist/jsx/components/Text.mjs +19 -0
- package/dist/jsx/components/Text.mjs.map +1 -0
- package/dist/jsx/components/Tooltip.cjs +23 -0
- package/dist/jsx/components/Tooltip.cjs.map +1 -0
- package/dist/{types/jsx/components/Tooltip.d.ts → jsx/components/Tooltip.d.cts} +8 -6
- package/dist/jsx/components/Tooltip.d.cts.map +1 -0
- package/dist/jsx/components/Tooltip.d.mts +40 -0
- package/dist/jsx/components/Tooltip.d.mts.map +1 -0
- package/dist/jsx/components/Tooltip.mjs +20 -0
- package/dist/jsx/components/Tooltip.mjs.map +1 -0
- package/dist/jsx/components/Value.cjs +21 -0
- package/dist/jsx/components/Value.cjs.map +1 -0
- package/dist/{types/jsx/components/Value.d.ts → jsx/components/Value.d.cts} +1 -0
- package/dist/jsx/components/Value.d.cts.map +1 -0
- package/dist/jsx/components/Value.d.mts +32 -0
- package/dist/jsx/components/Value.d.mts.map +1 -0
- package/dist/jsx/components/Value.mjs +18 -0
- package/dist/jsx/components/Value.mjs.map +1 -0
- package/dist/jsx/components/form/Button.cjs +17 -0
- package/dist/jsx/components/form/Button.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Button.d.ts → jsx/components/form/Button.d.cts} +5 -2
- package/dist/jsx/components/form/Button.d.cts.map +1 -0
- package/dist/jsx/components/form/Button.d.mts +40 -0
- package/dist/jsx/components/form/Button.d.mts.map +1 -0
- package/dist/jsx/components/form/Button.mjs +14 -0
- package/dist/jsx/components/form/Button.mjs.map +1 -0
- package/dist/jsx/components/form/Checkbox.cjs +20 -0
- package/dist/jsx/components/form/Checkbox.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Checkbox.d.ts → jsx/components/form/Checkbox.d.cts} +1 -0
- package/dist/jsx/components/form/Checkbox.d.cts.map +1 -0
- package/dist/jsx/components/form/Checkbox.d.mts +36 -0
- package/dist/jsx/components/form/Checkbox.d.mts.map +1 -0
- package/dist/jsx/components/form/Checkbox.mjs +17 -0
- package/dist/jsx/components/form/Checkbox.mjs.map +1 -0
- package/dist/jsx/components/form/Dropdown.cjs +23 -0
- package/dist/jsx/components/form/Dropdown.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Dropdown.d.ts → jsx/components/form/Dropdown.d.cts} +3 -2
- package/dist/jsx/components/form/Dropdown.d.cts.map +1 -0
- package/dist/jsx/components/form/Dropdown.d.mts +39 -0
- package/dist/jsx/components/form/Dropdown.d.mts.map +1 -0
- package/dist/jsx/components/form/Dropdown.mjs +20 -0
- package/dist/jsx/components/form/Dropdown.mjs.map +1 -0
- package/dist/jsx/components/form/Field.cjs +26 -0
- package/dist/jsx/components/form/Field.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Field.d.ts → jsx/components/form/Field.d.cts} +9 -7
- package/dist/jsx/components/form/Field.d.cts.map +1 -0
- package/dist/jsx/components/form/Field.d.mts +46 -0
- package/dist/jsx/components/form/Field.d.mts.map +1 -0
- package/dist/jsx/components/form/Field.mjs +23 -0
- package/dist/jsx/components/form/Field.mjs.map +1 -0
- package/dist/jsx/components/form/FileInput.cjs +31 -0
- package/dist/jsx/components/form/FileInput.cjs.map +1 -0
- package/dist/{types/jsx/components/form/FileInput.d.ts → jsx/components/form/FileInput.d.cts} +1 -0
- package/dist/jsx/components/form/FileInput.d.cts.map +1 -0
- package/dist/jsx/components/form/FileInput.d.mts +48 -0
- package/dist/jsx/components/form/FileInput.d.mts.map +1 -0
- package/dist/jsx/components/form/FileInput.mjs +28 -0
- package/dist/jsx/components/form/FileInput.mjs.map +1 -0
- package/dist/jsx/components/form/Form.cjs +24 -0
- package/dist/jsx/components/form/Form.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Form.d.ts → jsx/components/form/Form.d.cts} +2 -1
- package/dist/jsx/components/form/Form.d.cts.map +1 -0
- package/dist/jsx/components/form/Form.d.mts +37 -0
- package/dist/jsx/components/form/Form.d.mts.map +1 -0
- package/dist/jsx/components/form/Form.mjs +21 -0
- package/dist/jsx/components/form/Form.mjs.map +1 -0
- package/dist/jsx/components/form/Input.cjs +20 -0
- package/dist/jsx/components/form/Input.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Input.d.ts → jsx/components/form/Input.d.cts} +1 -0
- package/dist/jsx/components/form/Input.d.cts.map +1 -0
- package/dist/jsx/components/form/Input.d.mts +36 -0
- package/dist/jsx/components/form/Input.d.mts.map +1 -0
- package/dist/jsx/components/form/Input.mjs +17 -0
- package/dist/jsx/components/form/Input.mjs.map +1 -0
- package/dist/jsx/components/form/Option.cjs +25 -0
- package/dist/jsx/components/form/Option.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Option.d.ts → jsx/components/form/Option.d.cts} +1 -0
- package/dist/jsx/components/form/Option.d.cts.map +1 -0
- package/dist/jsx/components/form/Option.d.mts +36 -0
- package/dist/jsx/components/form/Option.d.mts.map +1 -0
- package/dist/jsx/components/form/Option.mjs +22 -0
- package/dist/jsx/components/form/Option.mjs.map +1 -0
- package/dist/jsx/components/form/Radio.cjs +23 -0
- package/dist/jsx/components/form/Radio.cjs.map +1 -0
- package/dist/{types/jsx/components/form/Radio.d.ts → jsx/components/form/Radio.d.cts} +1 -0
- package/dist/jsx/components/form/Radio.d.cts.map +1 -0
- package/dist/jsx/components/form/Radio.d.mts +36 -0
- package/dist/jsx/components/form/Radio.d.mts.map +1 -0
- package/dist/jsx/components/form/Radio.mjs +20 -0
- package/dist/jsx/components/form/Radio.mjs.map +1 -0
- package/dist/jsx/components/form/RadioGroup.cjs +14 -0
- package/dist/jsx/components/form/RadioGroup.cjs.map +1 -0
- package/dist/{types/jsx/components/form/RadioGroup.d.ts → jsx/components/form/RadioGroup.d.cts} +3 -2
- package/dist/jsx/components/form/RadioGroup.d.cts.map +1 -0
- package/dist/jsx/components/form/RadioGroup.d.mts +30 -0
- package/dist/jsx/components/form/RadioGroup.d.mts.map +1 -0
- package/dist/jsx/components/form/RadioGroup.mjs +11 -0
- package/dist/jsx/components/form/RadioGroup.mjs.map +1 -0
- package/dist/jsx/components/form/Selector.cjs +24 -0
- package/dist/jsx/components/form/Selector.cjs.map +1 -0
- package/dist/jsx/components/form/Selector.d.cts +42 -0
- package/dist/jsx/components/form/Selector.d.cts.map +1 -0
- package/dist/jsx/components/form/Selector.d.mts +42 -0
- package/dist/jsx/components/form/Selector.d.mts.map +1 -0
- package/dist/jsx/components/form/Selector.mjs +21 -0
- package/dist/jsx/components/form/Selector.mjs.map +1 -0
- package/dist/jsx/components/form/SelectorOption.cjs +23 -0
- package/dist/jsx/components/form/SelectorOption.cjs.map +1 -0
- package/dist/jsx/components/form/SelectorOption.d.cts +36 -0
- package/dist/jsx/components/form/SelectorOption.d.cts.map +1 -0
- package/dist/jsx/components/form/SelectorOption.d.mts +36 -0
- package/dist/jsx/components/form/SelectorOption.d.mts.map +1 -0
- package/dist/jsx/components/form/SelectorOption.mjs +20 -0
- package/dist/jsx/components/form/SelectorOption.mjs.map +1 -0
- package/dist/jsx/components/form/index.cjs +29 -0
- package/dist/jsx/components/form/index.cjs.map +1 -0
- package/dist/jsx/components/form/index.d.cts +26 -0
- package/dist/jsx/components/form/index.d.cts.map +1 -0
- package/dist/jsx/components/form/index.d.mts +26 -0
- package/dist/jsx/components/form/index.d.mts.map +1 -0
- package/dist/jsx/components/form/index.mjs +13 -0
- package/dist/jsx/components/form/index.mjs.map +1 -0
- package/dist/jsx/components/formatting/Bold.cjs +21 -0
- package/dist/jsx/components/formatting/Bold.cjs.map +1 -0
- package/dist/{types/jsx/components/formatting/Bold.d.ts → jsx/components/formatting/Bold.d.cts} +2 -1
- package/dist/jsx/components/formatting/Bold.d.cts.map +1 -0
- package/dist/jsx/components/formatting/Bold.d.mts +33 -0
- package/dist/jsx/components/formatting/Bold.d.mts.map +1 -0
- package/dist/jsx/components/formatting/Bold.mjs +18 -0
- package/dist/jsx/components/formatting/Bold.mjs.map +1 -0
- package/dist/jsx/components/formatting/Italic.cjs +20 -0
- package/dist/jsx/components/formatting/Italic.cjs.map +1 -0
- package/dist/{types/jsx/components/formatting/Italic.d.ts → jsx/components/formatting/Italic.d.cts} +2 -1
- package/dist/jsx/components/formatting/Italic.d.cts.map +1 -0
- package/dist/jsx/components/formatting/Italic.d.mts +35 -0
- package/dist/jsx/components/formatting/Italic.d.mts.map +1 -0
- package/dist/jsx/components/formatting/Italic.mjs +17 -0
- package/dist/jsx/components/formatting/Italic.mjs.map +1 -0
- package/dist/jsx/components/formatting/index.cjs +19 -0
- package/dist/jsx/components/formatting/index.cjs.map +1 -0
- package/dist/jsx/components/formatting/index.d.cts +6 -0
- package/dist/jsx/components/formatting/index.d.cts.map +1 -0
- package/dist/jsx/components/formatting/index.d.mts +6 -0
- package/dist/jsx/components/formatting/index.d.mts.map +1 -0
- package/dist/jsx/components/formatting/index.mjs +3 -0
- package/dist/jsx/components/formatting/index.mjs.map +1 -0
- package/dist/jsx/components/index.cjs +36 -0
- package/dist/jsx/components/index.cjs.map +1 -0
- package/dist/jsx/components/index.d.cts +43 -0
- package/dist/jsx/components/index.d.cts.map +1 -0
- package/dist/jsx/components/index.d.mts +43 -0
- package/dist/jsx/components/index.d.mts.map +1 -0
- package/dist/jsx/components/index.mjs +20 -0
- package/dist/jsx/components/index.mjs.map +1 -0
- package/dist/jsx/index.cjs +31 -0
- package/dist/jsx/index.cjs.map +1 -0
- package/dist/jsx/index.d.cts +6 -0
- package/dist/jsx/index.d.cts.map +1 -0
- package/dist/jsx/index.d.mts +6 -0
- package/dist/jsx/index.d.mts.map +1 -0
- package/dist/jsx/index.mjs +5 -586
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/jsx-dev-runtime.cjs +27 -0
- package/dist/jsx/jsx-dev-runtime.cjs.map +1 -0
- package/dist/{types/jsx/jsx-dev-runtime.d.ts → jsx/jsx-dev-runtime.d.cts} +2 -1
- package/dist/jsx/jsx-dev-runtime.d.cts.map +1 -0
- package/dist/jsx/jsx-dev-runtime.d.mts +18 -0
- package/dist/jsx/jsx-dev-runtime.d.mts.map +1 -0
- package/dist/jsx/jsx-dev-runtime.mjs +21 -414
- package/dist/jsx/jsx-dev-runtime.mjs.map +1 -1
- package/dist/jsx/jsx-runtime.cjs +54 -0
- package/dist/jsx/jsx-runtime.cjs.map +1 -0
- package/dist/{types/jsx/jsx-runtime.d.ts → jsx/jsx-runtime.d.cts} +2 -1
- package/dist/jsx/jsx-runtime.d.cts.map +1 -0
- package/dist/jsx/jsx-runtime.d.mts +36 -0
- package/dist/jsx/jsx-runtime.d.mts.map +1 -0
- package/dist/jsx/jsx-runtime.mjs +46 -21
- package/dist/jsx/jsx-runtime.mjs.map +1 -1
- package/dist/jsx/validation.cjs +577 -0
- package/dist/jsx/validation.cjs.map +1 -0
- package/dist/{types/jsx/validation.d.ts → jsx/validation.d.cts} +55 -38
- package/dist/jsx/validation.d.cts.map +1 -0
- package/dist/jsx/validation.d.mts +247 -0
- package/dist/jsx/validation.d.mts.map +1 -0
- package/dist/jsx/validation.mjs +571 -0
- package/dist/jsx/validation.mjs.map +1 -0
- package/dist/types/caip.cjs +3 -0
- package/dist/types/caip.cjs.map +1 -0
- package/dist/types/{types/caip.d.ts → caip.d.cts} +1 -0
- package/dist/types/caip.d.cts.map +1 -0
- package/dist/types/caip.d.mts +13 -0
- package/dist/types/caip.d.mts.map +1 -0
- package/dist/types/caip.mjs +2 -0
- package/dist/types/caip.mjs.map +1 -0
- package/dist/types/global.cjs +3 -0
- package/dist/types/global.cjs.map +1 -0
- package/dist/types/{types/global.d.ts → global.d.cts} +2 -1
- package/dist/types/global.d.cts.map +1 -0
- package/dist/types/global.d.mts +9 -0
- package/dist/types/global.d.mts.map +1 -0
- package/dist/types/global.mjs +2 -0
- package/dist/types/global.mjs.map +1 -0
- package/dist/types/handlers/cronjob.cjs +3 -0
- package/dist/types/handlers/cronjob.cjs.map +1 -0
- package/dist/types/{types/handlers/cronjob.d.ts → handlers/cronjob.d.cts} +2 -1
- package/dist/types/handlers/cronjob.d.cts.map +1 -0
- package/dist/types/handlers/cronjob.d.mts +15 -0
- package/dist/types/handlers/cronjob.d.mts.map +1 -0
- package/dist/types/handlers/cronjob.mjs +2 -0
- package/dist/types/handlers/cronjob.mjs.map +1 -0
- package/dist/types/handlers/home-page.cjs +3 -0
- package/dist/types/handlers/home-page.cjs.map +1 -0
- package/dist/types/{types/handlers/home-page.d.ts → handlers/home-page.d.cts} +2 -1
- package/dist/types/handlers/home-page.d.cts.map +1 -0
- package/dist/types/handlers/home-page.d.mts +23 -0
- package/dist/types/handlers/home-page.d.mts.map +1 -0
- package/dist/types/handlers/home-page.mjs +2 -0
- package/dist/types/handlers/home-page.mjs.map +1 -0
- package/dist/types/handlers/index.cjs +26 -0
- package/dist/types/handlers/index.cjs.map +1 -0
- package/dist/types/handlers/index.d.cts +10 -0
- package/dist/types/handlers/index.d.cts.map +1 -0
- package/dist/types/handlers/index.d.mts +10 -0
- package/dist/types/handlers/index.d.mts.map +1 -0
- package/dist/types/handlers/index.mjs +10 -0
- package/dist/types/handlers/index.mjs.map +1 -0
- package/dist/types/handlers/keyring.cjs +3 -0
- package/dist/types/handlers/keyring.cjs.map +1 -0
- package/dist/types/{types/handlers/keyring.d.ts → handlers/keyring.d.cts} +2 -1
- package/dist/types/handlers/keyring.d.cts.map +1 -0
- package/dist/types/handlers/keyring.d.mts +21 -0
- package/dist/types/handlers/keyring.d.mts.map +1 -0
- package/dist/types/handlers/keyring.mjs +2 -0
- package/dist/types/handlers/keyring.mjs.map +1 -0
- package/dist/types/handlers/lifecycle.cjs +3 -0
- package/dist/types/handlers/lifecycle.cjs.map +1 -0
- package/dist/types/{types/handlers/lifecycle.d.ts → handlers/lifecycle.d.cts} +1 -0
- package/dist/types/handlers/lifecycle.d.cts.map +1 -0
- package/dist/types/handlers/lifecycle.d.mts +38 -0
- package/dist/types/handlers/lifecycle.d.mts.map +1 -0
- package/dist/types/handlers/lifecycle.mjs +2 -0
- package/dist/types/handlers/lifecycle.mjs.map +1 -0
- package/dist/types/handlers/name-lookup.cjs +3 -0
- package/dist/types/handlers/name-lookup.cjs.map +1 -0
- package/dist/types/{types/handlers/name-lookup.d.ts → handlers/name-lookup.d.cts} +3 -2
- package/dist/types/handlers/name-lookup.d.cts.map +1 -0
- package/dist/types/handlers/name-lookup.d.mts +82 -0
- package/dist/types/handlers/name-lookup.d.mts.map +1 -0
- package/dist/types/handlers/name-lookup.mjs +2 -0
- package/dist/types/handlers/name-lookup.mjs.map +1 -0
- package/dist/types/handlers/rpc-request.cjs +3 -0
- package/dist/types/handlers/rpc-request.cjs.map +1 -0
- package/dist/types/{types/handlers/rpc-request.d.ts → handlers/rpc-request.d.cts} +2 -1
- package/dist/types/handlers/rpc-request.d.cts.map +1 -0
- package/dist/types/handlers/rpc-request.d.mts +22 -0
- package/dist/types/handlers/rpc-request.d.mts.map +1 -0
- package/dist/types/handlers/rpc-request.mjs +2 -0
- package/dist/types/handlers/rpc-request.mjs.map +1 -0
- package/dist/types/handlers/signature.cjs +3 -0
- package/dist/types/handlers/signature.cjs.map +1 -0
- package/dist/types/{types/handlers/signature.d.ts → handlers/signature.d.cts} +4 -3
- package/dist/types/handlers/signature.d.cts.map +1 -0
- package/dist/types/handlers/signature.d.mts +112 -0
- package/dist/types/handlers/signature.d.mts.map +1 -0
- package/dist/types/handlers/signature.mjs +2 -0
- package/dist/types/handlers/signature.mjs.map +1 -0
- package/dist/types/handlers/transaction.cjs +15 -0
- package/dist/types/handlers/transaction.cjs.map +1 -0
- package/dist/types/{types/handlers/transaction.d.ts → handlers/transaction.d.cts} +4 -3
- package/dist/types/handlers/transaction.d.cts.map +1 -0
- package/dist/types/handlers/transaction.d.mts +115 -0
- package/dist/types/handlers/transaction.d.mts.map +1 -0
- package/dist/types/handlers/transaction.mjs +12 -0
- package/dist/types/handlers/transaction.mjs.map +1 -0
- package/dist/types/handlers/user-input.cjs +56 -0
- package/dist/types/handlers/user-input.cjs.map +1 -0
- package/dist/types/{types/handlers/user-input.d.ts → handlers/user-input.d.cts} +11 -10
- package/dist/types/handlers/user-input.d.cts.map +1 -0
- package/dist/types/handlers/user-input.d.mts +196 -0
- package/dist/types/handlers/user-input.d.mts.map +1 -0
- package/dist/types/handlers/user-input.mjs +53 -0
- package/dist/types/handlers/user-input.mjs.map +1 -0
- package/dist/types/images.cjs +2 -0
- package/dist/types/images.cjs.map +1 -0
- package/dist/types/{types/images.d.ts → images.d.cts} +1 -0
- package/dist/types/images.d.cts.map +1 -0
- package/dist/types/images.d.mts +13 -0
- package/dist/types/images.d.mts.map +1 -0
- package/dist/types/images.mjs +2 -0
- package/dist/types/images.mjs.map +1 -0
- package/dist/types/index.cjs +29 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +10 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +13 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/interface.cjs +26 -0
- package/dist/types/interface.cjs.map +1 -0
- package/dist/types/{types/interface.d.ts → interface.d.cts} +27 -26
- package/dist/types/interface.d.cts.map +1 -0
- package/dist/types/interface.d.mts +120 -0
- package/dist/types/interface.d.mts.map +1 -0
- package/dist/types/interface.mjs +23 -0
- package/dist/types/interface.mjs.map +1 -0
- package/dist/types/methods/create-interface.cjs +3 -0
- package/dist/types/methods/create-interface.cjs.map +1 -0
- package/dist/types/{types/methods/create-interface.d.ts → methods/create-interface.d.cts} +2 -1
- package/dist/types/methods/create-interface.d.cts.map +1 -0
- package/dist/types/methods/create-interface.d.mts +15 -0
- package/dist/types/methods/create-interface.d.mts.map +1 -0
- package/dist/types/methods/create-interface.mjs +2 -0
- package/dist/types/methods/create-interface.mjs.map +1 -0
- package/dist/types/methods/dialog.cjs +18 -0
- package/dist/types/methods/dialog.cjs.map +1 -0
- package/dist/types/{types/methods/dialog.d.ts → methods/dialog.d.cts} +4 -3
- package/dist/types/methods/dialog.d.cts.map +1 -0
- package/dist/types/methods/dialog.d.mts +88 -0
- package/dist/types/methods/dialog.d.mts.map +1 -0
- package/dist/types/methods/dialog.mjs +15 -0
- package/dist/types/methods/dialog.mjs.map +1 -0
- package/dist/types/methods/get-bip32-entropy.cjs +3 -0
- package/dist/types/methods/get-bip32-entropy.cjs.map +1 -0
- package/dist/types/{types/methods/get-bip32-entropy.d.ts → methods/get-bip32-entropy.d.cts} +3 -2
- package/dist/types/methods/get-bip32-entropy.d.cts.map +1 -0
- package/dist/types/methods/get-bip32-entropy.d.mts +16 -0
- package/dist/types/methods/get-bip32-entropy.d.mts.map +1 -0
- package/dist/types/methods/get-bip32-entropy.mjs +2 -0
- package/dist/types/methods/get-bip32-entropy.mjs.map +1 -0
- package/dist/types/methods/get-bip32-public-key.cjs +3 -0
- package/dist/types/methods/get-bip32-public-key.cjs.map +1 -0
- package/dist/types/{types/methods/get-bip32-public-key.d.ts → methods/get-bip32-public-key.d.cts} +2 -1
- package/dist/types/methods/get-bip32-public-key.d.cts.map +1 -0
- package/dist/types/methods/get-bip32-public-key.d.mts +20 -0
- package/dist/types/methods/get-bip32-public-key.d.mts.map +1 -0
- package/dist/types/methods/get-bip32-public-key.mjs +2 -0
- package/dist/types/methods/get-bip32-public-key.mjs.map +1 -0
- package/dist/types/methods/get-bip44-entropy.cjs +3 -0
- package/dist/types/methods/get-bip44-entropy.cjs.map +1 -0
- package/dist/types/{types/methods/get-bip44-entropy.d.ts → methods/get-bip44-entropy.d.cts} +3 -2
- package/dist/types/methods/get-bip44-entropy.d.cts.map +1 -0
- package/dist/types/methods/get-bip44-entropy.d.mts +15 -0
- package/dist/types/methods/get-bip44-entropy.d.mts.map +1 -0
- package/dist/types/methods/get-bip44-entropy.mjs +2 -0
- package/dist/types/methods/get-bip44-entropy.mjs.map +1 -0
- package/dist/types/methods/get-client-status.cjs +3 -0
- package/dist/types/methods/get-client-status.cjs.map +1 -0
- package/dist/types/{types/methods/get-client-status.d.ts → methods/get-client-status.d.cts} +1 -0
- package/dist/types/methods/get-client-status.d.cts.map +1 -0
- package/dist/types/methods/get-client-status.d.mts +15 -0
- package/dist/types/methods/get-client-status.d.mts.map +1 -0
- package/dist/types/methods/get-client-status.mjs +2 -0
- package/dist/types/methods/get-client-status.mjs.map +1 -0
- package/dist/types/methods/get-entropy.cjs +3 -0
- package/dist/types/methods/get-entropy.cjs.map +1 -0
- package/dist/types/{types/methods/get-entropy.d.ts → methods/get-entropy.d.cts} +2 -1
- package/dist/types/methods/get-entropy.d.cts.map +1 -0
- package/dist/types/methods/get-entropy.d.mts +17 -0
- package/dist/types/methods/get-entropy.d.mts.map +1 -0
- package/dist/types/methods/get-entropy.mjs +2 -0
- package/dist/types/methods/get-entropy.mjs.map +1 -0
- package/dist/types/methods/get-file.cjs +13 -0
- package/dist/types/methods/get-file.cjs.map +1 -0
- package/dist/types/{types/methods/get-file.d.ts → methods/get-file.d.cts} +2 -1
- package/dist/types/methods/get-file.d.cts.map +1 -0
- package/dist/types/methods/get-file.d.mts +24 -0
- package/dist/types/methods/get-file.d.mts.map +1 -0
- package/dist/types/methods/get-file.mjs +10 -0
- package/dist/types/methods/get-file.mjs.map +1 -0
- package/dist/types/methods/get-interface-state.cjs +3 -0
- package/dist/types/methods/get-interface-state.cjs.map +1 -0
- package/dist/types/{types/methods/get-interface-state.d.ts → methods/get-interface-state.d.cts} +2 -1
- package/dist/types/methods/get-interface-state.d.cts.map +1 -0
- package/dist/types/methods/get-interface-state.d.mts +14 -0
- package/dist/types/methods/get-interface-state.d.mts.map +1 -0
- package/dist/types/methods/get-interface-state.mjs +2 -0
- package/dist/types/methods/get-interface-state.mjs.map +1 -0
- package/dist/types/methods/get-locale.cjs +3 -0
- package/dist/types/methods/get-locale.cjs.map +1 -0
- package/dist/types/{types/methods/get-locale.d.ts → methods/get-locale.d.cts} +1 -0
- package/dist/types/methods/get-locale.d.cts.map +1 -0
- package/dist/types/methods/get-locale.d.mts +13 -0
- package/dist/types/methods/get-locale.d.mts.map +1 -0
- package/dist/types/methods/get-locale.mjs +2 -0
- package/dist/types/methods/get-locale.mjs.map +1 -0
- package/dist/types/methods/get-preferences.cjs +3 -0
- package/dist/types/methods/get-preferences.cjs.map +1 -0
- package/dist/types/{types/methods/get-preferences.d.ts → methods/get-preferences.d.cts} +1 -0
- package/dist/types/methods/get-preferences.d.cts.map +1 -0
- package/dist/types/methods/get-preferences.d.mts +16 -0
- package/dist/types/methods/get-preferences.d.mts.map +1 -0
- package/dist/types/methods/get-preferences.mjs +2 -0
- package/dist/types/methods/get-preferences.mjs.map +1 -0
- package/dist/types/methods/get-snaps.cjs +3 -0
- package/dist/types/methods/get-snaps.cjs.map +1 -0
- package/dist/types/{types/methods/get-snaps.d.ts → methods/get-snaps.d.cts} +3 -2
- package/dist/types/methods/get-snaps.d.cts.map +1 -0
- package/dist/types/methods/get-snaps.d.mts +17 -0
- package/dist/types/methods/get-snaps.d.mts.map +1 -0
- package/dist/types/methods/get-snaps.mjs +2 -0
- package/dist/types/methods/get-snaps.mjs.map +1 -0
- package/dist/types/methods/index.cjs +38 -0
- package/dist/types/methods/index.cjs.map +1 -0
- package/dist/types/methods/index.d.cts +22 -0
- package/dist/types/methods/index.d.cts.map +1 -0
- package/dist/types/methods/index.d.mts +22 -0
- package/dist/types/methods/index.d.mts.map +1 -0
- package/dist/types/methods/index.mjs +22 -0
- package/dist/types/methods/index.mjs.map +1 -0
- package/dist/types/methods/invoke-keyring.cjs +3 -0
- package/dist/types/methods/invoke-keyring.cjs.map +1 -0
- package/dist/types/{types/methods/invoke-keyring.d.ts → methods/invoke-keyring.d.cts} +3 -2
- package/dist/types/methods/invoke-keyring.d.cts.map +1 -0
- package/dist/types/methods/invoke-keyring.d.mts +15 -0
- package/dist/types/methods/invoke-keyring.d.mts.map +1 -0
- package/dist/types/methods/invoke-keyring.mjs +2 -0
- package/dist/types/methods/invoke-keyring.mjs.map +1 -0
- package/dist/types/methods/invoke-snap.cjs +3 -0
- package/dist/types/methods/invoke-snap.cjs.map +1 -0
- package/dist/types/{types/methods/invoke-snap.d.ts → methods/invoke-snap.d.cts} +2 -1
- package/dist/types/methods/invoke-snap.d.cts.map +1 -0
- package/dist/types/methods/invoke-snap.d.mts +17 -0
- package/dist/types/methods/invoke-snap.d.mts.map +1 -0
- package/dist/types/methods/invoke-snap.mjs +2 -0
- package/dist/types/methods/invoke-snap.mjs.map +1 -0
- package/dist/types/methods/manage-accounts.cjs +3 -0
- package/dist/types/methods/manage-accounts.cjs.map +1 -0
- package/dist/types/{types/methods/manage-accounts.d.ts → methods/manage-accounts.d.cts} +2 -1
- package/dist/types/methods/manage-accounts.d.cts.map +1 -0
- package/dist/types/methods/manage-accounts.d.mts +19 -0
- package/dist/types/methods/manage-accounts.d.mts.map +1 -0
- package/dist/types/methods/manage-accounts.mjs +2 -0
- package/dist/types/methods/manage-accounts.mjs.map +1 -0
- package/dist/types/methods/manage-state.cjs +13 -0
- package/dist/types/methods/manage-state.cjs.map +1 -0
- package/dist/types/{types/methods/manage-state.d.ts → methods/manage-state.d.cts} +3 -2
- package/dist/types/methods/manage-state.d.cts.map +1 -0
- package/dist/types/methods/manage-state.d.mts +70 -0
- package/dist/types/methods/manage-state.d.mts.map +1 -0
- package/dist/types/methods/manage-state.mjs +10 -0
- package/dist/types/methods/manage-state.mjs.map +1 -0
- package/dist/types/methods/methods.cjs +3 -0
- package/dist/types/methods/methods.cjs.map +1 -0
- package/dist/types/{types/methods/methods.d.ts → methods/methods.d.cts} +22 -21
- package/dist/types/methods/methods.d.cts.map +1 -0
- package/dist/types/methods/methods.d.mts +75 -0
- package/dist/types/methods/methods.d.mts.map +1 -0
- package/dist/types/methods/methods.mjs +2 -0
- package/dist/types/methods/methods.mjs.map +1 -0
- package/dist/types/methods/notify.cjs +15 -0
- package/dist/types/methods/notify.cjs.map +1 -0
- package/dist/types/{types/methods/notify.d.ts → methods/notify.d.cts} +2 -1
- package/dist/types/methods/notify.d.cts.map +1 -0
- package/dist/types/methods/notify.d.mts +28 -0
- package/dist/types/methods/notify.d.mts.map +1 -0
- package/dist/types/methods/notify.mjs +12 -0
- package/dist/types/methods/notify.mjs.map +1 -0
- package/dist/types/methods/request-snaps.cjs +3 -0
- package/dist/types/methods/request-snaps.cjs.map +1 -0
- package/dist/types/{types/methods/request-snaps.d.ts → methods/request-snaps.d.cts} +3 -2
- package/dist/types/methods/request-snaps.d.cts.map +1 -0
- package/dist/types/methods/request-snaps.d.mts +19 -0
- package/dist/types/methods/request-snaps.d.mts.map +1 -0
- package/dist/types/methods/request-snaps.mjs +2 -0
- package/dist/types/methods/request-snaps.mjs.map +1 -0
- package/dist/types/methods/resolve-interface.cjs +3 -0
- package/dist/types/methods/resolve-interface.cjs.map +1 -0
- package/dist/types/{types/methods/resolve-interface.d.ts → methods/resolve-interface.d.cts} +2 -1
- package/dist/types/methods/resolve-interface.d.cts.map +1 -0
- package/dist/types/methods/resolve-interface.d.mts +16 -0
- package/dist/types/methods/resolve-interface.d.mts.map +1 -0
- package/dist/types/methods/resolve-interface.mjs +2 -0
- package/dist/types/methods/resolve-interface.mjs.map +1 -0
- package/dist/types/methods/update-interface.cjs +3 -0
- package/dist/types/methods/update-interface.cjs.map +1 -0
- package/dist/types/{types/methods/update-interface.d.ts → methods/update-interface.d.cts} +2 -1
- package/dist/types/methods/update-interface.d.cts.map +1 -0
- package/dist/types/methods/update-interface.d.mts +16 -0
- package/dist/types/methods/update-interface.d.mts.map +1 -0
- package/dist/types/methods/update-interface.mjs +2 -0
- package/dist/types/methods/update-interface.mjs.map +1 -0
- package/dist/types/permissions.cjs +3 -0
- package/dist/types/permissions.cjs.map +1 -0
- package/dist/types/{types/permissions.d.ts → permissions.d.cts} +4 -3
- package/dist/types/permissions.d.cts.map +1 -0
- package/dist/types/permissions.d.mts +75 -0
- package/dist/types/permissions.d.mts.map +1 -0
- package/dist/types/permissions.mjs +2 -0
- package/dist/types/permissions.mjs.map +1 -0
- package/dist/types/provider.cjs +3 -0
- package/dist/types/provider.cjs.map +1 -0
- package/dist/types/{types/provider.d.ts → provider.d.cts} +3 -2
- package/dist/types/provider.d.cts.map +1 -0
- package/dist/types/provider.d.mts +15 -0
- package/dist/types/provider.d.mts.map +1 -0
- package/dist/types/provider.mjs +2 -0
- package/dist/types/provider.mjs.map +1 -0
- package/dist/types/snap.cjs +3 -0
- package/dist/types/snap.cjs.map +1 -0
- package/dist/types/{types/snap.d.ts → snap.d.cts} +3 -2
- package/dist/types/snap.d.cts.map +1 -0
- package/dist/types/snap.d.mts +13 -0
- package/dist/types/snap.d.mts.map +1 -0
- package/dist/types/snap.mjs +2 -0
- package/dist/types/snap.mjs.map +1 -0
- package/dist/ui/builder.cjs +49 -0
- package/dist/ui/builder.cjs.map +1 -0
- package/dist/{types/ui/builder.d.ts → ui/builder.d.cts} +4 -3
- package/dist/ui/builder.d.cts.map +1 -0
- package/dist/ui/builder.d.mts +43 -0
- package/dist/ui/builder.d.mts.map +1 -0
- package/dist/ui/builder.mjs +45 -0
- package/dist/ui/builder.mjs.map +1 -0
- package/dist/ui/component.cjs +29 -0
- package/dist/ui/component.cjs.map +1 -0
- package/dist/{types/ui/component.d.ts → ui/component.d.cts} +2 -1
- package/dist/ui/component.d.cts.map +1 -0
- package/dist/ui/component.d.mts +18 -0
- package/dist/ui/component.d.mts.map +1 -0
- package/dist/ui/component.mjs +24 -0
- package/dist/ui/component.mjs.map +1 -0
- package/dist/ui/components/address.cjs +28 -0
- package/dist/ui/components/address.cjs.map +1 -0
- package/dist/{types/ui/components/address.d.ts → ui/components/address.d.cts} +6 -5
- package/dist/ui/components/address.d.cts.map +1 -0
- package/dist/ui/components/address.d.mts +37 -0
- package/dist/ui/components/address.d.mts.map +1 -0
- package/dist/ui/components/address.mjs +25 -0
- package/dist/ui/components/address.mjs.map +1 -0
- package/dist/ui/components/button.cjs +52 -0
- package/dist/ui/components/button.cjs.map +1 -0
- package/dist/{types/ui/components/button.d.ts → ui/components/button.d.cts} +9 -8
- package/dist/ui/components/button.d.cts.map +1 -0
- package/dist/ui/components/button.d.mts +65 -0
- package/dist/ui/components/button.d.mts.map +1 -0
- package/dist/ui/components/button.mjs +49 -0
- package/dist/ui/components/button.mjs.map +1 -0
- package/dist/ui/components/copyable.cjs +32 -0
- package/dist/ui/components/copyable.cjs.map +1 -0
- package/dist/{types/ui/components/copyable.d.ts → ui/components/copyable.d.cts} +6 -5
- package/dist/ui/components/copyable.d.cts.map +1 -0
- package/dist/ui/components/copyable.d.mts +49 -0
- package/dist/ui/components/copyable.d.mts.map +1 -0
- package/dist/ui/components/copyable.mjs +29 -0
- package/dist/ui/components/copyable.mjs.map +1 -0
- package/dist/ui/components/divider.cjs +20 -0
- package/dist/ui/components/divider.cjs.map +1 -0
- package/dist/{types/ui/components/divider.d.ts → ui/components/divider.d.cts} +3 -2
- package/dist/ui/components/divider.d.cts.map +1 -0
- package/dist/ui/components/divider.d.mts +24 -0
- package/dist/ui/components/divider.d.mts.map +1 -0
- package/dist/ui/components/divider.mjs +17 -0
- package/dist/ui/components/divider.mjs.map +1 -0
- package/dist/ui/components/form.cjs +41 -0
- package/dist/ui/components/form.cjs.map +1 -0
- package/dist/{types/ui/components/form.d.ts → ui/components/form.d.cts} +31 -30
- package/dist/ui/components/form.d.cts.map +1 -0
- package/dist/ui/components/form.d.mts +154 -0
- package/dist/ui/components/form.d.mts.map +1 -0
- package/dist/ui/components/form.mjs +38 -0
- package/dist/ui/components/form.mjs.map +1 -0
- package/dist/ui/components/heading.cjs +27 -0
- package/dist/ui/components/heading.cjs.map +1 -0
- package/dist/{types/ui/components/heading.d.ts → ui/components/heading.d.cts} +6 -5
- package/dist/ui/components/heading.d.cts.map +1 -0
- package/dist/ui/components/heading.d.mts +39 -0
- package/dist/ui/components/heading.d.mts.map +1 -0
- package/dist/ui/components/heading.mjs +24 -0
- package/dist/ui/components/heading.mjs.map +1 -0
- package/dist/ui/components/image.cjs +27 -0
- package/dist/ui/components/image.cjs.map +1 -0
- package/dist/{types/ui/components/image.d.ts → ui/components/image.d.cts} +6 -5
- package/dist/ui/components/image.d.cts.map +1 -0
- package/dist/ui/components/image.d.mts +38 -0
- package/dist/ui/components/image.d.mts.map +1 -0
- package/dist/ui/components/image.mjs +24 -0
- package/dist/ui/components/image.mjs.map +1 -0
- package/dist/ui/components/index.cjs +35 -0
- package/dist/ui/components/index.cjs.map +1 -0
- package/dist/ui/components/index.d.cts +15 -0
- package/dist/ui/components/index.d.cts.map +1 -0
- package/dist/ui/components/index.d.mts +15 -0
- package/dist/ui/components/index.d.mts.map +1 -0
- package/dist/ui/components/index.mjs +13 -0
- package/dist/ui/components/index.mjs.map +1 -0
- package/dist/ui/components/input.cjs +60 -0
- package/dist/ui/components/input.cjs.map +1 -0
- package/dist/{types/ui/components/input.d.ts → ui/components/input.d.cts} +9 -8
- package/dist/ui/components/input.d.cts.map +1 -0
- package/dist/ui/components/input.d.mts +78 -0
- package/dist/ui/components/input.d.mts.map +1 -0
- package/dist/ui/components/input.mjs +57 -0
- package/dist/ui/components/input.mjs.map +1 -0
- package/dist/ui/components/panel.cjs +72 -0
- package/dist/ui/components/panel.cjs.map +1 -0
- package/dist/{types/ui/components/panel.d.ts → ui/components/panel.d.cts} +88 -87
- package/dist/ui/components/panel.d.cts.map +1 -0
- package/dist/ui/components/panel.d.mts +406 -0
- package/dist/ui/components/panel.d.mts.map +1 -0
- package/dist/ui/components/panel.mjs +69 -0
- package/dist/ui/components/panel.mjs.map +1 -0
- package/dist/ui/components/row.cjs +51 -0
- package/dist/ui/components/row.cjs.map +1 -0
- package/dist/{types/ui/components/row.d.ts → ui/components/row.d.cts} +21 -20
- package/dist/ui/components/row.d.cts.map +1 -0
- package/dist/ui/components/row.d.mts +107 -0
- package/dist/ui/components/row.d.mts.map +1 -0
- package/dist/ui/components/row.mjs +48 -0
- package/dist/ui/components/row.mjs.map +1 -0
- package/dist/ui/components/spinner.cjs +20 -0
- package/dist/ui/components/spinner.cjs.map +1 -0
- package/dist/{types/ui/components/spinner.d.ts → ui/components/spinner.d.cts} +3 -2
- package/dist/ui/components/spinner.d.cts.map +1 -0
- package/dist/ui/components/spinner.d.mts +25 -0
- package/dist/ui/components/spinner.d.mts.map +1 -0
- package/dist/ui/components/spinner.mjs +17 -0
- package/dist/ui/components/spinner.mjs.map +1 -0
- package/dist/ui/components/text.cjs +34 -0
- package/dist/ui/components/text.cjs.map +1 -0
- package/dist/{types/ui/components/text.d.ts → ui/components/text.d.cts} +6 -5
- package/dist/ui/components/text.d.cts.map +1 -0
- package/dist/ui/components/text.d.mts +49 -0
- package/dist/ui/components/text.d.mts.map +1 -0
- package/dist/ui/components/text.mjs +31 -0
- package/dist/ui/components/text.mjs.map +1 -0
- package/dist/ui/index.cjs +22 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.cts +4 -0
- package/dist/ui/index.d.cts.map +1 -0
- package/dist/ui/index.d.mts +4 -0
- package/dist/ui/index.d.mts.map +1 -0
- package/dist/ui/index.mjs +4 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/nodes.cjs +38 -0
- package/dist/ui/nodes.cjs.map +1 -0
- package/dist/{types/ui/nodes.d.ts → ui/nodes.d.cts} +3 -2
- package/dist/ui/nodes.d.cts.map +1 -0
- package/dist/ui/nodes.d.mts +57 -0
- package/dist/ui/nodes.d.mts.map +1 -0
- package/dist/ui/nodes.mjs +35 -0
- package/dist/ui/nodes.mjs.map +1 -0
- package/jsx-dev-runtime.d.ts +3 -1
- package/jsx-dev-runtime.js +1 -1
- package/jsx-runtime.d.ts +3 -1
- package/jsx-runtime.js +1 -1
- package/jsx.d.ts +3 -1
- package/jsx.js +1 -1
- package/package.json +42 -27
- package/dist/index.js +0 -1142
- package/dist/index.js.map +0 -1
- package/dist/jsx/index.js +0 -587
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.js +0 -416
- package/dist/jsx/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -45
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/internals/index.d.ts +0 -6
- package/dist/types/jsx/components/Address.d.ts +0 -28
- package/dist/types/jsx/components/form/index.d.ts +0 -21
- package/dist/types/jsx/components/formatting/index.d.ts +0 -5
- package/dist/types/jsx/components/index.d.ts +0 -38
- package/dist/types/jsx/index.d.ts +0 -5
- package/dist/types/types/handlers/index.d.ts +0 -9
- package/dist/types/types/index.d.ts +0 -9
- package/dist/types/types/methods/index.d.ts +0 -21
- package/dist/types/ui/components/index.d.ts +0 -14
- package/dist/types/ui/index.d.ts +0 -3
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { is, boolean, optional, array, lazy, nullable, number, object, record, string, tuple, refine } from "@metamask/superstruct";
|
|
2
|
+
import { CaipAccountIdStruct, hasProperty, HexChecksumAddressStruct, isPlainObject, JsonStruct } from "@metamask/utils";
|
|
3
|
+
import { literal, nullUnion, selectiveUnion, svg, typedUnion } from "../internals/index.mjs";
|
|
4
|
+
import { IconName } from "./components/index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* A struct for the {@link Key} type.
|
|
7
|
+
*/
|
|
8
|
+
export const KeyStruct = nullUnion([string(), number()]);
|
|
9
|
+
/**
|
|
10
|
+
* A struct for the {@link StringElement} type.
|
|
11
|
+
*/
|
|
12
|
+
export const StringElementStruct = children([
|
|
13
|
+
string(),
|
|
14
|
+
]);
|
|
15
|
+
/**
|
|
16
|
+
* A struct for the {@link GenericSnapElement} type.
|
|
17
|
+
*/
|
|
18
|
+
export const ElementStruct = object({
|
|
19
|
+
type: string(),
|
|
20
|
+
props: record(string(), JsonStruct),
|
|
21
|
+
key: nullable(KeyStruct),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* A helper function for creating a struct for a {@link Nestable} type.
|
|
25
|
+
*
|
|
26
|
+
* @param struct - The struct for the type to test.
|
|
27
|
+
* @returns The struct for the nestable type.
|
|
28
|
+
*/
|
|
29
|
+
function nestable(struct) {
|
|
30
|
+
const nestableStruct = selectiveUnion((value) => {
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
return array(lazy(() => nestableStruct));
|
|
33
|
+
}
|
|
34
|
+
return struct;
|
|
35
|
+
});
|
|
36
|
+
return nestableStruct;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A helper function for creating a struct which allows children of a specific
|
|
40
|
+
* type, as well as `null` and `boolean`.
|
|
41
|
+
*
|
|
42
|
+
* @param structs - The structs to allow as children.
|
|
43
|
+
* @returns The struct for the children.
|
|
44
|
+
*/
|
|
45
|
+
function children(structs) {
|
|
46
|
+
return nestable(nullable(selectiveUnion((value) => {
|
|
47
|
+
if (typeof value === 'boolean') {
|
|
48
|
+
return boolean();
|
|
49
|
+
}
|
|
50
|
+
if (structs.length === 1) {
|
|
51
|
+
return structs[0];
|
|
52
|
+
}
|
|
53
|
+
return nullUnion(structs);
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A helper function for creating a struct for a JSX element.
|
|
58
|
+
*
|
|
59
|
+
* @param name - The name of the element.
|
|
60
|
+
* @param props - The props of the element.
|
|
61
|
+
* @returns The struct for the element.
|
|
62
|
+
*/
|
|
63
|
+
function element(name, props = {}) {
|
|
64
|
+
return object({
|
|
65
|
+
type: literal(name),
|
|
66
|
+
props: object(props),
|
|
67
|
+
key: nullable(KeyStruct),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A struct for the {@link ImageElement} type.
|
|
72
|
+
*/
|
|
73
|
+
export const ImageStruct = element('Image', {
|
|
74
|
+
src: svg(),
|
|
75
|
+
alt: optional(string()),
|
|
76
|
+
});
|
|
77
|
+
const IconNameStruct = nullUnion(Object.values(IconName).map((name) => literal(name)));
|
|
78
|
+
/**
|
|
79
|
+
* A struct for the {@link IconElement} type.
|
|
80
|
+
*/
|
|
81
|
+
export const IconStruct = element('Icon', {
|
|
82
|
+
name: IconNameStruct,
|
|
83
|
+
color: optional(nullUnion([literal('default'), literal('primary'), literal('muted')])),
|
|
84
|
+
size: optional(nullUnion([literal('md'), literal('inherit')])),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* A struct for the {@link ButtonElement} type.
|
|
88
|
+
*/
|
|
89
|
+
export const ButtonStruct = element('Button', {
|
|
90
|
+
children: children([StringElementStruct, ImageStruct, IconStruct]),
|
|
91
|
+
name: optional(string()),
|
|
92
|
+
type: optional(nullUnion([literal('button'), literal('submit')])),
|
|
93
|
+
variant: optional(nullUnion([literal('primary'), literal('destructive')])),
|
|
94
|
+
disabled: optional(boolean()),
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* A struct for the {@link CheckboxElement} type.
|
|
98
|
+
*/
|
|
99
|
+
export const CheckboxStruct = element('Checkbox', {
|
|
100
|
+
name: string(),
|
|
101
|
+
checked: optional(boolean()),
|
|
102
|
+
label: optional(string()),
|
|
103
|
+
variant: optional(nullUnion([literal('default'), literal('toggle')])),
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* A struct for the {@link InputElement} type.
|
|
107
|
+
*/
|
|
108
|
+
export const InputStruct = element('Input', {
|
|
109
|
+
name: string(),
|
|
110
|
+
type: optional(nullUnion([literal('text'), literal('password'), literal('number')])),
|
|
111
|
+
value: optional(string()),
|
|
112
|
+
placeholder: optional(string()),
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* A struct for the {@link OptionElement} type.
|
|
116
|
+
*/
|
|
117
|
+
export const OptionStruct = element('Option', {
|
|
118
|
+
value: string(),
|
|
119
|
+
children: string(),
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* A struct for the {@link DropdownElement} type.
|
|
123
|
+
*/
|
|
124
|
+
export const DropdownStruct = element('Dropdown', {
|
|
125
|
+
name: string(),
|
|
126
|
+
value: optional(string()),
|
|
127
|
+
children: children([OptionStruct]),
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* A struct for the {@link CardElement} type.
|
|
131
|
+
*/
|
|
132
|
+
export const CardStruct = element('Card', {
|
|
133
|
+
image: optional(string()),
|
|
134
|
+
title: string(),
|
|
135
|
+
description: optional(string()),
|
|
136
|
+
value: string(),
|
|
137
|
+
extra: optional(string()),
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* A struct for the {@link SelectorOptionElement} type.
|
|
141
|
+
*/
|
|
142
|
+
export const SelectorOptionStruct = element('SelectorOption', {
|
|
143
|
+
value: string(),
|
|
144
|
+
children: CardStruct,
|
|
145
|
+
});
|
|
146
|
+
/**
|
|
147
|
+
* A struct for the {@link SelectorElement} type.
|
|
148
|
+
*/
|
|
149
|
+
export const SelectorStruct = element('Selector', {
|
|
150
|
+
name: string(),
|
|
151
|
+
title: string(),
|
|
152
|
+
value: optional(string()),
|
|
153
|
+
children: children([SelectorOptionStruct]),
|
|
154
|
+
});
|
|
155
|
+
/**
|
|
156
|
+
* A struct for the {@link RadioElement} type.
|
|
157
|
+
*/
|
|
158
|
+
export const RadioStruct = element('Radio', {
|
|
159
|
+
value: string(),
|
|
160
|
+
children: string(),
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* A struct for the {@link RadioGroupElement} type.
|
|
164
|
+
*/
|
|
165
|
+
export const RadioGroupStruct = element('RadioGroup', {
|
|
166
|
+
name: string(),
|
|
167
|
+
value: optional(string()),
|
|
168
|
+
children: children([RadioStruct]),
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* A struct for the {@link FileInputElement} type.
|
|
172
|
+
*/
|
|
173
|
+
export const FileInputStruct = element('FileInput', {
|
|
174
|
+
name: string(),
|
|
175
|
+
accept: nullUnion([optional(array(string()))]),
|
|
176
|
+
compact: optional(boolean()),
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* A subset of JSX elements that represent the tuple Box + Input of the Field children.
|
|
180
|
+
*/
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
182
|
+
const BOX_INPUT_LEFT = [lazy(() => BoxChildStruct), InputStruct];
|
|
183
|
+
/**
|
|
184
|
+
* A subset of JSX elements that represent the tuple Input + Box of the Field children.
|
|
185
|
+
*/
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
187
|
+
const BOX_INPUT_RIGHT = [InputStruct, lazy(() => BoxChildStruct)];
|
|
188
|
+
/**
|
|
189
|
+
* A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.
|
|
190
|
+
*/
|
|
191
|
+
const BOX_INPUT_BOTH = [
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
193
|
+
lazy(() => BoxChildStruct),
|
|
194
|
+
InputStruct,
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
196
|
+
lazy(() => BoxChildStruct),
|
|
197
|
+
];
|
|
198
|
+
/**
|
|
199
|
+
* A subset of JSX elements that are allowed as single children of the Field component.
|
|
200
|
+
*/
|
|
201
|
+
const FIELD_CHILDREN_ARRAY = [
|
|
202
|
+
InputStruct,
|
|
203
|
+
DropdownStruct,
|
|
204
|
+
RadioGroupStruct,
|
|
205
|
+
FileInputStruct,
|
|
206
|
+
CheckboxStruct,
|
|
207
|
+
SelectorStruct,
|
|
208
|
+
];
|
|
209
|
+
/**
|
|
210
|
+
* A union of the allowed children of the Field component.
|
|
211
|
+
* This is mainly used in the simulator for validation purposes.
|
|
212
|
+
*/
|
|
213
|
+
export const FieldChildUnionStruct = nullUnion([
|
|
214
|
+
...FIELD_CHILDREN_ARRAY,
|
|
215
|
+
...BOX_INPUT_LEFT,
|
|
216
|
+
...BOX_INPUT_RIGHT,
|
|
217
|
+
...BOX_INPUT_BOTH,
|
|
218
|
+
]);
|
|
219
|
+
/**
|
|
220
|
+
* A subset of JSX elements that are allowed as children of the Field component.
|
|
221
|
+
*/
|
|
222
|
+
const FieldChildStruct = nullUnion([
|
|
223
|
+
tuple(BOX_INPUT_LEFT),
|
|
224
|
+
tuple(BOX_INPUT_RIGHT),
|
|
225
|
+
tuple(BOX_INPUT_BOTH),
|
|
226
|
+
...FIELD_CHILDREN_ARRAY,
|
|
227
|
+
]);
|
|
228
|
+
/**
|
|
229
|
+
* A struct for the {@link FieldElement} type.
|
|
230
|
+
*/
|
|
231
|
+
export const FieldStruct = element('Field', {
|
|
232
|
+
label: optional(string()),
|
|
233
|
+
error: optional(string()),
|
|
234
|
+
children: FieldChildStruct,
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* A subset of JSX elements that are allowed as children of the Form component.
|
|
238
|
+
*/
|
|
239
|
+
export const FormChildStruct = children(
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
241
|
+
[FieldStruct, lazy(() => BoxChildStruct)]);
|
|
242
|
+
/**
|
|
243
|
+
* A struct for the {@link FormElement} type.
|
|
244
|
+
*/
|
|
245
|
+
export const FormStruct = element('Form', {
|
|
246
|
+
children: FormChildStruct,
|
|
247
|
+
name: string(),
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* A struct for the {@link BoldElement} type.
|
|
251
|
+
*/
|
|
252
|
+
export const BoldStruct = element('Bold', {
|
|
253
|
+
children: children([
|
|
254
|
+
string(),
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
256
|
+
lazy(() => ItalicStruct),
|
|
257
|
+
]),
|
|
258
|
+
});
|
|
259
|
+
/**
|
|
260
|
+
* A struct for the {@link ItalicElement} type.
|
|
261
|
+
*/
|
|
262
|
+
export const ItalicStruct = element('Italic', {
|
|
263
|
+
children: children([
|
|
264
|
+
string(),
|
|
265
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
266
|
+
lazy(() => BoldStruct),
|
|
267
|
+
]),
|
|
268
|
+
});
|
|
269
|
+
export const FormattingStruct = typedUnion([BoldStruct, ItalicStruct]);
|
|
270
|
+
/**
|
|
271
|
+
* A struct for the {@link AddressElement} type.
|
|
272
|
+
*/
|
|
273
|
+
export const AddressStruct = element('Address', {
|
|
274
|
+
address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),
|
|
275
|
+
});
|
|
276
|
+
export const BoxChildrenStruct = children(
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
278
|
+
[lazy(() => BoxChildStruct)]);
|
|
279
|
+
/**
|
|
280
|
+
* A struct for the {@link BoxElement} type.
|
|
281
|
+
*/
|
|
282
|
+
export const BoxStruct = element('Box', {
|
|
283
|
+
children: BoxChildrenStruct,
|
|
284
|
+
direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),
|
|
285
|
+
alignment: optional(nullUnion([
|
|
286
|
+
literal('start'),
|
|
287
|
+
literal('center'),
|
|
288
|
+
literal('end'),
|
|
289
|
+
literal('space-between'),
|
|
290
|
+
literal('space-around'),
|
|
291
|
+
])),
|
|
292
|
+
});
|
|
293
|
+
const FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {
|
|
294
|
+
if (typeof value.props.children === 'string' ||
|
|
295
|
+
typeof value.props.children === 'boolean' ||
|
|
296
|
+
value.props.children === null) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
if (Array.isArray(value.props.children)) {
|
|
300
|
+
const hasNonTextElements = value.props.children.some((child) => typeof child !== 'string' &&
|
|
301
|
+
typeof child !== 'boolean' &&
|
|
302
|
+
child !== null);
|
|
303
|
+
if (!hasNonTextElements) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return 'Footer buttons may only contain text.';
|
|
308
|
+
});
|
|
309
|
+
/**
|
|
310
|
+
* A struct for the {@link SectionElement} type.
|
|
311
|
+
*/
|
|
312
|
+
export const SectionStruct = element('Section', {
|
|
313
|
+
children: BoxChildrenStruct,
|
|
314
|
+
direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),
|
|
315
|
+
alignment: optional(nullUnion([
|
|
316
|
+
literal('start'),
|
|
317
|
+
literal('center'),
|
|
318
|
+
literal('end'),
|
|
319
|
+
literal('space-between'),
|
|
320
|
+
literal('space-around'),
|
|
321
|
+
])),
|
|
322
|
+
});
|
|
323
|
+
/**
|
|
324
|
+
* A subset of JSX elements that are allowed as children of the Footer component.
|
|
325
|
+
* This set should include a single button or a tuple of two buttons.
|
|
326
|
+
*/
|
|
327
|
+
export const FooterChildStruct = selectiveUnion((value) => {
|
|
328
|
+
if (Array.isArray(value)) {
|
|
329
|
+
return tuple([FooterButtonStruct, FooterButtonStruct]);
|
|
330
|
+
}
|
|
331
|
+
return FooterButtonStruct;
|
|
332
|
+
});
|
|
333
|
+
/**
|
|
334
|
+
* A struct for the {@link FooterElement} type.
|
|
335
|
+
*/
|
|
336
|
+
export const FooterStruct = element('Footer', {
|
|
337
|
+
children: FooterChildStruct,
|
|
338
|
+
});
|
|
339
|
+
/**
|
|
340
|
+
* A struct for the {@link CopyableElement} type.
|
|
341
|
+
*/
|
|
342
|
+
export const CopyableStruct = element('Copyable', {
|
|
343
|
+
value: string(),
|
|
344
|
+
sensitive: optional(boolean()),
|
|
345
|
+
});
|
|
346
|
+
/**
|
|
347
|
+
* A struct for the {@link DividerElement} type.
|
|
348
|
+
*/
|
|
349
|
+
export const DividerStruct = element('Divider');
|
|
350
|
+
/**
|
|
351
|
+
* A struct for the {@link ValueElement} type.
|
|
352
|
+
*/
|
|
353
|
+
export const ValueStruct = element('Value', {
|
|
354
|
+
value: string(),
|
|
355
|
+
extra: string(),
|
|
356
|
+
});
|
|
357
|
+
/**
|
|
358
|
+
* A struct for the {@link HeadingElement} type.
|
|
359
|
+
*/
|
|
360
|
+
export const HeadingStruct = element('Heading', {
|
|
361
|
+
children: StringElementStruct,
|
|
362
|
+
});
|
|
363
|
+
/**
|
|
364
|
+
* A struct for the {@link LinkElement} type.
|
|
365
|
+
*/
|
|
366
|
+
export const LinkStruct = element('Link', {
|
|
367
|
+
href: string(),
|
|
368
|
+
children: children([FormattingStruct, string()]),
|
|
369
|
+
});
|
|
370
|
+
/**
|
|
371
|
+
* A struct for the {@link TextElement} type.
|
|
372
|
+
*/
|
|
373
|
+
export const TextStruct = element('Text', {
|
|
374
|
+
children: children([
|
|
375
|
+
selectiveUnion((value) => {
|
|
376
|
+
if (typeof value === 'string') {
|
|
377
|
+
return string();
|
|
378
|
+
}
|
|
379
|
+
return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);
|
|
380
|
+
}),
|
|
381
|
+
]),
|
|
382
|
+
alignment: optional(nullUnion([literal('start'), literal('center'), literal('end')])),
|
|
383
|
+
color: optional(nullUnion([
|
|
384
|
+
literal('default'),
|
|
385
|
+
literal('alternative'),
|
|
386
|
+
literal('muted'),
|
|
387
|
+
literal('error'),
|
|
388
|
+
literal('success'),
|
|
389
|
+
literal('warning'),
|
|
390
|
+
])),
|
|
391
|
+
});
|
|
392
|
+
/**
|
|
393
|
+
* A subset of JSX elements that are allowed as children of the Tooltip component.
|
|
394
|
+
* This set should include all text components and the Image.
|
|
395
|
+
*/
|
|
396
|
+
export const TooltipChildStruct = selectiveUnion((value) => {
|
|
397
|
+
if (typeof value === 'boolean') {
|
|
398
|
+
return boolean();
|
|
399
|
+
}
|
|
400
|
+
return typedUnion([
|
|
401
|
+
TextStruct,
|
|
402
|
+
BoldStruct,
|
|
403
|
+
ItalicStruct,
|
|
404
|
+
LinkStruct,
|
|
405
|
+
ImageStruct,
|
|
406
|
+
IconStruct,
|
|
407
|
+
]);
|
|
408
|
+
});
|
|
409
|
+
/**
|
|
410
|
+
* A subset of JSX elements that are allowed as content of the Tooltip component.
|
|
411
|
+
* This set should include all text components.
|
|
412
|
+
*/
|
|
413
|
+
export const TooltipContentStruct = selectiveUnion((value) => {
|
|
414
|
+
if (typeof value === 'string') {
|
|
415
|
+
return string();
|
|
416
|
+
}
|
|
417
|
+
return typedUnion([
|
|
418
|
+
TextStruct,
|
|
419
|
+
BoldStruct,
|
|
420
|
+
ItalicStruct,
|
|
421
|
+
LinkStruct,
|
|
422
|
+
IconStruct,
|
|
423
|
+
]);
|
|
424
|
+
});
|
|
425
|
+
/**
|
|
426
|
+
* A struct for the {@link TooltipElement} type.
|
|
427
|
+
*/
|
|
428
|
+
export const TooltipStruct = element('Tooltip', {
|
|
429
|
+
children: nullable(TooltipChildStruct),
|
|
430
|
+
content: TooltipContentStruct,
|
|
431
|
+
});
|
|
432
|
+
/**
|
|
433
|
+
* A struct for the {@link RowElement} type.
|
|
434
|
+
*/
|
|
435
|
+
export const RowStruct = element('Row', {
|
|
436
|
+
label: string(),
|
|
437
|
+
children: typedUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),
|
|
438
|
+
variant: optional(nullUnion([literal('default'), literal('warning'), literal('critical')])),
|
|
439
|
+
tooltip: optional(string()),
|
|
440
|
+
});
|
|
441
|
+
/**
|
|
442
|
+
* A struct for the {@link SpinnerElement} type.
|
|
443
|
+
*/
|
|
444
|
+
export const SpinnerStruct = element('Spinner');
|
|
445
|
+
/**
|
|
446
|
+
* A subset of JSX elements that are allowed as children of the Box component.
|
|
447
|
+
* This set includes all components, except components that need to be nested in
|
|
448
|
+
* another component (e.g., Field must be contained in a Form).
|
|
449
|
+
*/
|
|
450
|
+
export const BoxChildStruct = typedUnion([
|
|
451
|
+
AddressStruct,
|
|
452
|
+
BoldStruct,
|
|
453
|
+
BoxStruct,
|
|
454
|
+
ButtonStruct,
|
|
455
|
+
CopyableStruct,
|
|
456
|
+
DividerStruct,
|
|
457
|
+
DropdownStruct,
|
|
458
|
+
RadioGroupStruct,
|
|
459
|
+
FileInputStruct,
|
|
460
|
+
FormStruct,
|
|
461
|
+
HeadingStruct,
|
|
462
|
+
InputStruct,
|
|
463
|
+
ImageStruct,
|
|
464
|
+
ItalicStruct,
|
|
465
|
+
LinkStruct,
|
|
466
|
+
RowStruct,
|
|
467
|
+
SpinnerStruct,
|
|
468
|
+
TextStruct,
|
|
469
|
+
TooltipStruct,
|
|
470
|
+
CheckboxStruct,
|
|
471
|
+
CardStruct,
|
|
472
|
+
IconStruct,
|
|
473
|
+
SelectorStruct,
|
|
474
|
+
SectionStruct,
|
|
475
|
+
]);
|
|
476
|
+
/**
|
|
477
|
+
* A struct for the {@link ContainerElement} type.
|
|
478
|
+
*/
|
|
479
|
+
export const ContainerStruct = element('Container', {
|
|
480
|
+
children: selectiveUnion((value) => {
|
|
481
|
+
if (Array.isArray(value)) {
|
|
482
|
+
return tuple([BoxChildStruct, FooterStruct]);
|
|
483
|
+
}
|
|
484
|
+
return BoxChildStruct;
|
|
485
|
+
}),
|
|
486
|
+
});
|
|
487
|
+
/**
|
|
488
|
+
* For now, the allowed JSX elements at the root are the same as the allowed
|
|
489
|
+
* children of the Box component.
|
|
490
|
+
*/
|
|
491
|
+
export const RootJSXElementStruct = typedUnion([
|
|
492
|
+
BoxChildStruct,
|
|
493
|
+
ContainerStruct,
|
|
494
|
+
]);
|
|
495
|
+
/**
|
|
496
|
+
* A struct for the {@link JSXElement} type.
|
|
497
|
+
*/
|
|
498
|
+
export const JSXElementStruct = typedUnion([
|
|
499
|
+
ButtonStruct,
|
|
500
|
+
InputStruct,
|
|
501
|
+
FileInputStruct,
|
|
502
|
+
FieldStruct,
|
|
503
|
+
FormStruct,
|
|
504
|
+
BoldStruct,
|
|
505
|
+
ItalicStruct,
|
|
506
|
+
AddressStruct,
|
|
507
|
+
BoxStruct,
|
|
508
|
+
CopyableStruct,
|
|
509
|
+
DividerStruct,
|
|
510
|
+
HeadingStruct,
|
|
511
|
+
ImageStruct,
|
|
512
|
+
LinkStruct,
|
|
513
|
+
RowStruct,
|
|
514
|
+
SpinnerStruct,
|
|
515
|
+
TextStruct,
|
|
516
|
+
DropdownStruct,
|
|
517
|
+
OptionStruct,
|
|
518
|
+
RadioGroupStruct,
|
|
519
|
+
RadioStruct,
|
|
520
|
+
ValueStruct,
|
|
521
|
+
TooltipStruct,
|
|
522
|
+
CheckboxStruct,
|
|
523
|
+
FooterStruct,
|
|
524
|
+
ContainerStruct,
|
|
525
|
+
CardStruct,
|
|
526
|
+
IconStruct,
|
|
527
|
+
SelectorStruct,
|
|
528
|
+
SelectorOptionStruct,
|
|
529
|
+
SectionStruct,
|
|
530
|
+
]);
|
|
531
|
+
/**
|
|
532
|
+
* Check if a value is a JSX element.
|
|
533
|
+
*
|
|
534
|
+
* @param value - The value to check.
|
|
535
|
+
* @returns True if the value is a JSX element, false otherwise.
|
|
536
|
+
*/
|
|
537
|
+
export function isJSXElement(value) {
|
|
538
|
+
return is(value, JSXElementStruct);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Check if a value is a JSX element, without validating all of its contents.
|
|
542
|
+
* This is useful when you want to validate the structure of a value, but not
|
|
543
|
+
* all the children.
|
|
544
|
+
*
|
|
545
|
+
* This should only be used when you are sure that the value is safe to use,
|
|
546
|
+
* i.e., after using {@link isJSXElement}.
|
|
547
|
+
*
|
|
548
|
+
* @param value - The value to check.
|
|
549
|
+
* @returns True if the value is a JSX element, false otherwise.
|
|
550
|
+
*/
|
|
551
|
+
export function isJSXElementUnsafe(value) {
|
|
552
|
+
return (isPlainObject(value) &&
|
|
553
|
+
hasProperty(value, 'type') &&
|
|
554
|
+
hasProperty(value, 'props') &&
|
|
555
|
+
hasProperty(value, 'key'));
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Assert that a value is a JSX element.
|
|
559
|
+
*
|
|
560
|
+
* @param value - The value to check.
|
|
561
|
+
* @throws If the value is not a JSX element.
|
|
562
|
+
*/
|
|
563
|
+
export function assertJSXElement(value) {
|
|
564
|
+
// TODO: We should use the error parsing utils from `snaps-utils` to improve
|
|
565
|
+
// the error messages. It currently includes colours and potentially other
|
|
566
|
+
// formatting that we might not want to include in the SDK.
|
|
567
|
+
if (!isJSXElement(value)) {
|
|
568
|
+
throw new Error(`Expected a JSX element, but received ${JSON.stringify(value)}. Please refer to the documentation for the supported JSX elements and their props.`);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
//# sourceMappingURL=validation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.mjs","sourceRoot":"","sources":["../../src/jsx/validation.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,EAAE,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACP,8BAA8B;AAC/B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,wBAAwB,EACxB,aAAa,EACb,UAAU,EACX,wBAAwB;AAGzB,OAAO,EACL,OAAO,EACP,SAAS,EACT,cAAc,EACd,GAAG,EACH,UAAU,EACX,+BAAqB;AAWtB,OAAO,EAkCL,QAAQ,EACT,+BAAqB;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B,QAAQ,CAAC;IACnE,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,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,4EAA4E;IAC5E,0EAA0E;IAC1E,2DAA2D;IAC3D,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CACpD,KAAK,CACN,qFAAqF,CACvF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type {\n AnyStruct,\n Infer,\n InferStructTuple,\n ObjectSchema,\n Struct,\n} from '@metamask/superstruct';\nimport {\n is,\n boolean,\n optional,\n array,\n lazy,\n nullable,\n number,\n object,\n record,\n string,\n tuple,\n refine,\n} from '@metamask/superstruct';\nimport {\n CaipAccountIdStruct,\n hasProperty,\n HexChecksumAddressStruct,\n isPlainObject,\n JsonStruct,\n} from '@metamask/utils';\n\nimport type { Describe } from '../internals';\nimport {\n literal,\n nullUnion,\n selectiveUnion,\n svg,\n typedUnion,\n} from '../internals';\nimport type { EmptyObject } from '../types';\nimport type {\n GenericSnapElement,\n JsonObject,\n Key,\n Nestable,\n SnapElement,\n SnapsChildren,\n StringElement,\n} from './component';\nimport {\n type AddressElement,\n type BoldElement,\n type BoxElement,\n type ButtonElement,\n type CheckboxElement,\n type CardElement,\n type CopyableElement,\n type DividerElement,\n type DropdownElement,\n type OptionElement,\n type RadioElement,\n type RadioGroupElement,\n type FieldElement,\n type FormElement,\n type HeadingElement,\n type ImageElement,\n type InputElement,\n type ItalicElement,\n type JSXElement,\n type LinkElement,\n type RowElement,\n type SpinnerElement,\n type StandardFormattingElement,\n type TextElement,\n type TooltipElement,\n type ValueElement,\n type FileInputElement,\n type ContainerElement,\n type FooterElement,\n type IconElement,\n type SectionElement,\n type SelectorElement,\n type SelectorOptionElement,\n IconName,\n} from './components';\n\n/**\n * A struct for the {@link Key} type.\n */\nexport const KeyStruct: Describe<Key> = nullUnion([string(), number()]);\n\n/**\n * A struct for the {@link StringElement} type.\n */\nexport const StringElementStruct: Describe<StringElement> = children([\n string(),\n]);\n\n/**\n * A struct for the {@link GenericSnapElement} type.\n */\nexport const ElementStruct: Describe<GenericSnapElement> = object({\n type: string(),\n props: record(string(), JsonStruct),\n key: nullable(KeyStruct),\n});\n\n/**\n * A helper function for creating a struct for a {@link Nestable} type.\n *\n * @param struct - The struct for the type to test.\n * @returns The struct for the nestable type.\n */\nfunction nestable<Type, Schema>(\n struct: Struct<Type, Schema>,\n): Struct<Nestable<Type>, any> {\n const nestableStruct: Struct<Nestable<Type>> = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return array(lazy(() => nestableStruct));\n }\n return struct;\n });\n\n return nestableStruct;\n}\n\n/**\n * A helper function for creating a struct which allows children of a specific\n * type, as well as `null` and `boolean`.\n *\n * @param structs - The structs to allow as children.\n * @returns The struct for the children.\n */\nfunction children<Head extends AnyStruct, Tail extends AnyStruct[]>(\n structs: [head: Head, ...tail: Tail],\n): Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n> {\n return nestable(\n nullable(\n selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n if (structs.length === 1) {\n return structs[0];\n }\n return nullUnion(structs);\n }),\n ),\n ) as unknown as Struct<\n Nestable<Infer<Head> | InferStructTuple<Tail>[number] | boolean | null>,\n null\n >;\n}\n\n/**\n * A helper function for creating a struct for a JSX element.\n *\n * @param name - The name of the element.\n * @param props - The props of the element.\n * @returns The struct for the element.\n */\nfunction element<Name extends string, Props extends ObjectSchema = EmptyObject>(\n name: Name,\n props: Props = {} as Props,\n) {\n return object({\n type: literal(name) as unknown as Struct<Name, Name>,\n props: object(props),\n key: nullable(KeyStruct),\n });\n}\n\n/**\n * A struct for the {@link ImageElement} type.\n */\nexport const ImageStruct: Describe<ImageElement> = element('Image', {\n src: svg(),\n alt: optional(string()),\n});\n\nconst IconNameStruct: Struct<`${IconName}`, null> = nullUnion(\n Object.values(IconName).map((name) => literal(name)) as any,\n);\n\n/**\n * A struct for the {@link IconElement} type.\n */\nexport const IconStruct: Describe<IconElement> = element('Icon', {\n name: IconNameStruct,\n color: optional(\n nullUnion([literal('default'), literal('primary'), literal('muted')]),\n ),\n size: optional(nullUnion([literal('md'), literal('inherit')])),\n});\n\n/**\n * A struct for the {@link ButtonElement} type.\n */\nexport const ButtonStruct: Describe<ButtonElement> = element('Button', {\n children: children([StringElementStruct, ImageStruct, IconStruct]),\n name: optional(string()),\n type: optional(nullUnion([literal('button'), literal('submit')])),\n variant: optional(nullUnion([literal('primary'), literal('destructive')])),\n disabled: optional(boolean()),\n});\n\n/**\n * A struct for the {@link CheckboxElement} type.\n */\nexport const CheckboxStruct: Describe<CheckboxElement> = element('Checkbox', {\n name: string(),\n checked: optional(boolean()),\n label: optional(string()),\n variant: optional(nullUnion([literal('default'), literal('toggle')])),\n});\n\n/**\n * A struct for the {@link InputElement} type.\n */\nexport const InputStruct: Describe<InputElement> = element('Input', {\n name: string(),\n type: optional(\n nullUnion([literal('text'), literal('password'), literal('number')]),\n ),\n value: optional(string()),\n placeholder: optional(string()),\n});\n\n/**\n * A struct for the {@link OptionElement} type.\n */\nexport const OptionStruct: Describe<OptionElement> = element('Option', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link DropdownElement} type.\n */\nexport const DropdownStruct: Describe<DropdownElement> = element('Dropdown', {\n name: string(),\n value: optional(string()),\n children: children([OptionStruct]),\n});\n\n/**\n * A struct for the {@link CardElement} type.\n */\nexport const CardStruct: Describe<CardElement> = element('Card', {\n image: optional(string()),\n title: string(),\n description: optional(string()),\n value: string(),\n extra: optional(string()),\n});\n\n/**\n * A struct for the {@link SelectorOptionElement} type.\n */\nexport const SelectorOptionStruct: Describe<SelectorOptionElement> = element(\n 'SelectorOption',\n {\n value: string(),\n children: CardStruct,\n },\n);\n\n/**\n * A struct for the {@link SelectorElement} type.\n */\nexport const SelectorStruct: Describe<SelectorElement> = element('Selector', {\n name: string(),\n title: string(),\n value: optional(string()),\n children: children([SelectorOptionStruct]),\n});\n\n/**\n * A struct for the {@link RadioElement} type.\n */\nexport const RadioStruct: Describe<RadioElement> = element('Radio', {\n value: string(),\n children: string(),\n});\n\n/**\n * A struct for the {@link RadioGroupElement} type.\n */\nexport const RadioGroupStruct: Describe<RadioGroupElement> = element(\n 'RadioGroup',\n {\n name: string(),\n value: optional(string()),\n children: children([RadioStruct]),\n },\n);\n\n/**\n * A struct for the {@link FileInputElement} type.\n */\nexport const FileInputStruct: Describe<FileInputElement> = element(\n 'FileInput',\n {\n name: string(),\n accept: nullUnion([optional(array(string()))]),\n compact: optional(boolean()),\n },\n);\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input of the Field children.\n */\n// eslint-disable-next-line @typescript-eslint/no-use-before-define\nconst BOX_INPUT_LEFT = [lazy(() => BoxChildStruct), InputStruct] as [\n typeof BoxChildStruct,\n typeof InputStruct,\n];\n\n/**\n * A subset of JSX elements that represent the tuple Input + Box of the Field children.\n */\n// eslint-disable-next-line @typescript-eslint/no-use-before-define\nconst BOX_INPUT_RIGHT = [InputStruct, lazy(() => BoxChildStruct)] as [\n typeof InputStruct,\n typeof BoxChildStruct,\n];\n\n/**\n * A subset of JSX elements that represent the tuple Box + Input + Box of the Field children.\n */\nconst BOX_INPUT_BOTH = [\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoxChildStruct),\n InputStruct,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoxChildStruct),\n] as [typeof BoxChildStruct, typeof InputStruct, typeof BoxChildStruct];\n\n/**\n * A subset of JSX elements that are allowed as single children of the Field component.\n */\nconst FIELD_CHILDREN_ARRAY = [\n InputStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n CheckboxStruct,\n SelectorStruct,\n] as [\n typeof InputStruct,\n typeof DropdownStruct,\n typeof RadioGroupStruct,\n typeof FileInputStruct,\n typeof CheckboxStruct,\n typeof SelectorStruct,\n];\n\n/**\n * A union of the allowed children of the Field component.\n * This is mainly used in the simulator for validation purposes.\n */\nexport const FieldChildUnionStruct = nullUnion([\n ...FIELD_CHILDREN_ARRAY,\n ...BOX_INPUT_LEFT,\n ...BOX_INPUT_RIGHT,\n ...BOX_INPUT_BOTH,\n]);\n\n/**\n * A subset of JSX elements that are allowed as children of the Field component.\n */\nconst FieldChildStruct = nullUnion([\n tuple(BOX_INPUT_LEFT),\n tuple(BOX_INPUT_RIGHT),\n tuple(BOX_INPUT_BOTH),\n ...FIELD_CHILDREN_ARRAY,\n]) as unknown as Struct<\n | [InputElement, GenericSnapElement]\n | [GenericSnapElement, InputElement]\n | [GenericSnapElement, InputElement, GenericSnapElement]\n | DropdownElement\n | RadioGroupElement\n | FileInputElement\n | InputElement\n | CheckboxElement\n | SelectorElement,\n null\n>;\n\n/**\n * A struct for the {@link FieldElement} type.\n */\nexport const FieldStruct: Describe<FieldElement> = element('Field', {\n label: optional(string()),\n error: optional(string()),\n children: FieldChildStruct,\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Form component.\n */\nexport const FormChildStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [FieldStruct, lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link FormElement} type.\n */\nexport const FormStruct: Describe<FormElement> = element('Form', {\n children: FormChildStruct,\n name: string(),\n});\n\n/**\n * A struct for the {@link BoldElement} type.\n */\nexport const BoldStruct: Describe<BoldElement> = element('Bold', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => ItalicStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Italic'>\n >,\n ]),\n});\n\n/**\n * A struct for the {@link ItalicElement} type.\n */\nexport const ItalicStruct: Describe<ItalicElement> = element('Italic', {\n children: children([\n string(),\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n lazy(() => BoldStruct) as unknown as Struct<\n SnapElement<JsonObject, 'Bold'>\n >,\n ]),\n});\n\nexport const FormattingStruct: Describe<StandardFormattingElement> = typedUnion(\n [BoldStruct, ItalicStruct],\n);\n\n/**\n * A struct for the {@link AddressElement} type.\n */\nexport const AddressStruct: Describe<AddressElement> = element('Address', {\n address: nullUnion([HexChecksumAddressStruct, CaipAccountIdStruct]),\n});\n\nexport const BoxChildrenStruct = children(\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n [lazy(() => BoxChildStruct)],\n) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;\n\n/**\n * A struct for the {@link BoxElement} type.\n */\nexport const BoxStruct: Describe<BoxElement> = element('Box', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\nconst FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {\n if (\n typeof value.props.children === 'string' ||\n typeof value.props.children === 'boolean' ||\n value.props.children === null\n ) {\n return true;\n }\n\n if (Array.isArray(value.props.children)) {\n const hasNonTextElements = value.props.children.some(\n (child) =>\n typeof child !== 'string' &&\n typeof child !== 'boolean' &&\n child !== null,\n );\n\n if (!hasNonTextElements) {\n return true;\n }\n }\n\n return 'Footer buttons may only contain text.';\n});\n\n/**\n * A struct for the {@link SectionElement} type.\n */\nexport const SectionStruct: Describe<SectionElement> = element('Section', {\n children: BoxChildrenStruct,\n direction: optional(nullUnion([literal('horizontal'), literal('vertical')])),\n alignment: optional(\n nullUnion([\n literal('start'),\n literal('center'),\n literal('end'),\n literal('space-between'),\n literal('space-around'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Footer component.\n * This set should include a single button or a tuple of two buttons.\n */\n\nexport const FooterChildStruct = selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([FooterButtonStruct, FooterButtonStruct]);\n }\n return FooterButtonStruct;\n});\n\n/**\n * A struct for the {@link FooterElement} type.\n */\nexport const FooterStruct: Describe<FooterElement> = element('Footer', {\n children: FooterChildStruct,\n});\n\n/**\n * A struct for the {@link CopyableElement} type.\n */\nexport const CopyableStruct: Describe<CopyableElement> = element('Copyable', {\n value: string(),\n sensitive: optional(boolean()),\n});\n\n/**\n * A struct for the {@link DividerElement} type.\n */\nexport const DividerStruct: Describe<DividerElement> = element('Divider');\n\n/**\n * A struct for the {@link ValueElement} type.\n */\nexport const ValueStruct: Describe<ValueElement> = element('Value', {\n value: string(),\n extra: string(),\n});\n\n/**\n * A struct for the {@link HeadingElement} type.\n */\nexport const HeadingStruct: Describe<HeadingElement> = element('Heading', {\n children: StringElementStruct,\n});\n\n/**\n * A struct for the {@link LinkElement} type.\n */\nexport const LinkStruct: Describe<LinkElement> = element('Link', {\n href: string(),\n children: children([FormattingStruct, string()]),\n});\n\n/**\n * A struct for the {@link TextElement} type.\n */\nexport const TextStruct: Describe<TextElement> = element('Text', {\n children: children([\n selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([BoldStruct, ItalicStruct, LinkStruct, IconStruct]);\n }),\n ]),\n alignment: optional(\n nullUnion([literal('start'), literal('center'), literal('end')]),\n ),\n color: optional(\n nullUnion([\n literal('default'),\n literal('alternative'),\n literal('muted'),\n literal('error'),\n literal('success'),\n literal('warning'),\n ]),\n ),\n});\n\n/**\n * A subset of JSX elements that are allowed as children of the Tooltip component.\n * This set should include all text components and the Image.\n */\nexport const TooltipChildStruct = selectiveUnion((value) => {\n if (typeof value === 'boolean') {\n return boolean();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n ImageStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A subset of JSX elements that are allowed as content of the Tooltip component.\n * This set should include all text components.\n */\nexport const TooltipContentStruct = selectiveUnion((value) => {\n if (typeof value === 'string') {\n return string();\n }\n return typedUnion([\n TextStruct,\n BoldStruct,\n ItalicStruct,\n LinkStruct,\n IconStruct,\n ]);\n});\n\n/**\n * A struct for the {@link TooltipElement} type.\n */\nexport const TooltipStruct: Describe<TooltipElement> = element('Tooltip', {\n children: nullable(TooltipChildStruct),\n content: TooltipContentStruct,\n});\n\n/**\n * A struct for the {@link RowElement} type.\n */\nexport const RowStruct: Describe<RowElement> = element('Row', {\n label: string(),\n children: typedUnion([AddressStruct, ImageStruct, TextStruct, ValueStruct]),\n variant: optional(\n nullUnion([literal('default'), literal('warning'), literal('critical')]),\n ),\n tooltip: optional(string()),\n});\n\n/**\n * A struct for the {@link SpinnerElement} type.\n */\nexport const SpinnerStruct: Describe<SpinnerElement> = element('Spinner');\n\n/**\n * A subset of JSX elements that are allowed as children of the Box component.\n * This set includes all components, except components that need to be nested in\n * another component (e.g., Field must be contained in a Form).\n */\nexport const BoxChildStruct = typedUnion([\n AddressStruct,\n BoldStruct,\n BoxStruct,\n ButtonStruct,\n CopyableStruct,\n DividerStruct,\n DropdownStruct,\n RadioGroupStruct,\n FileInputStruct,\n FormStruct,\n HeadingStruct,\n InputStruct,\n ImageStruct,\n ItalicStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n TooltipStruct,\n CheckboxStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SectionStruct,\n]);\n\n/**\n * A struct for the {@link ContainerElement} type.\n */\nexport const ContainerStruct: Describe<ContainerElement> = element(\n 'Container',\n {\n children: selectiveUnion((value) => {\n if (Array.isArray(value)) {\n return tuple([BoxChildStruct, FooterStruct]);\n }\n return BoxChildStruct;\n }) as unknown as Struct<\n [GenericSnapElement, FooterElement] | GenericSnapElement,\n null\n >,\n },\n);\n\n/**\n * For now, the allowed JSX elements at the root are the same as the allowed\n * children of the Box component.\n */\nexport const RootJSXElementStruct = typedUnion([\n BoxChildStruct,\n ContainerStruct,\n]);\n\n/**\n * A struct for the {@link JSXElement} type.\n */\nexport const JSXElementStruct: Describe<JSXElement> = typedUnion([\n ButtonStruct,\n InputStruct,\n FileInputStruct,\n FieldStruct,\n FormStruct,\n BoldStruct,\n ItalicStruct,\n AddressStruct,\n BoxStruct,\n CopyableStruct,\n DividerStruct,\n HeadingStruct,\n ImageStruct,\n LinkStruct,\n RowStruct,\n SpinnerStruct,\n TextStruct,\n DropdownStruct,\n OptionStruct,\n RadioGroupStruct,\n RadioStruct,\n ValueStruct,\n TooltipStruct,\n CheckboxStruct,\n FooterStruct,\n ContainerStruct,\n CardStruct,\n IconStruct,\n SelectorStruct,\n SelectorOptionStruct,\n SectionStruct,\n]);\n\n/**\n * Check if a value is a JSX element.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElement(value: unknown): value is JSXElement {\n return is(value, JSXElementStruct);\n}\n\n/**\n * Check if a value is a JSX element, without validating all of its contents.\n * This is useful when you want to validate the structure of a value, but not\n * all the children.\n *\n * This should only be used when you are sure that the value is safe to use,\n * i.e., after using {@link isJSXElement}.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSX element, false otherwise.\n */\nexport function isJSXElementUnsafe(value: unknown): value is JSXElement {\n return (\n isPlainObject(value) &&\n hasProperty(value, 'type') &&\n hasProperty(value, 'props') &&\n hasProperty(value, 'key')\n );\n}\n\n/**\n * Assert that a value is a JSX element.\n *\n * @param value - The value to check.\n * @throws If the value is not a JSX element.\n */\nexport function assertJSXElement(value: unknown): asserts value is JSXElement {\n // TODO: We should use the error parsing utils from `snaps-utils` to improve\n // the error messages. It currently includes colours and potentially other\n // formatting that we might not want to include in the SDK.\n if (!isJSXElement(value)) {\n throw new Error(\n `Expected a JSX element, but received ${JSON.stringify(\n value,\n )}. Please refer to the documentation for the supported JSX elements and their props.`,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.cjs","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A CAIP-2 chain ID, i.e., a human-readable namespace and reference.\n *\n * @see https://chainagnostic.org/CAIPs/caip-2\n */\nexport type ChainId = `${string}:${string}`;\n\n/**\n * A CAIP-10 account ID, i.e., a chain ID and an account address.\n *\n * @see https://chainagnostic.org/CAIPs/caip-10\n */\nexport type AccountId = `${ChainId}:${string}`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.d.cts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A CAIP-2 chain ID, i.e., a human-readable namespace and reference.
|
|
3
|
+
*
|
|
4
|
+
* @see https://chainagnostic.org/CAIPs/caip-2
|
|
5
|
+
*/
|
|
6
|
+
export type ChainId = `${string}:${string}`;
|
|
7
|
+
/**
|
|
8
|
+
* A CAIP-10 account ID, i.e., a chain ID and an account address.
|
|
9
|
+
*
|
|
10
|
+
* @see https://chainagnostic.org/CAIPs/caip-10
|
|
11
|
+
*/
|
|
12
|
+
export type AccountId = `${ChainId}:${string}`;
|
|
13
|
+
//# sourceMappingURL=caip.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caip.d.mts","sourceRoot":"","sources":["../../src/types/caip.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAE5C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC"}
|