mjml-blocks 4.12.0 → 4.13.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 (64) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +23 -21
  3. package/dist/index.js +23 -21
  4. package/dist/models/MjmlBlockTypeDefinition.d.ts +1 -1
  5. package/dist/models/MjmlRootProps.d.ts +2 -2
  6. package/dist/services/MjmlContentKindSchemaMap.d.ts +1 -1
  7. package/dist/services/components/createMjmlAccordionTextPropsSchema.d.ts +1 -1
  8. package/dist/services/components/createMjmlTextPropsSchema.d.ts +1 -1
  9. package/dist/services/components/mjAccordion.d.ts +1 -1
  10. package/dist/services/components/mjAccordion.js +2 -1
  11. package/dist/services/components/mjAccordionElement.d.ts +3 -2
  12. package/dist/services/components/mjAccordionElement.js +1 -1
  13. package/dist/services/components/mjAccordionTitle.d.ts +1 -1
  14. package/dist/services/components/mjAccordionTitle.js +2 -1
  15. package/dist/services/components/mjButton.d.ts +1 -1
  16. package/dist/services/components/mjButton.js +2 -1
  17. package/dist/services/components/mjCarousel.d.ts +1 -1
  18. package/dist/services/components/mjCarousel.js +2 -1
  19. package/dist/services/components/mjCarouselImage.d.ts +3 -2
  20. package/dist/services/components/mjCarouselImage.js +1 -1
  21. package/dist/services/components/mjColumn.d.ts +1 -1
  22. package/dist/services/components/mjColumn.js +2 -1
  23. package/dist/services/components/mjDivider.d.ts +1 -1
  24. package/dist/services/components/mjDivider.js +2 -1
  25. package/dist/services/components/mjGroup.d.ts +3 -2
  26. package/dist/services/components/mjGroup.js +1 -1
  27. package/dist/services/components/mjHero.d.ts +1 -1
  28. package/dist/services/components/mjHero.js +2 -1
  29. package/dist/services/components/mjImage.d.ts +1 -1
  30. package/dist/services/components/mjImage.js +2 -1
  31. package/dist/services/components/mjNavbar.d.ts +1 -1
  32. package/dist/services/components/mjNavbar.js +2 -1
  33. package/dist/services/components/mjNavbarLink.d.ts +1 -1
  34. package/dist/services/components/mjNavbarLink.js +2 -1
  35. package/dist/services/components/mjRaw.d.ts +3 -2
  36. package/dist/services/components/mjRaw.js +1 -1
  37. package/dist/services/components/mjSocial.d.ts +1 -1
  38. package/dist/services/components/mjSocial.js +2 -1
  39. package/dist/services/components/mjSocialElement.d.ts +1 -1
  40. package/dist/services/components/mjSocialElement.js +2 -1
  41. package/dist/services/components/mjSpacer.d.ts +1 -1
  42. package/dist/services/components/mjSpacer.js +2 -1
  43. package/dist/services/components/mjTable.d.ts +1 -1
  44. package/dist/services/components/mjTable.js +2 -1
  45. package/dist/services/components/mjWrapper.d.ts +0 -5
  46. package/dist/services/components/mjWrapper.js +1 -1
  47. package/dist/services/constants.d.ts +1 -1
  48. package/dist/services/constants.js +2 -6
  49. package/dist/services/createMjmlDocumentSchema.d.ts +1 -1
  50. package/dist/services/createMjmlRootPropsSchema.js +2 -1
  51. package/dist/services/createMjmlSlotSchema.js +1 -1
  52. package/dist/services/getFilledMjmlAttributes.d.ts +1 -0
  53. package/dist/services/getFilledMjmlAttributes.js +3 -0
  54. package/dist/services/mjmlRootPropsSchema.d.ts +2 -2
  55. package/dist/services/mjmlRootPropsSchema.js +2 -2
  56. package/dist/services/parseMjmlDocument.js +2 -1
  57. package/dist/services/readMjmlContent.d.ts +1 -1
  58. package/dist/services/readMjmlNode.js +1 -1
  59. package/dist/services/readMjmlRoot.js +2 -1
  60. package/dist/services/readMjmlRootProps.d.ts +1 -0
  61. package/dist/services/readMjmlRootProps.js +7 -0
  62. package/dist/services/renderMjmlDocument.js +3 -2
  63. package/dist/services/renderMjmlHead.js +1 -1
  64. package/package.json +6 -6
package/README.md CHANGED
@@ -89,7 +89,7 @@ const document = createMjmlDocumentSchema(registry, bodyChildrenSchema, Number.M
89
89
  type: "mj-section",
90
90
  },
91
91
  ],
92
- root: { props: {} },
92
+ root: { props: { lang: "", title: "" } },
93
93
  });
94
94
  const json = renderMjmlDocument(document, registry, { context: undefined, isStampingIds: false });
95
95
  const { html } = await mjml2html(json, { validationLevel: "strict" });
@@ -103,7 +103,7 @@ const { html } = await mjml2html(json, { validationLevel: "strict" });
103
103
  | `MjmlDocument` | a document whose head is the root's props, typed by the registry |
104
104
  | `parseMjmlDocument` | MJML source read back into a document, refusing a tag, attribute or value the package does not take |
105
105
  | `renderMjmlDocument` | a checked document rendered to MJML's JSON form |
106
- | `serializeMjml` | MJML's JSON form written as MJML source |
106
+ | `serializeMjml` | MJML's JSON form written as MJML source, which the email's MJML source export downloads |
107
107
 
108
108
  ## <a name="license">⚖️ License</a>
109
109
 
package/dist/index.d.ts CHANGED
@@ -81,30 +81,30 @@ import { createMjmlRichTextPropsSchema } from "./services/components/createMjmlR
81
81
  import { createMjmlRichTextType } from "./services/components/createMjmlRichTextType.js";
82
82
  import { createMjmlTextPropsSchema } from "./services/components/createMjmlTextPropsSchema.js";
83
83
  import { createMjmlTextType } from "./services/components/createMjmlTextType.js";
84
- import { accordionAttributes, accordionPropsSchema, mjmlAccordionType } from "./services/components/mjAccordion.js";
85
- import { accordionElementAttributes, accordionElementPropsSchema, mjmlAccordionElementType } from "./services/components/mjAccordionElement.js";
84
+ import { accordionPropsSchema, mjmlAccordionType } from "./services/components/mjAccordion.js";
85
+ import { accordionElementPropsSchema, mjmlAccordionElementType } from "./services/components/mjAccordionElement.js";
86
86
  import { accordionTextAttributes } from "./services/components/mjAccordionText.js";
87
- import { accordionTitleAttributes, accordionTitlePropsSchema, mjmlAccordionTitleType } from "./services/components/mjAccordionTitle.js";
88
- import { buttonAttributes, buttonPropsSchema, mjmlButtonType } from "./services/components/mjButton.js";
89
- import { carouselAttributes, carouselPropsSchema, mjmlCarouselType } from "./services/components/mjCarousel.js";
90
- import { carouselImageAttributes, carouselImagePropsSchema, mjmlCarouselImageType } from "./services/components/mjCarouselImage.js";
91
- import { columnAttributes, columnPropsSchema, createMjmlColumnType } from "./services/components/mjColumn.js";
92
- import { dividerAttributes, dividerPropsSchema, mjmlDividerType } from "./services/components/mjDivider.js";
93
- import { groupAttributes, groupPropsSchema, mjmlGroupType } from "./services/components/mjGroup.js";
94
- import { createMjmlHeroType, heroAttributes, heroPropsSchema } from "./services/components/mjHero.js";
95
- import { imageAttributes, imagePropsSchema, mjmlImageType } from "./services/components/mjImage.js";
96
- import { mjmlNavbarType, navbarAttributes, navbarPropsSchema } from "./services/components/mjNavbar.js";
97
- import { mjmlNavbarLinkType, navbarLinkAttributes, navbarLinkPropsSchema } from "./services/components/mjNavbarLink.js";
98
- import { mjmlRawType, rawAttributes, rawPropsSchema } from "./services/components/mjRaw.js";
87
+ import { accordionTitlePropsSchema, mjmlAccordionTitleType } from "./services/components/mjAccordionTitle.js";
88
+ import { buttonPropsSchema, mjmlButtonType } from "./services/components/mjButton.js";
89
+ import { carouselPropsSchema, mjmlCarouselType } from "./services/components/mjCarousel.js";
90
+ import { carouselImagePropsSchema, mjmlCarouselImageType } from "./services/components/mjCarouselImage.js";
91
+ import { columnPropsSchema, createMjmlColumnType } from "./services/components/mjColumn.js";
92
+ import { dividerPropsSchema, mjmlDividerType } from "./services/components/mjDivider.js";
93
+ import { groupPropsSchema, mjmlGroupType } from "./services/components/mjGroup.js";
94
+ import { createMjmlHeroType, heroPropsSchema } from "./services/components/mjHero.js";
95
+ import { imagePropsSchema, mjmlImageType } from "./services/components/mjImage.js";
96
+ import { mjmlNavbarType, navbarPropsSchema } from "./services/components/mjNavbar.js";
97
+ import { mjmlNavbarLinkType, navbarLinkPropsSchema } from "./services/components/mjNavbarLink.js";
98
+ import { mjmlRawType, rawPropsSchema } from "./services/components/mjRaw.js";
99
99
  import { mjmlSectionType, sectionPropsSchema } from "./services/components/mjSection.js";
100
- import { mjmlSocialType, socialAttributes, socialPropsSchema } from "./services/components/mjSocial.js";
101
- import { mjmlSocialElementType, socialElementAttributes, socialElementPropsSchema } from "./services/components/mjSocialElement.js";
102
- import { mjmlSpacerType, spacerAttributes, spacerPropsSchema } from "./services/components/mjSpacer.js";
103
- import { mjmlTableType, tableAttributes, tablePropsSchema } from "./services/components/mjTable.js";
100
+ import { mjmlSocialType, socialPropsSchema } from "./services/components/mjSocial.js";
101
+ import { mjmlSocialElementType, socialElementPropsSchema } from "./services/components/mjSocialElement.js";
102
+ import { mjmlSpacerType, spacerPropsSchema } from "./services/components/mjSpacer.js";
103
+ import { mjmlTableType, tablePropsSchema } from "./services/components/mjTable.js";
104
104
  import { textAttributes } from "./services/components/mjText.js";
105
- import { mjmlWrapperType, wrapperAttributes, wrapperGapAttributes, wrapperPropsSchema } from "./services/components/mjWrapper.js";
105
+ import { mjmlWrapperType, wrapperPropsSchema } from "./services/components/mjWrapper.js";
106
106
  import { sectionAttributes } from "./services/components/sectionAttributes.js";
107
- import { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, EXCLUDED_MJML_TAGS, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE } from "./services/constants.js";
107
+ import { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_DEFAULT_BODY_WIDTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE } from "./services/constants.js";
108
108
  import { createMjmlAttributeSchema } from "./services/createMjmlAttributeSchema.js";
109
109
  import { createMjmlAttributeShape } from "./services/createMjmlAttributeShape.js";
110
110
  import { createMjmlDocumentSchema } from "./services/createMjmlDocumentSchema.js";
@@ -116,6 +116,7 @@ import { createMjmlSlotSchema } from "./services/createMjmlSlotSchema.js";
116
116
  import { createTypeSchema } from "./services/createTypeSchema.js";
117
117
  import { createUnitPattern } from "./services/createUnitPattern.js";
118
118
  import { escapeMjmlAttributes } from "./services/escapeMjmlAttributes.js";
119
+ import { getFilledMjmlAttributes } from "./services/getFilledMjmlAttributes.js";
119
120
  import { getMjmlAttributeFields } from "./services/getMjmlAttributeFields.js";
120
121
  import { getMjmlAttributeSchema } from "./services/getMjmlAttributeSchema.js";
121
122
  import { getMjmlRefusalKey } from "./services/getMjmlRefusalKey.js";
@@ -133,6 +134,7 @@ import { readMjmlHeadText } from "./services/readMjmlHeadText.js";
133
134
  import { readMjmlNode } from "./services/readMjmlNode.js";
134
135
  import { readMjmlNodes } from "./services/readMjmlNodes.js";
135
136
  import { readMjmlRoot } from "./services/readMjmlRoot.js";
137
+ import { readMjmlRootProps } from "./services/readMjmlRootProps.js";
136
138
  import { readMjmlStrayText } from "./services/readMjmlStrayText.js";
137
139
  import { readMjmlTopLevel } from "./services/readMjmlTopLevel.js";
138
140
  import { renderMjmlDocument } from "./services/renderMjmlDocument.js";
@@ -141,4 +143,4 @@ import { renderMjmlNode } from "./services/renderMjmlNode.js";
141
143
  import { serializeAttributes } from "./services/serializeAttributes.js";
142
144
  import { serializeMjml } from "./services/serializeMjml.js";
143
145
  import { stampNode } from "./services/stampNode.js";
144
- export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, CreateMjmlNodeSchemaOptions, CreateMjmlRegistryOptions, DIRECTION_ATTRIBUTE_KEY, EXCLUDED_MJML_TAGS, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, MjmlAccordionElementNode, MjmlAccordionElementProps, MjmlAccordionNode, MjmlAccordionProps, MjmlAccordionTextNode, MjmlAccordionTextProps, MjmlAccordionTitleNode, MjmlAccordionTitleProps, MjmlAttributeField, MjmlAttributeKind, MjmlAttributeSchema, MjmlAttributeType, MjmlBlockTypeDefinition, MjmlBuiltInNode, MjmlButtonNode, MjmlButtonProps, MjmlCarouselImageNode, MjmlCarouselImageProps, MjmlCarouselNode, MjmlCarouselProps, MjmlColumnNode, MjmlColumnProps, MjmlContentKind, MjmlContentKindSchemaMap, MjmlDirection, MjmlDividerNode, MjmlDividerProps, MjmlDocument, MjmlFlowNode, MjmlGroupNode, MjmlGroupProps, MjmlHeroNode, MjmlHeroProps, MjmlImageNode, MjmlImageProps, MjmlJson, MjmlLeafNode, MjmlLeafNodeSchema, MjmlLeafNodes, MjmlNavbarLinkNode, MjmlNavbarLinkProps, MjmlNavbarNode, MjmlNavbarProps, MjmlNode, MjmlNodeDefinition, MjmlNodeType, MjmlRawNode, MjmlRawProps, MjmlRegistry, MjmlRenderSpecification, MjmlRichText, MjmlRichTextAttributeValue, MjmlRichTextDefinition, MjmlRichTextTypeOptions, MjmlRootProps, MjmlSectionNode, MjmlSectionProps, MjmlSocialElementNode, MjmlSocialElementProps, MjmlSocialNode, MjmlSocialProps, MjmlSpacerNode, MjmlSpacerProps, MjmlTableNode, MjmlTableProps, MjmlTextNode, MjmlTextProps, MjmlWrapperNode, MjmlWrapperProps, RenderMjmlDocumentOptions, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE, accordionAttributes, accordionElementAttributes, accordionElementPropsSchema, accordionPropsSchema, accordionTextAttributes, accordionTitleAttributes, accordionTitlePropsSchema, allowedAddressSchema, buttonAttributes, buttonPropsSchema, carouselAttributes, carouselImageAttributes, carouselImagePropsSchema, carouselPropsSchema, checkHasElement, checkIsMjmlAddressAttribute, checkIsRepeatedMjmlTag, checkMjmlAlternativeText, checkMjmlAttributeValues, columnAttributes, columnPropsSchema, createMjmlAccordionTextPropsSchema, createMjmlAccordionTextType, createMjmlAttributeSchema, createMjmlAttributeShape, createMjmlColumnType, createMjmlDocumentSchema, createMjmlHeroType, createMjmlNodeBranch, createMjmlNodeSchema, createMjmlRawContentSchema, createMjmlRegistry, createMjmlRichTextPropsSchema, createMjmlRichTextType, createMjmlRootPropsSchema, createMjmlSlotSchema, createMjmlTextPropsSchema, createMjmlTextType, createTypeSchema, createUnitPattern, dividerAttributes, dividerPropsSchema, escapeMjmlAttributes, getMjmlAttributeFields, getMjmlAttributeSchema, getMjmlRefusalKey, groupAttributes, groupPropsSchema, heroAttributes, heroPropsSchema, imageAttributes, imagePropsSchema, labelContentSchema, mjmlAccordionElementType, mjmlAccordionTitleType, mjmlAccordionType, mjmlButtonType, mjmlCarouselImageType, mjmlCarouselType, mjmlDividerType, mjmlGroupType, mjmlImageType, mjmlNavbarLinkType, mjmlNavbarType, mjmlNodeChildren, mjmlRawType, mjmlRootPropsSchema, mjmlSectionType, mjmlSocialElementType, mjmlSocialType, mjmlSpacerType, mjmlTableType, mjmlWrapperType, navbarAttributes, navbarLinkAttributes, navbarLinkPropsSchema, navbarPropsSchema, parseMjmlAttributeType, parseMjmlDocument, rawAttributes, rawPropsSchema, readMjmlAttributeRefusal, readMjmlContent, readMjmlHead, readMjmlHeadText, readMjmlNode, readMjmlNodes, readMjmlRoot, readMjmlStrayText, readMjmlTopLevel, renderMjmlDocument, renderMjmlHead, renderMjmlNode, sectionAttributes, sectionPropsSchema, serializeAttributes, serializeMjml, socialAttributes, socialElementAttributes, socialElementPropsSchema, socialPropsSchema, spacerAttributes, spacerPropsSchema, stampNode, tableAttributes, tablePropsSchema, textAttributes, wrapperAttributes, wrapperGapAttributes, wrapperPropsSchema };
146
+ export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, CreateMjmlNodeSchemaOptions, CreateMjmlRegistryOptions, DIRECTION_ATTRIBUTE_KEY, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_DEFAULT_BODY_WIDTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, MjmlAccordionElementNode, MjmlAccordionElementProps, MjmlAccordionNode, MjmlAccordionProps, MjmlAccordionTextNode, MjmlAccordionTextProps, MjmlAccordionTitleNode, MjmlAccordionTitleProps, MjmlAttributeField, MjmlAttributeKind, MjmlAttributeSchema, MjmlAttributeType, MjmlBlockTypeDefinition, MjmlBuiltInNode, MjmlButtonNode, MjmlButtonProps, MjmlCarouselImageNode, MjmlCarouselImageProps, MjmlCarouselNode, MjmlCarouselProps, MjmlColumnNode, MjmlColumnProps, MjmlContentKind, MjmlContentKindSchemaMap, MjmlDirection, MjmlDividerNode, MjmlDividerProps, MjmlDocument, MjmlFlowNode, MjmlGroupNode, MjmlGroupProps, MjmlHeroNode, MjmlHeroProps, MjmlImageNode, MjmlImageProps, MjmlJson, MjmlLeafNode, MjmlLeafNodeSchema, MjmlLeafNodes, MjmlNavbarLinkNode, MjmlNavbarLinkProps, MjmlNavbarNode, MjmlNavbarProps, MjmlNode, MjmlNodeDefinition, MjmlNodeType, MjmlRawNode, MjmlRawProps, MjmlRegistry, MjmlRenderSpecification, MjmlRichText, MjmlRichTextAttributeValue, MjmlRichTextDefinition, MjmlRichTextTypeOptions, MjmlRootProps, MjmlSectionNode, MjmlSectionProps, MjmlSocialElementNode, MjmlSocialElementProps, MjmlSocialNode, MjmlSocialProps, MjmlSpacerNode, MjmlSpacerProps, MjmlTableNode, MjmlTableProps, MjmlTextNode, MjmlTextProps, MjmlWrapperNode, MjmlWrapperProps, RenderMjmlDocumentOptions, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE, accordionElementPropsSchema, accordionPropsSchema, accordionTextAttributes, accordionTitlePropsSchema, allowedAddressSchema, buttonPropsSchema, carouselImagePropsSchema, carouselPropsSchema, checkHasElement, checkIsMjmlAddressAttribute, checkIsRepeatedMjmlTag, checkMjmlAlternativeText, checkMjmlAttributeValues, columnPropsSchema, createMjmlAccordionTextPropsSchema, createMjmlAccordionTextType, createMjmlAttributeSchema, createMjmlAttributeShape, createMjmlColumnType, createMjmlDocumentSchema, createMjmlHeroType, createMjmlNodeBranch, createMjmlNodeSchema, createMjmlRawContentSchema, createMjmlRegistry, createMjmlRichTextPropsSchema, createMjmlRichTextType, createMjmlRootPropsSchema, createMjmlSlotSchema, createMjmlTextPropsSchema, createMjmlTextType, createTypeSchema, createUnitPattern, dividerPropsSchema, escapeMjmlAttributes, getFilledMjmlAttributes, getMjmlAttributeFields, getMjmlAttributeSchema, getMjmlRefusalKey, groupPropsSchema, heroPropsSchema, imagePropsSchema, labelContentSchema, mjmlAccordionElementType, mjmlAccordionTitleType, mjmlAccordionType, mjmlButtonType, mjmlCarouselImageType, mjmlCarouselType, mjmlDividerType, mjmlGroupType, mjmlImageType, mjmlNavbarLinkType, mjmlNavbarType, mjmlNodeChildren, mjmlRawType, mjmlRootPropsSchema, mjmlSectionType, mjmlSocialElementType, mjmlSocialType, mjmlSpacerType, mjmlTableType, mjmlWrapperType, navbarLinkPropsSchema, navbarPropsSchema, parseMjmlAttributeType, parseMjmlDocument, rawPropsSchema, readMjmlAttributeRefusal, readMjmlContent, readMjmlHead, readMjmlHeadText, readMjmlNode, readMjmlNodes, readMjmlRoot, readMjmlRootProps, readMjmlStrayText, readMjmlTopLevel, renderMjmlDocument, renderMjmlHead, renderMjmlNode, sectionAttributes, sectionPropsSchema, serializeAttributes, serializeMjml, socialElementPropsSchema, socialPropsSchema, spacerPropsSchema, stampNode, tablePropsSchema, textAttributes, wrapperPropsSchema };
package/dist/index.js CHANGED
@@ -14,30 +14,30 @@ import { createMjmlRichTextPropsSchema } from "./services/components/createMjmlR
14
14
  import { createMjmlRichTextType } from "./services/components/createMjmlRichTextType.js";
15
15
  import { createMjmlTextPropsSchema } from "./services/components/createMjmlTextPropsSchema.js";
16
16
  import { createMjmlTextType } from "./services/components/createMjmlTextType.js";
17
- import { accordionAttributes, accordionPropsSchema, mjmlAccordionType } from "./services/components/mjAccordion.js";
18
- import { accordionElementAttributes, accordionElementPropsSchema, mjmlAccordionElementType } from "./services/components/mjAccordionElement.js";
17
+ import { accordionPropsSchema, mjmlAccordionType } from "./services/components/mjAccordion.js";
18
+ import { accordionElementPropsSchema, mjmlAccordionElementType } from "./services/components/mjAccordionElement.js";
19
19
  import { accordionTextAttributes } from "./services/components/mjAccordionText.js";
20
- import { accordionTitleAttributes, accordionTitlePropsSchema, mjmlAccordionTitleType } from "./services/components/mjAccordionTitle.js";
21
- import { buttonAttributes, buttonPropsSchema, mjmlButtonType } from "./services/components/mjButton.js";
22
- import { carouselAttributes, carouselPropsSchema, mjmlCarouselType } from "./services/components/mjCarousel.js";
23
- import { carouselImageAttributes, carouselImagePropsSchema, mjmlCarouselImageType } from "./services/components/mjCarouselImage.js";
24
- import { columnAttributes, columnPropsSchema, createMjmlColumnType } from "./services/components/mjColumn.js";
25
- import { dividerAttributes, dividerPropsSchema, mjmlDividerType } from "./services/components/mjDivider.js";
26
- import { groupAttributes, groupPropsSchema, mjmlGroupType } from "./services/components/mjGroup.js";
27
- import { createMjmlHeroType, heroAttributes, heroPropsSchema } from "./services/components/mjHero.js";
28
- import { imageAttributes, imagePropsSchema, mjmlImageType } from "./services/components/mjImage.js";
29
- import { mjmlNavbarType, navbarAttributes, navbarPropsSchema } from "./services/components/mjNavbar.js";
30
- import { mjmlNavbarLinkType, navbarLinkAttributes, navbarLinkPropsSchema } from "./services/components/mjNavbarLink.js";
31
- import { mjmlRawType, rawAttributes, rawPropsSchema } from "./services/components/mjRaw.js";
20
+ import { accordionTitlePropsSchema, mjmlAccordionTitleType } from "./services/components/mjAccordionTitle.js";
21
+ import { buttonPropsSchema, mjmlButtonType } from "./services/components/mjButton.js";
22
+ import { carouselPropsSchema, mjmlCarouselType } from "./services/components/mjCarousel.js";
23
+ import { carouselImagePropsSchema, mjmlCarouselImageType } from "./services/components/mjCarouselImage.js";
24
+ import { columnPropsSchema, createMjmlColumnType } from "./services/components/mjColumn.js";
25
+ import { dividerPropsSchema, mjmlDividerType } from "./services/components/mjDivider.js";
26
+ import { groupPropsSchema, mjmlGroupType } from "./services/components/mjGroup.js";
27
+ import { createMjmlHeroType, heroPropsSchema } from "./services/components/mjHero.js";
28
+ import { imagePropsSchema, mjmlImageType } from "./services/components/mjImage.js";
29
+ import { mjmlNavbarType, navbarPropsSchema } from "./services/components/mjNavbar.js";
30
+ import { mjmlNavbarLinkType, navbarLinkPropsSchema } from "./services/components/mjNavbarLink.js";
31
+ import { mjmlRawType, rawPropsSchema } from "./services/components/mjRaw.js";
32
32
  import { mjmlSectionType, sectionPropsSchema } from "./services/components/mjSection.js";
33
- import { mjmlSocialType, socialAttributes, socialPropsSchema } from "./services/components/mjSocial.js";
34
- import { mjmlSocialElementType, socialElementAttributes, socialElementPropsSchema } from "./services/components/mjSocialElement.js";
35
- import { mjmlSpacerType, spacerAttributes, spacerPropsSchema } from "./services/components/mjSpacer.js";
36
- import { mjmlTableType, tableAttributes, tablePropsSchema } from "./services/components/mjTable.js";
33
+ import { mjmlSocialType, socialPropsSchema } from "./services/components/mjSocial.js";
34
+ import { mjmlSocialElementType, socialElementPropsSchema } from "./services/components/mjSocialElement.js";
35
+ import { mjmlSpacerType, spacerPropsSchema } from "./services/components/mjSpacer.js";
36
+ import { mjmlTableType, tablePropsSchema } from "./services/components/mjTable.js";
37
37
  import { textAttributes } from "./services/components/mjText.js";
38
- import { mjmlWrapperType, wrapperAttributes, wrapperGapAttributes, wrapperPropsSchema } from "./services/components/mjWrapper.js";
38
+ import { mjmlWrapperType, wrapperPropsSchema } from "./services/components/mjWrapper.js";
39
39
  import { sectionAttributes } from "./services/components/sectionAttributes.js";
40
- import { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, EXCLUDED_MJML_TAGS, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE } from "./services/constants.js";
40
+ import { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_DEFAULT_BODY_WIDTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE } from "./services/constants.js";
41
41
  import { createMjmlAttributeSchema } from "./services/createMjmlAttributeSchema.js";
42
42
  import { createMjmlAttributeShape } from "./services/createMjmlAttributeShape.js";
43
43
  import { createMjmlDocumentSchema } from "./services/createMjmlDocumentSchema.js";
@@ -49,6 +49,7 @@ import { createMjmlSlotSchema } from "./services/createMjmlSlotSchema.js";
49
49
  import { createTypeSchema } from "./services/createTypeSchema.js";
50
50
  import { createUnitPattern } from "./services/createUnitPattern.js";
51
51
  import { escapeMjmlAttributes } from "./services/escapeMjmlAttributes.js";
52
+ import { getFilledMjmlAttributes } from "./services/getFilledMjmlAttributes.js";
52
53
  import { getMjmlAttributeFields } from "./services/getMjmlAttributeFields.js";
53
54
  import { getMjmlAttributeSchema } from "./services/getMjmlAttributeSchema.js";
54
55
  import { getMjmlRefusalKey } from "./services/getMjmlRefusalKey.js";
@@ -66,6 +67,7 @@ import { readMjmlHeadText } from "./services/readMjmlHeadText.js";
66
67
  import { readMjmlNode } from "./services/readMjmlNode.js";
67
68
  import { readMjmlNodes } from "./services/readMjmlNodes.js";
68
69
  import { readMjmlRoot } from "./services/readMjmlRoot.js";
70
+ import { readMjmlRootProps } from "./services/readMjmlRootProps.js";
69
71
  import { readMjmlStrayText } from "./services/readMjmlStrayText.js";
70
72
  import { readMjmlTopLevel } from "./services/readMjmlTopLevel.js";
71
73
  import { renderMjmlDocument } from "./services/renderMjmlDocument.js";
@@ -74,4 +76,4 @@ import { renderMjmlNode } from "./services/renderMjmlNode.js";
74
76
  import { serializeAttributes } from "./services/serializeAttributes.js";
75
77
  import { serializeMjml } from "./services/serializeMjml.js";
76
78
  import { stampNode } from "./services/stampNode.js";
77
- export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, EXCLUDED_MJML_TAGS, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, MjmlAttributeKind, MjmlContentKind, MjmlContentKindSchemaMap, MjmlDirection, MjmlNodeType, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE, accordionAttributes, accordionElementAttributes, accordionElementPropsSchema, accordionPropsSchema, accordionTextAttributes, accordionTitleAttributes, accordionTitlePropsSchema, allowedAddressSchema, buttonAttributes, buttonPropsSchema, carouselAttributes, carouselImageAttributes, carouselImagePropsSchema, carouselPropsSchema, checkHasElement, checkIsMjmlAddressAttribute, checkIsRepeatedMjmlTag, checkMjmlAlternativeText, checkMjmlAttributeValues, columnAttributes, columnPropsSchema, createMjmlAccordionTextPropsSchema, createMjmlAccordionTextType, createMjmlAttributeSchema, createMjmlAttributeShape, createMjmlColumnType, createMjmlDocumentSchema, createMjmlHeroType, createMjmlNodeBranch, createMjmlNodeSchema, createMjmlRawContentSchema, createMjmlRegistry, createMjmlRichTextPropsSchema, createMjmlRichTextType, createMjmlRootPropsSchema, createMjmlSlotSchema, createMjmlTextPropsSchema, createMjmlTextType, createTypeSchema, createUnitPattern, dividerAttributes, dividerPropsSchema, escapeMjmlAttributes, getMjmlAttributeFields, getMjmlAttributeSchema, getMjmlRefusalKey, groupAttributes, groupPropsSchema, heroAttributes, heroPropsSchema, imageAttributes, imagePropsSchema, labelContentSchema, mjmlAccordionElementType, mjmlAccordionTitleType, mjmlAccordionType, mjmlButtonType, mjmlCarouselImageType, mjmlCarouselType, mjmlDividerType, mjmlGroupType, mjmlImageType, mjmlNavbarLinkType, mjmlNavbarType, mjmlNodeChildren, mjmlRawType, mjmlRootPropsSchema, mjmlSectionType, mjmlSocialElementType, mjmlSocialType, mjmlSpacerType, mjmlTableType, mjmlWrapperType, navbarAttributes, navbarLinkAttributes, navbarLinkPropsSchema, navbarPropsSchema, parseMjmlAttributeType, parseMjmlDocument, rawAttributes, rawPropsSchema, readMjmlAttributeRefusal, readMjmlContent, readMjmlHead, readMjmlHeadText, readMjmlNode, readMjmlNodes, readMjmlRoot, readMjmlStrayText, readMjmlTopLevel, renderMjmlDocument, renderMjmlHead, renderMjmlNode, sectionAttributes, sectionPropsSchema, serializeAttributes, serializeMjml, socialAttributes, socialElementAttributes, socialElementPropsSchema, socialPropsSchema, spacerAttributes, spacerPropsSchema, stampNode, tableAttributes, tablePropsSchema, textAttributes, wrapperAttributes, wrapperGapAttributes, wrapperPropsSchema };
79
+ export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_DEFAULT_BODY_WIDTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, MjmlAttributeKind, MjmlContentKind, MjmlContentKindSchemaMap, MjmlDirection, MjmlNodeType, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE, accordionElementPropsSchema, accordionPropsSchema, accordionTextAttributes, accordionTitlePropsSchema, allowedAddressSchema, buttonPropsSchema, carouselImagePropsSchema, carouselPropsSchema, checkHasElement, checkIsMjmlAddressAttribute, checkIsRepeatedMjmlTag, checkMjmlAlternativeText, checkMjmlAttributeValues, columnPropsSchema, createMjmlAccordionTextPropsSchema, createMjmlAccordionTextType, createMjmlAttributeSchema, createMjmlAttributeShape, createMjmlColumnType, createMjmlDocumentSchema, createMjmlHeroType, createMjmlNodeBranch, createMjmlNodeSchema, createMjmlRawContentSchema, createMjmlRegistry, createMjmlRichTextPropsSchema, createMjmlRichTextType, createMjmlRootPropsSchema, createMjmlSlotSchema, createMjmlTextPropsSchema, createMjmlTextType, createTypeSchema, createUnitPattern, dividerPropsSchema, escapeMjmlAttributes, getFilledMjmlAttributes, getMjmlAttributeFields, getMjmlAttributeSchema, getMjmlRefusalKey, groupPropsSchema, heroPropsSchema, imagePropsSchema, labelContentSchema, mjmlAccordionElementType, mjmlAccordionTitleType, mjmlAccordionType, mjmlButtonType, mjmlCarouselImageType, mjmlCarouselType, mjmlDividerType, mjmlGroupType, mjmlImageType, mjmlNavbarLinkType, mjmlNavbarType, mjmlNodeChildren, mjmlRawType, mjmlRootPropsSchema, mjmlSectionType, mjmlSocialElementType, mjmlSocialType, mjmlSpacerType, mjmlTableType, mjmlWrapperType, navbarLinkPropsSchema, navbarPropsSchema, parseMjmlAttributeType, parseMjmlDocument, rawPropsSchema, readMjmlAttributeRefusal, readMjmlContent, readMjmlHead, readMjmlHeadText, readMjmlNode, readMjmlNodes, readMjmlRoot, readMjmlRootProps, readMjmlStrayText, readMjmlTopLevel, renderMjmlDocument, renderMjmlHead, renderMjmlNode, sectionAttributes, sectionPropsSchema, serializeAttributes, serializeMjml, socialElementPropsSchema, socialPropsSchema, spacerPropsSchema, stampNode, tablePropsSchema, textAttributes, wrapperPropsSchema };
@@ -1,7 +1,7 @@
1
1
  import { MjmlContentKind } from "./MjmlContentKind.js";
2
2
  import { MjmlJson } from "./MjmlJson.js";
3
- import { z } from "zod";
4
3
  import { BlockNode, BlockTypeDefinition, OwnProps } from "vue-block-editor-headless";
4
+ import { z } from "zod";
5
5
  export type MjmlBlockTypeDefinition<TNode extends BlockNode = BlockNode, TContext = unknown> = MjmlBlockTypeFields<TNode, TContext> & MjmlContentDefinition<TNode>;
6
6
  type MjmlBlockTypeFields<TNode extends BlockNode, TContext> = Pick<BlockTypeDefinition<TNode>, "slots" | "type"> & {
7
7
  allowedAttributes: Record<string, string>;
@@ -10,11 +10,11 @@ export interface MjmlRootProps {
10
10
  href: string;
11
11
  name: string;
12
12
  }[];
13
- lang?: string | undefined;
13
+ lang: string;
14
14
  preview?: string | undefined;
15
15
  styles?: undefined | {
16
16
  css: string;
17
17
  inline: boolean;
18
18
  }[];
19
- title?: string | undefined;
19
+ title: string;
20
20
  }
@@ -1,3 +1,3 @@
1
- import { MjmlContentKind } from "../models/MjmlContentKind.js";
2
1
  import { z } from "zod";
2
+ import { MjmlContentKind } from "../models/MjmlContentKind.js";
3
3
  export declare const MjmlContentKindSchemaMap: Record<Exclude<MjmlContentKind, typeof MjmlContentKind.RichText>, z.ZodString>;
@@ -1,8 +1,8 @@
1
1
  import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlRichText } from "../../models/MjmlRichText.js";
3
3
  import { MjmlRichTextDefinition } from "../../models/MjmlRichTextDefinition.js";
4
- import { accordionTextAttributes } from "./mjAccordionText.js";
5
4
  import { z } from "zod";
5
+ import { accordionTextAttributes } from "./mjAccordionText.js";
6
6
  export declare const createMjmlAccordionTextPropsSchema: <TContent extends MjmlRichText>(richText: MjmlRichTextDefinition<TContent>) => z.ZodObject<{ [K in keyof typeof accordionTextAttributes]: MjmlAttributeSchema; } & {
7
7
  content: z.ZodType<TContent>;
8
8
  }, z.core.$strict>;
@@ -1,8 +1,8 @@
1
1
  import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlRichText } from "../../models/MjmlRichText.js";
3
3
  import { MjmlRichTextDefinition } from "../../models/MjmlRichTextDefinition.js";
4
- import { textAttributes } from "./mjText.js";
5
4
  import { z } from "zod";
5
+ import { textAttributes } from "./mjText.js";
6
6
  export declare const createMjmlTextPropsSchema: <TContent extends MjmlRichText>(richText: MjmlRichTextDefinition<TContent>) => z.ZodObject<{ [K in keyof typeof textAttributes]: MjmlAttributeSchema; } & {
7
7
  content: z.ZodType<TContent>;
8
8
  }, z.core.$strict>;
@@ -17,7 +17,7 @@ declare const accordionBaseAttributes: {
17
17
  "icon-wrapped-url": string;
18
18
  padding: string;
19
19
  };
20
- export declare const accordionAttributes: typeof accordionBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
20
+ declare const accordionAttributes: typeof accordionBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
21
21
  export declare const accordionPropsSchema: z.ZodObject<{ [K in keyof typeof accordionAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
22
22
  export declare const mjmlAccordionType: MjmlBlockTypeDefinition<MjmlAccordionNode>;
23
23
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjAccordion.ts
6
7
  const accordionAttributes = {
7
8
  border: "string",
8
9
  "container-background-color": "color",
@@ -49,4 +50,4 @@ const mjmlAccordionType = {
49
50
  tagName: MjmlNodeType.Accordion
50
51
  })
51
52
  };
52
- export { accordionAttributes, accordionPropsSchema, mjmlAccordionType };
53
+ export { accordionPropsSchema, mjmlAccordionType };
@@ -2,7 +2,7 @@ import { MjmlAccordionElementNode } from "../../models/MjmlAccordionElementNode.
2
2
  import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
3
3
  import { MjmlBlockTypeDefinition } from "../../models/MjmlBlockTypeDefinition.js";
4
4
  import { z } from "zod";
5
- export declare const accordionElementAttributes: {
5
+ declare const accordionElementAttributes: {
6
6
  "background-color": string;
7
7
  border: string;
8
8
  "font-family": string;
@@ -16,4 +16,5 @@ export declare const accordionElementAttributes: {
16
16
  "icon-wrapped-url": string;
17
17
  };
18
18
  export declare const accordionElementPropsSchema: z.ZodObject<{ [K in keyof typeof accordionElementAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
19
- export declare const mjmlAccordionElementType: MjmlBlockTypeDefinition<MjmlAccordionElementNode>;
19
+ export declare const mjmlAccordionElementType: MjmlBlockTypeDefinition<MjmlAccordionElementNode>;
20
+ export {};
@@ -39,4 +39,4 @@ const mjmlAccordionElementType = {
39
39
  tagName: MjmlNodeType.AccordionElement
40
40
  })
41
41
  };
42
- export { accordionElementAttributes, accordionElementPropsSchema, mjmlAccordionElementType };
42
+ export { accordionElementPropsSchema, mjmlAccordionElementType };
@@ -11,7 +11,7 @@ declare const accordionTitleBaseAttributes: {
11
11
  "font-weight": string;
12
12
  padding: string;
13
13
  };
14
- export declare const accordionTitleAttributes: typeof accordionTitleBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
14
+ declare const accordionTitleAttributes: typeof accordionTitleBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
15
15
  export declare const accordionTitlePropsSchema: z.ZodObject<{ [K in keyof typeof accordionTitleAttributes]: MjmlAttributeSchema; } & {
16
16
  content: z.ZodString;
17
17
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { MjmlContentKindSchemaMap } from "../MjmlContentKindSchemaMap.js";
6
6
  import { renderMjmlNode } from "../renderMjmlNode.js";
7
7
  import { z } from "zod";
8
+ // src/services/components/mjAccordionTitle.ts
8
9
  const accordionTitleAttributes = {
9
10
  "background-color": "color",
10
11
  color: "color",
@@ -39,4 +40,4 @@ const mjmlAccordionTitleType = {
39
40
  tagName: MjmlNodeType.AccordionTitle
40
41
  })
41
42
  };
42
- export { accordionTitleAttributes, accordionTitlePropsSchema, mjmlAccordionTitleType };
43
+ export { accordionTitlePropsSchema, mjmlAccordionTitleType };
@@ -34,7 +34,7 @@ declare const buttonBaseAttributes: {
34
34
  "vertical-align": string;
35
35
  width: string;
36
36
  };
37
- export declare const buttonAttributes: typeof buttonBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
37
+ declare const buttonAttributes: typeof buttonBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
38
38
  export declare const buttonPropsSchema: z.ZodObject<{ [K in keyof typeof buttonAttributes]: MjmlAttributeSchema; } & {
39
39
  content: z.ZodString;
40
40
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { MjmlContentKindSchemaMap } from "../MjmlContentKindSchemaMap.js";
6
6
  import { renderMjmlNode } from "../renderMjmlNode.js";
7
7
  import { z } from "zod";
8
+ // src/services/components/mjButton.ts
8
9
  const buttonAttributes = {
9
10
  align: "enum(left,center,right)",
10
11
  "background-color": "color",
@@ -75,4 +76,4 @@ const mjmlButtonType = {
75
76
  tagName: MjmlNodeType.Button
76
77
  })
77
78
  };
78
- export { buttonAttributes, buttonPropsSchema, mjmlButtonType };
79
+ export { buttonPropsSchema, mjmlButtonType };
@@ -18,7 +18,7 @@ declare const carouselBaseAttributes: {
18
18
  "tb-width": string;
19
19
  thumbnails: string;
20
20
  };
21
- export declare const carouselAttributes: typeof carouselBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
21
+ declare const carouselAttributes: typeof carouselBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
22
22
  export declare const carouselPropsSchema: z.ZodObject<{ [K in keyof typeof carouselAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
23
23
  export declare const mjmlCarouselType: MjmlBlockTypeDefinition<MjmlCarouselNode>;
24
24
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjCarousel.ts
6
7
  const carouselAttributes = {
7
8
  align: "enum(left,center,right)",
8
9
  "border-radius": "string",
@@ -49,4 +50,4 @@ const mjmlCarouselType = {
49
50
  tagName: MjmlNodeType.Carousel
50
51
  })
51
52
  };
52
- export { carouselAttributes, carouselPropsSchema, mjmlCarouselType };
53
+ export { carouselPropsSchema, mjmlCarouselType };
@@ -2,7 +2,7 @@ import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlBlockTypeDefinition } from "../../models/MjmlBlockTypeDefinition.js";
3
3
  import { MjmlCarouselImageNode } from "../../models/MjmlCarouselImageNode.js";
4
4
  import { z } from "zod";
5
- export declare const carouselImageAttributes: {
5
+ declare const carouselImageAttributes: {
6
6
  alt: string;
7
7
  "border-radius": string;
8
8
  href: string;
@@ -17,4 +17,5 @@ export declare const carouselImageAttributes: {
17
17
  export declare const carouselImagePropsSchema: z.ZodObject<{ [K in keyof typeof carouselImageAttributes]: MjmlAttributeSchema; } & {
18
18
  decorative: z.ZodOptional<z.ZodBoolean>;
19
19
  }, z.core.$strict>;
20
- export declare const mjmlCarouselImageType: MjmlBlockTypeDefinition<MjmlCarouselImageNode>;
20
+ export declare const mjmlCarouselImageType: MjmlBlockTypeDefinition<MjmlCarouselImageNode>;
21
+ export {};
@@ -41,4 +41,4 @@ const mjmlCarouselImageType = {
41
41
  tagName: MjmlNodeType.CarouselImage
42
42
  })
43
43
  };
44
- export { carouselImageAttributes, carouselImagePropsSchema, mjmlCarouselImageType };
44
+ export { carouselImagePropsSchema, mjmlCarouselImageType };
@@ -24,7 +24,7 @@ declare const columnBaseAttributes: {
24
24
  "vertical-align": string;
25
25
  width: string;
26
26
  };
27
- export declare const columnAttributes: typeof columnBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
27
+ declare const columnAttributes: typeof columnBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
28
28
  export declare const columnPropsSchema: z.ZodObject<{ [K in keyof typeof columnAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
29
29
  export declare const createMjmlColumnType: (leafTypes: MjmlLeafNode["type"][]) => MjmlBlockTypeDefinition<MjmlColumnNode>;
30
30
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjColumn.ts
6
7
  const columnAttributes = {
7
8
  "background-color": "color",
8
9
  border: "string",
@@ -61,4 +62,4 @@ const createMjmlColumnType = (leafTypes) => {
61
62
  })
62
63
  };
63
64
  };
64
- export { columnAttributes, columnPropsSchema, createMjmlColumnType };
65
+ export { columnPropsSchema, createMjmlColumnType };
@@ -12,7 +12,7 @@ declare const dividerBaseAttributes: {
12
12
  padding: string;
13
13
  width: string;
14
14
  };
15
- export declare const dividerAttributes: typeof dividerBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
15
+ declare const dividerAttributes: typeof dividerBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
16
16
  export declare const dividerPropsSchema: z.ZodObject<{ [K in keyof typeof dividerAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
17
17
  export declare const mjmlDividerType: MjmlBlockTypeDefinition<MjmlDividerNode>;
18
18
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjDivider.ts
6
7
  const dividerAttributes = {
7
8
  align: "enum(left,center,right)",
8
9
  "border-color": "color",
@@ -39,4 +40,4 @@ const mjmlDividerType = {
39
40
  tagName: MjmlNodeType.Divider
40
41
  })
41
42
  };
42
- export { dividerAttributes, dividerPropsSchema, mjmlDividerType };
43
+ export { dividerPropsSchema, mjmlDividerType };
@@ -2,11 +2,12 @@ import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlBlockTypeDefinition } from "../../models/MjmlBlockTypeDefinition.js";
3
3
  import { MjmlGroupNode } from "../../models/MjmlGroupNode.js";
4
4
  import { z } from "zod";
5
- export declare const groupAttributes: {
5
+ declare const groupAttributes: {
6
6
  "background-color": string;
7
7
  direction: string;
8
8
  "vertical-align": string;
9
9
  width: string;
10
10
  };
11
11
  export declare const groupPropsSchema: z.ZodObject<{ [K in keyof typeof groupAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
12
- export declare const mjmlGroupType: MjmlBlockTypeDefinition<MjmlGroupNode>;
12
+ export declare const mjmlGroupType: MjmlBlockTypeDefinition<MjmlGroupNode>;
13
+ export {};
@@ -28,4 +28,4 @@ const mjmlGroupType = {
28
28
  tagName: MjmlNodeType.Group
29
29
  })
30
30
  };
31
- export { groupAttributes, groupPropsSchema, mjmlGroupType };
31
+ export { groupPropsSchema, mjmlGroupType };
@@ -22,7 +22,7 @@ declare const heroBaseAttributes: {
22
22
  padding: string;
23
23
  "vertical-align": string;
24
24
  };
25
- export declare const heroAttributes: typeof heroBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
25
+ declare const heroAttributes: typeof heroBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
26
26
  export declare const heroPropsSchema: z.ZodObject<{ [K in keyof typeof heroAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
27
27
  export declare const createMjmlHeroType: (leafTypes: MjmlLeafNode["type"][]) => MjmlBlockTypeDefinition<MjmlHeroNode>;
28
28
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjHero.ts
6
7
  const heroAttributes = {
7
8
  "background-color": "color",
8
9
  "background-height": "unit(px,%)",
@@ -63,4 +64,4 @@ const createMjmlHeroType = (leafTypes) => {
63
64
  })
64
65
  };
65
66
  };
66
- export { createMjmlHeroType, heroAttributes, heroPropsSchema };
67
+ export { createMjmlHeroType, heroPropsSchema };
@@ -29,7 +29,7 @@ declare const imageBaseAttributes: {
29
29
  usemap: string;
30
30
  width: string;
31
31
  };
32
- export declare const imageAttributes: typeof imageBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
32
+ declare const imageAttributes: typeof imageBaseAttributes & typeof MJML_PADDING_ATTRIBUTES;
33
33
  export declare const imagePropsSchema: z.ZodObject<{ [K in keyof typeof imageAttributes]: MjmlAttributeSchema; } & {
34
34
  decorative: z.ZodOptional<z.ZodBoolean>;
35
35
  }, z.core.$strict>;
@@ -4,6 +4,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
4
4
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { renderMjmlNode } from "../renderMjmlNode.js";
6
6
  import { z } from "zod";
7
+ // src/services/components/mjImage.ts
7
8
  const imageAttributes = {
8
9
  align: "enum(left,center,right)",
9
10
  alt: "string",
@@ -61,4 +62,4 @@ const mjmlImageType = {
61
62
  tagName: MjmlNodeType.Image
62
63
  })
63
64
  };
64
- export { imageAttributes, imagePropsSchema, mjmlImageType };
65
+ export { imagePropsSchema, mjmlImageType };
@@ -23,7 +23,7 @@ declare const navbarBaseAttributes: {
23
23
  "ico-text-transform": string;
24
24
  padding: string;
25
25
  };
26
- export declare const navbarAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof navbarBaseAttributes;
26
+ declare const navbarAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof navbarBaseAttributes;
27
27
  export declare const navbarPropsSchema: z.ZodObject<{ [K in keyof typeof navbarAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
28
28
  export declare const mjmlNavbarType: MjmlBlockTypeDefinition<MjmlNavbarNode>;
29
29
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjNavbar.ts
6
7
  const navbarAttributes = {
7
8
  align: "enum(left,center,right)",
8
9
  "base-url": "string",
@@ -55,4 +56,4 @@ const mjmlNavbarType = {
55
56
  tagName: MjmlNodeType.Navbar
56
57
  })
57
58
  };
58
- export { mjmlNavbarType, navbarAttributes, navbarPropsSchema };
59
+ export { mjmlNavbarType, navbarPropsSchema };
@@ -19,7 +19,7 @@ declare const navbarLinkBaseAttributes: {
19
19
  "text-decoration": string;
20
20
  "text-transform": string;
21
21
  };
22
- export declare const navbarLinkAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof navbarLinkBaseAttributes;
22
+ declare const navbarLinkAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof navbarLinkBaseAttributes;
23
23
  export declare const navbarLinkPropsSchema: z.ZodObject<{ [K in keyof typeof navbarLinkAttributes]: MjmlAttributeSchema; } & {
24
24
  content: z.ZodString;
25
25
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { MjmlContentKindSchemaMap } from "../MjmlContentKindSchemaMap.js";
6
6
  import { renderMjmlNode } from "../renderMjmlNode.js";
7
7
  import { z } from "zod";
8
+ // src/services/components/mjNavbarLink.ts
8
9
  const navbarLinkAttributes = {
9
10
  color: "color",
10
11
  "font-family": "string",
@@ -54,4 +55,4 @@ const mjmlNavbarLinkType = {
54
55
  tagName: MjmlNodeType.NavbarLink
55
56
  })
56
57
  };
57
- export { mjmlNavbarLinkType, navbarLinkAttributes, navbarLinkPropsSchema };
58
+ export { mjmlNavbarLinkType, navbarLinkPropsSchema };
@@ -2,10 +2,11 @@ import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlBlockTypeDefinition } from "../../models/MjmlBlockTypeDefinition.js";
3
3
  import { MjmlRawNode } from "../../models/MjmlRawNode.js";
4
4
  import { z } from "zod";
5
- export declare const rawAttributes: {
5
+ declare const rawAttributes: {
6
6
  position: string;
7
7
  };
8
8
  export declare const rawPropsSchema: z.ZodObject<{ [K in keyof typeof rawAttributes]: MjmlAttributeSchema; } & {
9
9
  content: z.ZodString;
10
10
  }, z.core.$strict>;
11
- export declare const mjmlRawType: MjmlBlockTypeDefinition<MjmlRawNode>;
11
+ export declare const mjmlRawType: MjmlBlockTypeDefinition<MjmlRawNode>;
12
+ export {};
@@ -28,4 +28,4 @@ const mjmlRawType = {
28
28
  tagName: MjmlNodeType.Raw
29
29
  })
30
30
  };
31
- export { mjmlRawType, rawAttributes, rawPropsSchema };
31
+ export { mjmlRawType, rawPropsSchema };
@@ -25,7 +25,7 @@ declare const socialBaseAttributes: {
25
25
  "text-padding": string;
26
26
  "vertical-align": string;
27
27
  };
28
- export declare const socialAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof socialBaseAttributes;
28
+ declare const socialAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof socialBaseAttributes;
29
29
  export declare const socialPropsSchema: z.ZodObject<{ [K in keyof typeof socialAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
30
30
  export declare const mjmlSocialType: MjmlBlockTypeDefinition<MjmlSocialNode>;
31
31
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjSocial.ts
6
7
  const socialAttributes = {
7
8
  align: "enum(left,right,center)",
8
9
  border: "string",
@@ -56,4 +57,4 @@ const mjmlSocialType = {
56
57
  tagName: MjmlNodeType.Social
57
58
  })
58
59
  };
59
- export { mjmlSocialType, socialAttributes, socialPropsSchema };
60
+ export { mjmlSocialType, socialPropsSchema };
@@ -32,7 +32,7 @@ declare const socialElementBaseAttributes: {
32
32
  title: string;
33
33
  "vertical-align": string;
34
34
  };
35
- export declare const socialElementAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof socialElementBaseAttributes;
35
+ declare const socialElementAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof socialElementBaseAttributes;
36
36
  export declare const socialElementPropsSchema: z.ZodObject<{ [K in keyof typeof socialElementAttributes]: MjmlAttributeSchema; } & {
37
37
  content: z.ZodString;
38
38
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { MjmlContentKindSchemaMap } from "../MjmlContentKindSchemaMap.js";
6
6
  import { renderMjmlNode } from "../renderMjmlNode.js";
7
7
  import { z } from "zod";
8
+ // src/services/components/mjSocialElement.ts
8
9
  const socialElementAttributes = {
9
10
  align: "enum(left,center,right)",
10
11
  alt: "string",
@@ -72,4 +73,4 @@ const mjmlSocialElementType = {
72
73
  tagName: MjmlNodeType.SocialElement
73
74
  })
74
75
  };
75
- export { mjmlSocialElementType, socialElementAttributes, socialElementPropsSchema };
76
+ export { mjmlSocialElementType, socialElementPropsSchema };
@@ -13,7 +13,7 @@ declare const spacerBaseAttributes: {
13
13
  height: string;
14
14
  padding: string;
15
15
  };
16
- export declare const spacerAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof spacerBaseAttributes;
16
+ declare const spacerAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof spacerBaseAttributes;
17
17
  export declare const spacerPropsSchema: z.ZodObject<{ [K in keyof typeof spacerAttributes]: MjmlAttributeSchema; }, z.core.$strict>;
18
18
  export declare const mjmlSpacerType: MjmlBlockTypeDefinition<MjmlSpacerNode>;
19
19
  export {};
@@ -3,6 +3,7 @@ import { MJML_PADDING_ATTRIBUTES } from "../constants.js";
3
3
  import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
4
4
  import { renderMjmlNode } from "../renderMjmlNode.js";
5
5
  import { z } from "zod";
6
+ // src/services/components/mjSpacer.ts
6
7
  const spacerAttributes = {
7
8
  border: "string",
8
9
  "border-bottom": "string",
@@ -33,4 +34,4 @@ const mjmlSpacerType = {
33
34
  tagName: MjmlNodeType.Spacer
34
35
  })
35
36
  };
36
- export { mjmlSpacerType, spacerAttributes, spacerPropsSchema };
37
+ export { mjmlSpacerType, spacerPropsSchema };
@@ -20,7 +20,7 @@ declare const tableBaseAttributes: {
20
20
  "vertical-align": string;
21
21
  width: string;
22
22
  };
23
- export declare const tableAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof tableBaseAttributes;
23
+ declare const tableAttributes: typeof MJML_PADDING_ATTRIBUTES & typeof tableBaseAttributes;
24
24
  export declare const tablePropsSchema: z.ZodObject<{ [K in keyof typeof tableAttributes]: MjmlAttributeSchema; } & {
25
25
  content: z.ZodString;
26
26
  }, z.core.$strict>;
@@ -5,6 +5,7 @@ import { createMjmlAttributeShape } from "../createMjmlAttributeShape.js";
5
5
  import { MjmlContentKindSchemaMap } from "../MjmlContentKindSchemaMap.js";
6
6
  import { renderMjmlNode } from "../renderMjmlNode.js";
7
7
  import { z } from "zod";
8
+ // src/services/components/mjTable.ts
8
9
  const tableAttributes = {
9
10
  align: "enum(left,right,center)",
10
11
  border: "string",
@@ -57,4 +58,4 @@ const mjmlTableType = {
57
58
  tagName: MjmlNodeType.Table
58
59
  })
59
60
  };
60
- export { mjmlTableType, tableAttributes, tablePropsSchema };
61
+ export { mjmlTableType, tablePropsSchema };
@@ -2,12 +2,7 @@ import { MjmlAttributeSchema } from "../../models/MjmlAttributeSchema.js";
2
2
  import { MjmlBlockTypeDefinition } from "../../models/MjmlBlockTypeDefinition.js";
3
3
  import { MjmlWrapperNode } from "../../models/MjmlWrapperNode.js";
4
4
  import { sectionPropsSchema } from "./mjSection.js";
5
- import { sectionAttributes } from "./sectionAttributes.js";
6
5
  import { z } from "zod";
7
- export declare const wrapperGapAttributes: {
8
- gap: string;
9
- };
10
- export declare const wrapperAttributes: typeof sectionAttributes.allowedAttributes & typeof wrapperGapAttributes;
11
6
  export declare const wrapperPropsSchema: z.ZodObject<typeof sectionPropsSchema.shape & {
12
7
  gap: MjmlAttributeSchema;
13
8
  }, z.core.$strict>;
@@ -36,4 +36,4 @@ const mjmlWrapperType = {
36
36
  tagName: MjmlNodeType.Wrapper
37
37
  })
38
38
  };
39
- export { mjmlWrapperType, wrapperAttributes, wrapperGapAttributes, wrapperPropsSchema };
39
+ export { mjmlWrapperType, wrapperPropsSchema };
@@ -6,8 +6,8 @@ export declare const MJML_NAME_MAX_LENGTH = 64;
6
6
  export declare const MJML_VALUE_MAX_LENGTH = 2048;
7
7
  export declare const MJML_CONTENT_MAX_LENGTH = 1e5;
8
8
  export declare const MJML_ROOT_LIST_MAX_LENGTH = 100;
9
- export declare const EXCLUDED_MJML_TAGS: string[];
10
9
  export declare const MJML_BODY_ATTRIBUTES: Record<string, string>;
10
+ export declare const MJML_DEFAULT_BODY_WIDTH = "600px";
11
11
  export declare const MJML_BODY_CHILDREN: MjmlNodeType[];
12
12
  export declare const MJML_BREAKPOINT_ATTRIBUTES: Record<string, string>;
13
13
  export declare const MJML_PADDING_ATTRIBUTES: {
@@ -12,16 +12,12 @@ const MJML_NAME_MAX_LENGTH = 64;
12
12
  const MJML_VALUE_MAX_LENGTH = 2048;
13
13
  const MJML_CONTENT_MAX_LENGTH = 1e5;
14
14
  const MJML_ROOT_LIST_MAX_LENGTH = 100;
15
- const EXCLUDED_MJML_TAGS = [
16
- "mj-include",
17
- "mj-html-attributes",
18
- "mj-class"
19
- ];
20
15
  const MJML_BODY_ATTRIBUTES = {
21
16
  "background-color": "color",
22
17
  id: "string",
23
18
  width: "unit(px)"
24
19
  };
20
+ const MJML_DEFAULT_BODY_WIDTH = "600px";
25
21
  const MJML_BODY_CHILDREN = [
26
22
  MjmlNodeType.Raw,
27
23
  MjmlNodeType.Section,
@@ -204,4 +200,4 @@ const MJML_HEAD_TEXT_TAGS = [
204
200
  ];
205
201
  const STRAY_TEXT_TYPE = "#text";
206
202
  const STRAY_ID_ATTRIBUTE_KEY = "#id";
207
- export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, EXCLUDED_MJML_TAGS, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE };
203
+ export { ALLOWED_URL_SCHEMES, ALL_ATTRIBUTES_KEY, DIRECTION_ATTRIBUTE_KEY, MJML_BODY_ATTRIBUTES, MJML_BODY_CHILDREN, MJML_BREAKPOINT_ATTRIBUTES, MJML_COLOR_MATCHERS, MJML_CONTENT_MAX_LENGTH, MJML_DEFAULT_BODY_WIDTH, MJML_HEAD_SINGLE_TAGS, MJML_HEAD_TEXT_TAGS, MJML_NAME_MAX_LENGTH, MJML_PADDING_ATTRIBUTES, MJML_ROOT_LIST_MAX_LENGTH, MJML_VALUE_MAX_LENGTH, STRAY_ID_ATTRIBUTE_KEY, STRAY_TEXT_TYPE };
@@ -1,6 +1,6 @@
1
1
  import { MjmlDocument } from "../models/MjmlDocument.js";
2
2
  import { MjmlNode } from "../models/MjmlNode.js";
3
3
  import { MjmlRegistry } from "../models/MjmlRegistry.js";
4
- import { z } from "zod";
5
4
  import { BlockDocumentInput } from "vue-block-editor-headless";
5
+ import { z } from "zod";
6
6
  export declare const createMjmlDocumentSchema: <TContext>(registry: MjmlRegistry<TContext>, bodyChildrenSchema: z.ZodType<MjmlNode>, maxNodes: number) => z.ZodType<MjmlDocument, BlockDocumentInput>;
@@ -1,11 +1,12 @@
1
1
  import { allowedAddressSchema } from "./allowedAddressSchema.js";
2
2
  import { checkMjmlAttributeValues } from "./checkMjmlAttributeValues.js";
3
3
  import { MJML_BODY_ATTRIBUTES, MJML_BREAKPOINT_ATTRIBUTES } from "./constants.js";
4
+ import { getFilledMjmlAttributes } from "./getFilledMjmlAttributes.js";
4
5
  import { getMjmlAttributeSchema } from "./getMjmlAttributeSchema.js";
5
6
  import { mjmlRootPropsSchema } from "./mjmlRootPropsSchema.js";
6
7
  // src/services/createMjmlRootPropsSchema.ts
7
8
  const createMjmlRootPropsSchema = (definitions) => mjmlRootPropsSchema.superRefine((props, context) => {
8
- checkMjmlAttributeValues(props.body ?? {}, MJML_BODY_ATTRIBUTES, ["body"], context);
9
+ checkMjmlAttributeValues(getFilledMjmlAttributes(props.body ?? {}), MJML_BODY_ATTRIBUTES, ["body"], context);
9
10
  if (props.breakpoint) checkMjmlAttributeValues(props.breakpoint, MJML_BREAKPOINT_ATTRIBUTES, ["breakpoint"], context);
10
11
  for (const [index, font] of (props.fonts ?? []).entries()) {
11
12
  const result = allowedAddressSchema.safeParse(font.href);
@@ -1,5 +1,5 @@
1
- import { z } from "zod";
2
1
  import { createAcceptedTypesError } from "vue-block-editor-headless";
2
+ import { z } from "zod";
3
3
  // src/services/createMjmlSlotSchema.ts
4
4
  const createMjmlSlotSchema = (branches) => z.discriminatedUnion("type", branches, createAcceptedTypesError(branches.flatMap((branch) => [...branch.shape.type.values]).toSorted()));
5
5
  export { createMjmlSlotSchema };
@@ -0,0 +1 @@
1
+ export declare const getFilledMjmlAttributes: (attributes: Record<string, string>) => Record<string, string>;
@@ -0,0 +1,3 @@
1
+ // src/services/getFilledMjmlAttributes.ts
2
+ const getFilledMjmlAttributes = (attributes) => Object.fromEntries(Object.entries(attributes).filter(([, value]) => value));
3
+ export { getFilledMjmlAttributes };
@@ -11,11 +11,11 @@ export declare const mjmlRootPropsSchema: z.ZodObject<{
11
11
  href: z.ZodString;
12
12
  name: z.ZodString;
13
13
  }, z.core.$strict>>>;
14
- lang: z.ZodOptional<z.ZodString>;
14
+ lang: z.ZodString;
15
15
  preview: z.ZodOptional<z.ZodString>;
16
16
  styles: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
17
  css: z.ZodString;
18
18
  inline: z.ZodBoolean;
19
19
  }, z.core.$strict>>>;
20
- title: z.ZodOptional<z.ZodString>;
20
+ title: z.ZodString;
21
21
  }, z.core.$strict>;
@@ -14,12 +14,12 @@ const mjmlRootPropsSchema = z.strictObject({
14
14
  href: rootValue,
15
15
  name: rootName
16
16
  })).max(100).optional(),
17
- lang: rootName.optional(),
17
+ lang: rootName,
18
18
  preview: rootValue.optional(),
19
19
  styles: z.array(z.strictObject({
20
20
  css: z.string().max(MJML_CONTENT_MAX_LENGTH).refine((css) => !css.includes("<"), { error: "holds a < that could close its element" }),
21
21
  inline: z.boolean()
22
22
  })).max(100).optional(),
23
- title: rootValue.optional()
23
+ title: rootValue
24
24
  });
25
25
  export { mjmlRootPropsSchema };
@@ -1,6 +1,7 @@
1
1
  import { MJML_HEAD_TEXT_TAGS } from "./constants.js";
2
2
  import { createMjmlDocumentSchema } from "./createMjmlDocumentSchema.js";
3
3
  import { readMjmlRoot } from "./readMjmlRoot.js";
4
+ import { readMjmlRootProps } from "./readMjmlRootProps.js";
4
5
  import { readMjmlTopLevel } from "./readMjmlTopLevel.js";
5
6
  import { parse } from "node-html-parser";
6
7
  // src/services/parseMjmlDocument.ts
@@ -15,7 +16,7 @@ const parseMjmlDocument = (source, registry, bodyChildrenSchema, richText, maxNo
15
16
  const topLevelEntries = readMjmlTopLevel(root);
16
17
  const candidate = mjml?.rawTagName === "mjml" && topLevelEntries.length === 0 ? readMjmlRoot(mjml, registry, richText) : {
17
18
  content: [],
18
- root: { props: Object.fromEntries(topLevelEntries) }
19
+ root: { props: readMjmlRootProps(topLevelEntries) }
19
20
  };
20
21
  return createMjmlDocumentSchema(registry, bodyChildrenSchema, maxNodes).safeParse(candidate);
21
22
  };
@@ -1,5 +1,5 @@
1
1
  import { MjmlRichText } from "../models/MjmlRichText.js";
2
2
  import { MjmlRichTextDefinition } from "../models/MjmlRichTextDefinition.js";
3
- import { MjmlContentKind } from "../models/MjmlContentKind.js";
4
3
  import { HTMLElement } from "node-html-parser";
4
+ import { MjmlContentKind } from "../models/MjmlContentKind.js";
5
5
  export declare const readMjmlContent: <TContent extends MjmlRichText>(element: HTMLElement, contentKind: MjmlContentKind, richText: MjmlRichTextDefinition<TContent>) => unknown;
@@ -1,8 +1,8 @@
1
1
  import "./constants.js";
2
2
  import { getMjmlRefusalKey } from "./getMjmlRefusalKey.js";
3
3
  import { readMjmlContent } from "./readMjmlContent.js";
4
- import { getBlockTypeDefinition } from "vue-block-editor-headless";
5
4
  import { v7 } from "uuid";
5
+ import { getBlockTypeDefinition } from "vue-block-editor-headless";
6
6
  // src/services/readMjmlNode.ts
7
7
  const readMjmlNode = (element, registry, richText, readChildNodes) => {
8
8
  const type = element.rawTagName;
@@ -3,6 +3,7 @@ import "./constants.js";
3
3
  import { getMjmlRefusalKey } from "./getMjmlRefusalKey.js";
4
4
  import { readMjmlHead } from "./readMjmlHead.js";
5
5
  import { readMjmlNodes } from "./readMjmlNodes.js";
6
+ import { readMjmlRootProps } from "./readMjmlRootProps.js";
6
7
  import { readMjmlStrayText } from "./readMjmlStrayText.js";
7
8
  // src/services/readMjmlRoot.ts
8
9
  const readMjmlRoot = (mjml, registry, richText) => {
@@ -33,7 +34,7 @@ const readMjmlRoot = (mjml, registry, richText) => {
33
34
  }
34
35
  return {
35
36
  content,
36
- root: { props: Object.fromEntries(entries) }
37
+ root: { props: readMjmlRootProps(entries) }
37
38
  };
38
39
  };
39
40
  export { readMjmlRoot };
@@ -0,0 +1 @@
1
+ export declare const readMjmlRootProps: (entries: [string, unknown][]) => Record<string, unknown>;
@@ -0,0 +1,7 @@
1
+ // src/services/readMjmlRootProps.ts
2
+ const readMjmlRootProps = (entries) => ({
3
+ lang: "",
4
+ title: "",
5
+ ...Object.fromEntries(entries)
6
+ });
7
+ export { readMjmlRootProps };
@@ -1,5 +1,6 @@
1
1
  import "./constants.js";
2
2
  import { escapeMjmlAttributes } from "./escapeMjmlAttributes.js";
3
+ import { getFilledMjmlAttributes } from "./getFilledMjmlAttributes.js";
3
4
  import { renderMjmlHead } from "./renderMjmlHead.js";
4
5
  import { stampNode } from "./stampNode.js";
5
6
  import { renderBlockNodes } from "vue-block-editor-headless";
@@ -12,7 +13,7 @@ const renderMjmlDocument = (document, registry, options) => {
12
13
  });
13
14
  const head = renderMjmlHead(rootProps);
14
15
  const rootAttributes = {};
15
- if (rootProps.lang !== void 0) rootAttributes.lang = rootProps.lang;
16
+ if (rootProps.lang) rootAttributes.lang = rootProps.lang;
16
17
  if (rootProps.direction !== void 0) rootAttributes["dir"] = rootProps.direction;
17
18
  return {
18
19
  attributes: escapeMjmlAttributes(rootAttributes),
@@ -21,7 +22,7 @@ const renderMjmlDocument = (document, registry, options) => {
21
22
  children: head,
22
23
  tagName: "mj-head"
23
24
  }] : [], {
24
- attributes: escapeMjmlAttributes(rootProps.body ?? {}),
25
+ attributes: escapeMjmlAttributes(getFilledMjmlAttributes(rootProps.body ?? {})),
25
26
  children: content,
26
27
  tagName: "mj-body"
27
28
  }],
@@ -3,7 +3,7 @@ import { escapeText } from "@esposter/shared";
3
3
  // src/services/renderMjmlHead.ts
4
4
  const renderMjmlHead = (rootProps) => {
5
5
  const head = [];
6
- if (rootProps.title !== void 0) head.push({
6
+ if (rootProps.title) head.push({
7
7
  attributes: {},
8
8
  content: escapeText(rootProps.title),
9
9
  tagName: "mj-title"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mjml-blocks",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "MJML's components as block types on the headless block editor — each component's attributes, defaults and nesting rules, a render to MJML's JSON form and source, and a read back from MJML, with no framework, DOM or MJML runtime.",
5
5
  "keywords": [
6
6
  "block-editor",
@@ -44,14 +44,14 @@
44
44
  "typecheck": "tsrs --fast"
45
45
  },
46
46
  "dependencies": {
47
- "@esposter/shared": "4.12.0",
47
+ "@esposter/shared": "4.13.0",
48
48
  "node-html-parser": "^9.0.7",
49
49
  "uuid": "^14.0.3",
50
- "vue-block-editor-headless": "4.12.0"
50
+ "vue-block-editor-headless": "4.13.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@esposter/configuration": "4.12.0",
54
- "@esposter/shared-node": "4.12.0",
53
+ "@esposter/configuration": "4.13.0",
54
+ "@esposter/shared-node": "4.13.0",
55
55
  "@types/mjml": "^5.4.2",
56
56
  "mjml": "^5.4.1",
57
57
  "mjml-preset-core": "^5.4.1",
@@ -60,5 +60,5 @@
60
60
  "peerDependencies": {
61
61
  "zod": "^4.6.7"
62
62
  },
63
- "gitHead": "6667a4a1664bf5282bec24f4c7e6d30f2c4789de"
63
+ "gitHead": "d60ae90f266ad504f7c584ccf1103a8a8cbd1f04"
64
64
  }