@makeswift/runtime 0.10.3 → 0.10.5

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 (148) hide show
  1. package/dist/Box.cjs.js +1 -3
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +4 -4
  6. package/dist/Button.es.js +5 -5
  7. package/dist/Carousel.cjs.js +3 -3
  8. package/dist/Carousel.es.js +4 -4
  9. package/dist/Countdown.cjs.js +1 -3
  10. package/dist/Countdown.cjs.js.map +1 -1
  11. package/dist/Countdown.es.js +2 -4
  12. package/dist/Countdown.es.js.map +1 -1
  13. package/dist/Divider.cjs.js +1 -3
  14. package/dist/Divider.cjs.js.map +1 -1
  15. package/dist/Divider.es.js +2 -4
  16. package/dist/Divider.es.js.map +1 -1
  17. package/dist/Embed.cjs.js +1 -0
  18. package/dist/Embed.cjs.js.map +1 -1
  19. package/dist/Embed.es.js +2 -1
  20. package/dist/Embed.es.js.map +1 -1
  21. package/dist/Form.cjs.js +13 -13
  22. package/dist/Form.cjs.js.map +1 -1
  23. package/dist/Form.es.js +5 -5
  24. package/dist/Image.cjs.js +13 -13
  25. package/dist/Image.cjs.js.map +1 -1
  26. package/dist/Image.es.js +13 -13
  27. package/dist/LiveProvider.cjs.js +1 -3
  28. package/dist/LiveProvider.cjs.js.map +1 -1
  29. package/dist/LiveProvider.es.js +3 -5
  30. package/dist/LiveProvider.es.js.map +1 -1
  31. package/dist/Navigation.cjs.js +12 -12
  32. package/dist/Navigation.cjs.js.map +1 -1
  33. package/dist/Navigation.es.js +12 -12
  34. package/dist/PreviewProvider.cjs.js +1 -3
  35. package/dist/PreviewProvider.cjs.js.map +1 -1
  36. package/dist/PreviewProvider.es.js +3 -5
  37. package/dist/PreviewProvider.es.js.map +1 -1
  38. package/dist/ReadOnlyText.cjs.js +7 -6
  39. package/dist/ReadOnlyText.cjs.js.map +1 -1
  40. package/dist/ReadOnlyText.es.js +4 -3
  41. package/dist/ReadOnlyText.es.js.map +1 -1
  42. package/dist/ReadOnlyTextV2.cjs.js +7 -60
  43. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  44. package/dist/ReadOnlyTextV2.es.js +9 -62
  45. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  46. package/dist/Root.cjs.js +1 -3
  47. package/dist/Root.cjs.js.map +1 -1
  48. package/dist/Root.es.js +2 -4
  49. package/dist/Root.es.js.map +1 -1
  50. package/dist/SocialLinks.cjs.js +6 -6
  51. package/dist/SocialLinks.cjs.js.map +1 -1
  52. package/dist/SocialLinks.es.js +7 -7
  53. package/dist/Video.cjs.js +1 -0
  54. package/dist/Video.cjs.js.map +1 -1
  55. package/dist/Video.es.js +2 -1
  56. package/dist/Video.es.js.map +1 -1
  57. package/dist/builder.cjs.js +1 -0
  58. package/dist/builder.cjs.js.map +1 -1
  59. package/dist/builder.es.js +1 -0
  60. package/dist/builder.es.js.map +1 -1
  61. package/dist/components.cjs.js +3 -3
  62. package/dist/components.es.js +3 -3
  63. package/dist/control-serialization.es.js +1 -1
  64. package/dist/controls.cjs.js +1 -0
  65. package/dist/controls.cjs.js.map +1 -1
  66. package/dist/controls.es.js +2 -1
  67. package/dist/controls.es.js.map +1 -1
  68. package/dist/index.cjs.js +120 -256
  69. package/dist/index.cjs.js.map +1 -1
  70. package/dist/index.cjs3.js +107 -21
  71. package/dist/index.cjs3.js.map +1 -1
  72. package/dist/index.cjs4.js +57 -16
  73. package/dist/index.cjs4.js.map +1 -1
  74. package/dist/index.cjs5.js +42 -81
  75. package/dist/index.cjs5.js.map +1 -1
  76. package/dist/index.cjs6.js +82 -17
  77. package/dist/index.cjs6.js.map +1 -1
  78. package/dist/index.cjs7.js +18 -377
  79. package/dist/index.cjs7.js.map +1 -1
  80. package/dist/index.cjs8.js +258 -181
  81. package/dist/index.cjs8.js.map +1 -1
  82. package/dist/index.cjs9.js +343 -0
  83. package/dist/index.cjs9.js.map +1 -0
  84. package/dist/index.es.js +125 -260
  85. package/dist/index.es.js.map +1 -1
  86. package/dist/index.es2.js +1 -1
  87. package/dist/index.es3.js +103 -22
  88. package/dist/index.es3.js.map +1 -1
  89. package/dist/index.es4.js +57 -16
  90. package/dist/index.es4.js.map +1 -1
  91. package/dist/index.es5.js +42 -80
  92. package/dist/index.es5.js.map +1 -1
  93. package/dist/index.es6.js +81 -17
  94. package/dist/index.es6.js.map +1 -1
  95. package/dist/index.es7.js +18 -371
  96. package/dist/index.es7.js.map +1 -1
  97. package/dist/index.es8.js +259 -182
  98. package/dist/index.es8.js.map +1 -1
  99. package/dist/index.es9.js +336 -0
  100. package/dist/index.es9.js.map +1 -0
  101. package/dist/main.cjs.js +1 -0
  102. package/dist/main.cjs.js.map +1 -1
  103. package/dist/main.es.js +1 -0
  104. package/dist/main.es.js.map +1 -1
  105. package/dist/next.cjs.js +1 -3
  106. package/dist/next.cjs.js.map +1 -1
  107. package/dist/next.es.js +2 -4
  108. package/dist/next.es.js.map +1 -1
  109. package/dist/prop-controllers.cjs.js +1 -0
  110. package/dist/prop-controllers.cjs.js.map +1 -1
  111. package/dist/prop-controllers.es.js +1 -0
  112. package/dist/prop-controllers.es.js.map +1 -1
  113. package/dist/react-page.cjs.js +26 -6
  114. package/dist/react-page.cjs.js.map +1 -1
  115. package/dist/react-page.es.js +26 -7
  116. package/dist/react-page.es.js.map +1 -1
  117. package/dist/react.cjs.js +1 -3
  118. package/dist/react.cjs.js.map +1 -1
  119. package/dist/react.es.js +1 -3
  120. package/dist/react.es.js.map +1 -1
  121. package/dist/slate.cjs.js +9 -6
  122. package/dist/slate.cjs.js.map +1 -1
  123. package/dist/slate.es.js +9 -7
  124. package/dist/slate.es.js.map +1 -1
  125. package/dist/toText.cjs.js +67 -0
  126. package/dist/toText.cjs.js.map +1 -0
  127. package/dist/toText.es.js +66 -0
  128. package/dist/toText.es.js.map +1 -0
  129. package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
  130. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +2 -4
  131. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  132. package/dist/types/src/next/api-handler/handlers/fonts.d.ts +1 -0
  133. package/dist/types/src/next/api-handler/handlers/fonts.d.ts.map +1 -1
  134. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  135. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
  136. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts +10 -0
  137. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/usePresetValue.d.ts.map +1 -0
  138. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  139. package/dist/types/src/slate/BuilderPlugin/index.d.ts +2 -1
  140. package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -1
  141. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  142. package/dist/types/src/slate/index.d.ts +1 -0
  143. package/dist/types/src/slate/index.d.ts.map +1 -1
  144. package/dist/types/src/slate/utils/index.d.ts +2 -0
  145. package/dist/types/src/slate/utils/index.d.ts.map +1 -0
  146. package/dist/types/src/slate/utils/toText.d.ts +4 -0
  147. package/dist/types/src/slate/utils/toText.d.ts.map +1 -0
  148. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/runtimes/react/controls/rich-text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { richTextDTOtoDAO } from '../../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport { useStyle } from '../../use-style'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\nimport { Link } from '../../../../components/shared/Link'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div\n ref={ref}\n id={id}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n className={cx(width, margin)}\n >\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link ?? undefined}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Default:\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n default:\n return null\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","position","whiteSpace","wordWrap","cx","_jsx","useStyle","display","maxWidth","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","undefined","blockStyles","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Default","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBMA,MAAAA,eAAeC,MAAAA,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,UAAAA,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,wCAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MAMLI,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAX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C,WAAD,CAAzD,EAAuE8C,KAAK,EAA5E,MAAA9C,YAAmF;AAAA,SACvFyB,UAAAA,UAAUG;AAAAA,SACVH,UAAAA,UAAUI;AAAAA,SACVJ,UAAAA,UAAUK;AAAAA,SACVL,UAAAA,UAAUM;AAAAA,SACVN,UAAAA,UAAUO;AAAAA,SACVP,UAAAA,UAAUQ;AAAAA,SACVR,UAAAA,UAAUS;AAAAA,SACVT,UAAAA,UAAUE;AAAAA,SACVF,UAAAA,UAAUC;AAAAA,SACVD,UAAAA,UAAUU;AAAAA,SACVV,UAAAA,UAAUY;AAAAA,SACVZ,UAAAA,UAAUa;AAAAA,SACVb,UAAUc,UAAAA;AAEXvC,aAAAA,iBAAWW,SACR+B,IAAI1C,CAAc6C,gBAAAA,oBAAoB7C,WAAD,CADxC,EAEG8C,KAAK9C,WAAWW,SAASoC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAhD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW0C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
1
+ {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/runtimes/react/controls/rich-text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { richTextDTOtoDAO } from '../../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport { useStyle } from '../../use-style'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\nimport { Link } from '../../../../components/shared/Link'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div\n ref={ref}\n id={id}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n className={cx(width, margin)}\n >\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link ?? undefined}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Default:\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n default:\n return null\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","position","whiteSpace","wordWrap","cx","_jsx","useStyle","display","maxWidth","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","undefined","blockStyles","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Default","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBMA,MAAAA,eAAeC,MAAAA,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,UAAAA,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,wCAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MAMLI,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAXd;AAAA,IAaE,WAAWC,IAAAA,GAAGV,OAAOC,MAAR;AAAA,IAEZI,UAAAA,wBAAwB,KAAKM,2BAAA,IAAC,aAAD,EAAA,IAAkBA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAhBpD;AAmBD,CA1B8B;AA8B/B,qBAA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AUQ;AAAAA,SACVR,UAAAA,UAAUS;AAAAA,SACVT,UAAAA,UAAUE;AAAAA,SACVF,UAAAA,UAAUC;AAAAA,SACVD,UAAAA,UAAUU;AAAAA,SACVV,UAAAA,UAAUY;AAAAA,SACVZ,UAAAA,UAAUa;AAAAA,SACVb,UAAUc,UAAAA;AAEXvC,aAAAA,iBAAWW,SACR+B,IAAI1C,CAAc6C,gBAAAA,oBAAoB7C,WAAD,CADxC,EAEG8C,KAAK9C,WAAWW,SAASoC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAhD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW0C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { cx } from "@emotion/css";
2
2
  import { forwardRef } from "react";
3
- import { J as useEnhancedTypography, K as useTypographyClassName, n as useResponsiveStyle, L as Link } from "./index.es.js";
4
- import { bo as richTextDTOtoDAO, _ as useStyle, Y as BlockType, bO as InlineType } from "./react-page.es.js";
3
+ import { L as useEnhancedTypography, N as useTypographyClassName, n as useResponsiveStyle } from "./index.es.js";
4
+ import { bn as richTextDTOtoDAO, Z as useStyle, bN as BlockType, bO as InlineType } from "./react-page.es.js";
5
5
  import "./actions.es.js";
6
6
  import "slate";
7
7
  import "uuid";
@@ -9,6 +9,7 @@ import "./state/breakpoints.es.js";
9
9
  import "is-hotkey";
10
10
  import { jsx, Fragment } from "react/jsx-runtime";
11
11
  import "slate-react";
12
+ import { L as Link } from "./index.es3.js";
12
13
  import "use-sync-external-store/shim/with-selector";
13
14
  import "next/dynamic";
14
15
  import "./text-input.es.js";
@@ -34,9 +35,9 @@ import "http-proxy";
34
35
  import "set-cookie-parser";
35
36
  import "./constants.es.js";
36
37
  import "corporate-ipsum";
37
- import "next/link";
38
38
  import "@emotion/serialize";
39
39
  import "@emotion/utils";
40
+ import "next/link";
40
41
  const ReadOnlyText = forwardRef(function ReadOnlyText2({
41
42
  id,
42
43
  text,
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/runtimes/react/controls/rich-text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { richTextDTOtoDAO } from '../../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport { useStyle } from '../../use-style'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\nimport { Link } from '../../../../components/shared/Link'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div\n ref={ref}\n id={id}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n className={cx(width, margin)}\n >\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link ?? undefined}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Default:\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n default:\n return null\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","position","whiteSpace","wordWrap","cx","_jsx","useStyle","display","maxWidth","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","undefined","blockStyles","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Default","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA,SACVR,UAAUS;AAAAA,SACVT,UAAUE;AAAAA,SACVF,UAAUC;AAAAA,SACVD,UAAUU;AAAAA,SACVV,UAAUY;AAAAA,SACVZ,UAAUa;AAAAA,SACVb,UAAUc;AAEXvC,aAAAA,iBAAWW,SACR+B,IAAI1C,CAAc6C,gBAAAA,oBAAoB7C,WAAD,CADxC,EAEG8C,KAAK9C,WAAWW,SAASoC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAhD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW0C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
1
+ {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/runtimes/react/controls/rich-text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { richTextDTOtoDAO } from '../../../../controls'\nimport type { ElementIDValue, RichTextValue } from '../../../../prop-controllers/descriptors'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport { useStyle } from '../../use-style'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\nimport { Link } from '../../../../components/shared/Link'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst ReadOnlyText = forwardRef(function ReadOnlyText(\n { id, text, width, margin }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendants = text == null ? [] : richTextDTOtoDAO(text)\n const descendantsAsString = getText(descendants)\n\n return (\n <div\n ref={ref}\n id={id}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n className={cx(width, margin)}\n >\n {descendantsAsString === '' ? <Placeholder /> : <Descendants descendants={descendants} />}\n </div>\n )\n})\n\nexport default ReadOnlyText\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\nexport interface TextProps {\n descendant: Text\n}\n\nexport function TextElement({ descendant }: TextProps) {\n const enhancedTypography = useEnhancedTypography(descendant.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n\n return (\n <span className={typographyClassName}>\n {descendant.text === '' ? '\\uFEFF' : descendant.text}\n </span>\n )\n}\n\nexport interface InlineProps {\n descendant: Inline\n}\n\nfunction InlineElement({ descendant }: InlineProps) {\n const linkClassName = useStyle({ textDecoration: 'none' })\n\n switch (descendant.type) {\n case InlineType.Code:\n return (\n <code>\n <Descendants descendants={descendant.children} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link ?? undefined}>\n <Descendants descendants={descendant.children} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n}\n\nexport function BlockElement({ descendant }: BlockProps) {\n const blockStyles = [\n useStyle({ margin: 0 }),\n useStyle(useResponsiveStyle([descendant.textAlign], ([textAlign = 'left']) => ({ textAlign }))),\n ]\n const quoteStyle = useStyle({\n padding: '0.5em 10px',\n fontSize: '1.25em',\n fontWeight: '300',\n borderLeft: '5px solid rgba(0, 0, 0, 0.1)',\n })\n\n switch (descendant.type) {\n case BlockType.Default:\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\n default:\n return null\n }\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: any): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({ descendants }: { descendants: Descendant[] }) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <TextElement key={index} descendant={descendant} />\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return <InlineElement key={index} descendant={descendant} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} />\n default:\n return null\n }\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if ('text' in descendant) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if ('text' in descendant) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return descendant.children.map(descendant => getTextByDescendant(descendant)).join('') ?? ''\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[]): string {\n return descendant.map(getTextByDescendant).join('\\n')\n}\n"],"names":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","position","whiteSpace","wordWrap","cx","_jsx","useStyle","display","maxWidth","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","undefined","blockStyles","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Default","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBMA,MAAAA,eAAeC,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,6BAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MAMLI,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAXd;AAAA,IAaE,WAAWC,GAAGV,OAAOC,MAAR;AAAA,IAEZI,UAAAA,wBAAwB,KAAKM,oBAAC,aAAD,EAAA,IAAkBA,oBAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAhBpD;AAmBD,CA1B8B;AA8B/B,qBAAqB;AAAA,EAAEZ,OAAO;AAAA,GAA2C;AAErE,6BAAA,QAAA;AAAA,IACE,WAAWa,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTb,OAAO;AAAA,MACPc,UAAU;AAAA,MACVN,YAAY;AAAA,MACZO,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBjB,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEkB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAA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AA,EAC3B;AAEOA,UAAAA,WAAWQ;AAAAA,SACZC,WAAWK;AAAAA,SACXL,WAAWC;AAAAA,SACXD,WAAWI;AAAAA,SACXJ,WAAWG;AACPZ,aAAAA,iBAAWW,SAAS+B,IAAI1C,CAAc6C,gBAAAA,oBAAoB7C,WAAD,CAAzD,EAAuE8C,KAAK,EAA5E,MAAA9C,YAAmF;AAAA,SACvFyB,UAAUG;AAAAA,SACVH,UAAUI;AAAAA,SACVJ,UAAUK;AAAAA,SACVL,UAAUM;AAAAA,SACVN,UAAUO;AAAAA,SACVP,UAAUQ;AAAAA,SACVR,UAAUS;AAAAA,SACVT,UAAUE;AAAAA,SACVF,UAAUC;AAAAA,SACVD,UAAUU;AAAAA,SACVV,UAAUY;AAAAA,SACVZ,UAAUa;AAAAA,SACVb,UAAUc;AAEXvC,aAAAA,iBAAWW,SACR+B,IAAI1C,CAAc6C,gBAAAA,oBAAoB7C,WAAD,CADxC,EAEG8C,KAAK9C,WAAWW,SAASoC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAhD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW0C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
@@ -21,17 +21,22 @@ require("./actions.cjs.js");
21
21
  require("slate");
22
22
  require("uuid");
23
23
  require("slate-react");
24
- var index = require("./index.cjs5.js");
24
+ var index = require("./index.cjs6.js");
25
+ var toText = require("./toText.cjs.js");
25
26
  var next = require("./index.cjs.js");
26
27
  var jsxRuntime = require("react/jsx-runtime");
27
28
  require("redux");
28
29
  require("redux-thunk");
29
30
  require("./state/breakpoints.cjs.js");
30
31
  require("zod");
32
+ require("corporate-ipsum");
31
33
  require("@emotion/css");
32
34
  require("@emotion/serialize");
33
35
  require("@emotion/utils");
34
36
  require("is-hotkey");
37
+ require("./index.cjs3.js");
38
+ require("scroll-into-view-if-needed");
39
+ require("next/link");
35
40
  require("use-sync-external-store/shim/with-selector");
36
41
  require("next/dynamic");
37
42
  require("./text-input.cjs.js");
@@ -41,7 +46,6 @@ require("./types.cjs.js");
41
46
  require("./box-models.cjs.js");
42
47
  require("css-box-model");
43
48
  require("color");
44
- require("scroll-into-view-if-needed");
45
49
  require("react-dom");
46
50
  require("html-react-parser");
47
51
  require("next/head");
@@ -53,8 +57,6 @@ require("cookie");
53
57
  require("http-proxy");
54
58
  require("set-cookie-parser");
55
59
  require("./constants.cjs.js");
56
- require("corporate-ipsum");
57
- require("next/link");
58
60
  const ReadOnlyTextV2 = React.forwardRef(function ReadOnlyText({
59
61
  text: {
60
62
  descendants
@@ -62,7 +64,7 @@ const ReadOnlyTextV2 = React.forwardRef(function ReadOnlyText({
62
64
  definition
63
65
  }, ref) {
64
66
  var _a, _b;
65
- const descendantsAsString = getText(descendants, (_a = definition == null ? void 0 : definition.config.mode) != null ? _a : reactPage.RichTextV2Mode.Block);
67
+ const descendantsAsString = toText.toText(descendants, (_a = definition == null ? void 0 : definition.config.mode) != null ? _a : reactPage.RichTextV2Mode.Block);
66
68
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
67
69
  ref,
68
70
  style: {
@@ -184,61 +186,6 @@ function Descendants({
184
186
  })
185
187
  });
186
188
  }
187
- function isBlock(descendant) {
188
- if (isText(descendant))
189
- return false;
190
- switch (descendant.type) {
191
- case reactPage.BlockType.Heading1:
192
- case reactPage.BlockType.Heading2:
193
- case reactPage.BlockType.Heading3:
194
- case reactPage.BlockType.Heading4:
195
- case reactPage.BlockType.Heading5:
196
- case reactPage.BlockType.Heading6:
197
- case reactPage.BlockType.BlockQuote:
198
- case reactPage.BlockType.Paragraph:
199
- case reactPage.BlockType.Default:
200
- case reactPage.BlockType.OrderedList:
201
- case reactPage.BlockType.UnorderedList:
202
- case reactPage.BlockType.ListItem:
203
- case reactPage.BlockType.ListItemChild:
204
- return true;
205
- default:
206
- return false;
207
- }
208
- }
209
- function getTextByDescendant(descendant, mode) {
210
- var _a, _b, _c, _d, _e;
211
- if (isText(descendant)) {
212
- return (_a = descendant.text) != null ? _a : "";
213
- }
214
- switch (descendant.type) {
215
- case reactPage.BlockType.Default:
216
- return mode === reactPage.RichTextV2Mode.Inline ? (_b = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join("")) != null ? _b : "" : (_c = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _c : "";
217
- case reactPage.InlineType.Link:
218
- case reactPage.InlineType.Code:
219
- case reactPage.InlineType.SubScript:
220
- case reactPage.InlineType.SuperScript:
221
- return (_d = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join("")) != null ? _d : "";
222
- case reactPage.BlockType.Heading1:
223
- case reactPage.BlockType.Heading2:
224
- case reactPage.BlockType.Heading3:
225
- case reactPage.BlockType.Heading4:
226
- case reactPage.BlockType.Heading5:
227
- case reactPage.BlockType.Heading6:
228
- case reactPage.BlockType.BlockQuote:
229
- case reactPage.BlockType.Paragraph:
230
- case reactPage.BlockType.OrderedList:
231
- case reactPage.BlockType.UnorderedList:
232
- case reactPage.BlockType.ListItem:
233
- case reactPage.BlockType.ListItemChild:
234
- return (_e = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _e : "";
235
- default:
236
- return "";
237
- }
238
- }
239
- function getText(descendant, mode) {
240
- return descendant.map((node) => getTextByDescendant(node, mode)).join("\n");
241
- }
242
189
  exports.LeafComponent = LeafComponent;
243
190
  exports["default"] = ReadOnlyTextV2;
244
191
  //# sourceMappingURL=ReadOnlyTextV2.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyTextV2.cjs.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport {\n InlineType,\n Block,\n BlockType,\n BlockPlugin,\n InlineModePlugin,\n InlinePlugin,\n LinkPlugin,\n TextAlignPlugin,\n TypographyPlugin,\n} from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\n\ntype Props = {\n text: RichTextV2ControlData\n definition: RichTextV2ControlDefinition | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: { descendants }, definition }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants, definition?.config.mode ?? RichTextV2Mode.Block)\n\n return (\n <div\n ref={ref}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n >\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants\n plugins={\n /**\n * TODO: we are manually referencing our default plugins for each mode here because\n * Referencing the real LinkPlugin causes a circular dependency.\n * When circular dependencies calm down we should update the plugin definition to use real plugins,\n * and just use the plugins that are defined by our config.\n */\n // definition?.config?.plugins ,\n definition?.config?.mode === RichTextV2Mode.Inline\n ? [InlineModePlugin()]\n : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]\n }\n descendants={descendants}\n />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\ntype LeafProps = {\n leaf: Text\n plugins: RichTextV2Plugin[]\n}\n\nexport function LeafComponent({ plugins, ...props }: LeafProps) {\n function initialRenderLeaf({ leaf }: RenderLeafProps) {\n return <span className={leaf.className}>{leaf.text === '' ? '\\uFEFF' : leaf.text}</span>\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf({ attributes: {} as any, leaf: props.leaf, children: null, text: props.leaf })\n}\n\ntype ElementProps = {\n descendant: Element\n plugins: RichTextV2Plugin[]\n}\n\nfunction ElementComponent({ plugins, ...props }: ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return <Descendants descendants={props.element.children} plugins={plugins} />\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement({ attributes: {} as any, children: null, element: props.descendant })\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: Descendant): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({\n descendants,\n plugins,\n}: {\n plugins: RichTextV2Plugin[]\n descendants: Descendant[]\n}) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <LeafComponent key={index} plugins={plugins} leaf={descendant} />\n }\n\n return <ElementComponent key={index} descendant={descendant} plugins={plugins} />\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case BlockType.Default:\n return mode === RichTextV2Mode.Inline\n ? descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ??\n ''\n : descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return (\n descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n )\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[], mode: RichTextV2Mode): string {\n return descendant.map(node => getTextByDescendant(node, mode)).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","definition","ref","descendantsAsString","getText","config","mode","RichTextV2Mode","Block","position","whiteSpace","wordWrap","_jsx","Inline","InlineModePlugin","BlockPlugin","TypographyPlugin","TextAlignPlugin","InlinePlugin","LinkPlugin","useStyle","display","width","maxWidth","opacity","verticalAlign","plugins","props","leaf","className","renderLeaf","reduce","renderFn","plugin","control","getLeafValue","undefined","ControlValue","value","initialRenderLeaf","attributes","children","element","renderElement","getElementValue","initialRenderElement","descendant","node","_Fragment","map","index","isText","type","BlockType","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","Paragraph","Default","OrderedList","UnorderedList","ListItem","ListItemChild","getTextByDescendant","join","every","isBlock","InlineType","Link","Code","SubScript","SuperScript"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BMA,MAAAA,iBAAiBC,MAAAA,WAAW,sBAChC;AAAA,EAAEC,MAAM;AAAA,IAAEC;AAAAA;AAAAA,EAAeC;AAAAA,GACzBC,KACA;;AACA,QAAMC,sBAAsBC,QAAQJ,aAAaC,+CAAYI,OAAOC,SAAnBL,YAA2BM,yBAAeC,KAAxD;AAGjC,wCAAA,OAAA;AAAA,IACE;AAAA,IACA,OAAO;AAAA,MAMLC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAVd;AAAA,IAaGR,UAAAA,wBAAwB,KACvBS,2BAAA,IAAC,aAAD,EAAA,IAEAA,2BAAA,IAAC,aAAD;AAAA,MACE,SAQEX,gDAAYI,WAAZJ,mBAAoBK,UAASC,UAAAA,eAAeM,SACxC,CAACC,2BAAD,CAAA,IACA,CAACC,UAAD,YAAA,GAAgBC,UAAAA,oBAAoBC,UAAAA,mBAAmBC,UAAY,aAAA,GAAIC,MAAAA,YAAvE;AAAA,MAEN;AAAA,IAAA,CAbF;AAAA,EAAA,CAjBN;AAmCD,CAzCgC;AA6CjC,qBAAqB;AAAA,EAAEpB,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWqB,UAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTC,OAAO;A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UI;AAAAA,SACVJ,UAAAA,UAAUK;AAAAA,SACVL,UAAAA,UAAUM;AAAAA,SACVN,UAAAA,UAAUO;AAAAA,SACVP,UAAAA,UAAUQ;AAAAA,SACVR,UAAAA,UAAUU;AAAAA,SACVV,UAAAA,UAAUW;AAAAA,SACVX,UAAAA,UAAUY;AAAAA,SACVZ,UAAUa,UAAAA;AACb,aACEpB,iBAAWL,SACRQ,IAAIH,CAAcqB,gBAAAA,oBAAoBrB,aAAYxC,IAAb,CADxC,EAEG8D,KAAKtB,WAAWL,SAAS4B,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAxB,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAA0BxC,MAA8B;AAChEwC,SAAAA,WAAWG,IAAIF,CAAQoB,SAAAA,oBAAoBpB,MAAMzC,IAAP,CAA1C,EAAwD8D,KAAK,IAA7D;AACR;;;"}
1
+ {"version":3,"file":"ReadOnlyTextV2.cjs.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport {\n BlockPlugin,\n InlineModePlugin,\n InlinePlugin,\n LinkPlugin,\n TextAlignPlugin,\n TypographyPlugin,\n toText,\n} from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\n\ntype Props = {\n text: RichTextV2ControlData\n definition: RichTextV2ControlDefinition | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: { descendants }, definition }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = toText(descendants, definition?.config.mode ?? RichTextV2Mode.Block)\n\n return (\n <div\n ref={ref}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n >\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants\n plugins={\n /**\n * TODO: we are manually referencing our default plugins for each mode here because\n * Referencing the real LinkPlugin causes a circular dependency.\n * When circular dependencies calm down we should update the plugin definition to use real plugins,\n * and just use the plugins that are defined by our config.\n */\n // definition?.config?.plugins ,\n definition?.config?.mode === RichTextV2Mode.Inline\n ? [InlineModePlugin()]\n : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]\n }\n descendants={descendants}\n />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\ntype LeafProps = {\n leaf: Text\n plugins: RichTextV2Plugin[]\n}\n\nexport function LeafComponent({ plugins, ...props }: LeafProps) {\n function initialRenderLeaf({ leaf }: RenderLeafProps) {\n return <span className={leaf.className}>{leaf.text === '' ? '\\uFEFF' : leaf.text}</span>\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf({ attributes: {} as any, leaf: props.leaf, children: null, text: props.leaf })\n}\n\ntype ElementProps = {\n descendant: Element\n plugins: RichTextV2Plugin[]\n}\n\nfunction ElementComponent({ plugins, ...props }: ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return <Descendants descendants={props.element.children} plugins={plugins} />\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement({ attributes: {} as any, children: null, element: props.descendant })\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: Descendant): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({\n descendants,\n plugins,\n}: {\n plugins: RichTextV2Plugin[]\n descendants: Descendant[]\n}) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <LeafComponent key={index} plugins={plugins} leaf={descendant} />\n }\n\n return <ElementComponent key={index} descendant={descendant} plugins={plugins} />\n })}\n </>\n )\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","definition","ref","descendantsAsString","toText","config","mode","RichTextV2Mode","Block","position","whiteSpace","wordWrap","_jsx","Inline","InlineModePlugin","BlockPlugin","TypographyPlugin","TextAlignPlugin","InlinePlugin","LinkPlugin","useStyle","display","width","maxWidth","opacity","verticalAlign","plugins","props","leaf","className","renderLeaf","reduce","renderFn","plugin","control","getLeafValue","undefined","ControlValue","value","initialRenderLeaf","attributes","children","element","renderElement","getElementValue","initialRenderElement","descendant","node","_Fragment","map","index","isText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BMA,MAAAA,iBAAiBC,MAAAA,WAAW,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,UAAAA,CAASK,UAAAA,eAAcX,UAAUM,KAAX,EAAkBX,MAA/B;AAAA,IAAA,CAFd;AAAA,KAMFkB,oBAdoB;AAiBtB,SAAOF,cAAc;AAAA,IAAEH,YAAY,CAAM;AAAA,IAAKC,UAAU;AAAA,IAAMC,SAASf,MAAMmB;AAAAA,EAAAA,CAAzD;AACrB;AAGD,gBAAgBC,MAAgC;AAC1C,MAAA,OAAOA,SAAS,YAAY,UAAUA;AAAa,WAAA;AAEhD,SAAA;AACR;AAED,qBAAqB;AAAA,EACnB/C;AAAAA,EACA0B;AAAAA,GAIC;AAEC,wCAAAsB,WAAAA,UAAA;AAAA,IACGhD,UAAAA,YAAYiD,IAAI,CAACH,YAAYI,WAAU;AAClCC,UAAAA,OAAOL,UAAD,GAAc;AACtB,8CAAQ,eAAD;AAAA,UAA2B;AAAA,UAAkB,MAAMA;AAAAA,WAA/BI,MAApB;AAAA,MACR;AAED,4CAAQ,kBAAD;AAAA,QAA8B;AAAA,QAAwB;AAAA,SAA/BA,MAAvB;AAAA,IAAA,CALR;AAAA,EAAA,CAFL;AAWD;;;"}
@@ -14,22 +14,27 @@ var __objRest = (source, exclude) => {
14
14
  return target;
15
15
  };
16
16
  import { forwardRef } from "react";
17
- import { br as RichTextV2Mode, bK as InlineModePlugin, bI as BlockPlugin, bD as TypographyPlugin, bM as TextAlignPlugin, bR as InlinePlugin, _ as useStyle, Y as BlockType, bO as InlineType } from "./react-page.es.js";
17
+ import { bq as RichTextV2Mode, bJ as InlineModePlugin, bH as BlockPlugin, bC as TypographyPlugin, bL as TextAlignPlugin, bR as InlinePlugin, Z as useStyle } from "./react-page.es.js";
18
18
  import "./actions.es.js";
19
19
  import "slate";
20
20
  import "uuid";
21
21
  import "slate-react";
22
- import { L as LinkPlugin } from "./index.es5.js";
23
- import { Q as ControlValue } from "./index.es.js";
22
+ import { L as LinkPlugin } from "./index.es6.js";
23
+ import { t as toText } from "./toText.es.js";
24
+ import { T as ControlValue } from "./index.es.js";
24
25
  import { jsx, Fragment } from "react/jsx-runtime";
25
26
  import "redux";
26
27
  import "redux-thunk";
27
28
  import "./state/breakpoints.es.js";
28
29
  import "zod";
30
+ import "corporate-ipsum";
29
31
  import "@emotion/css";
30
32
  import "@emotion/serialize";
31
33
  import "@emotion/utils";
32
34
  import "is-hotkey";
35
+ import "./index.es3.js";
36
+ import "scroll-into-view-if-needed";
37
+ import "next/link";
33
38
  import "use-sync-external-store/shim/with-selector";
34
39
  import "next/dynamic";
35
40
  import "./text-input.es.js";
@@ -39,7 +44,6 @@ import "./types.es.js";
39
44
  import "./box-models.es.js";
40
45
  import "css-box-model";
41
46
  import "color";
42
- import "scroll-into-view-if-needed";
43
47
  import "react-dom";
44
48
  import "html-react-parser";
45
49
  import "next/head";
@@ -51,8 +55,6 @@ import "cookie";
51
55
  import "http-proxy";
52
56
  import "set-cookie-parser";
53
57
  import "./constants.es.js";
54
- import "corporate-ipsum";
55
- import "next/link";
56
58
  const ReadOnlyTextV2 = forwardRef(function ReadOnlyText({
57
59
  text: {
58
60
  descendants
@@ -60,7 +62,7 @@ const ReadOnlyTextV2 = forwardRef(function ReadOnlyText({
60
62
  definition
61
63
  }, ref) {
62
64
  var _a, _b;
63
- const descendantsAsString = getText(descendants, (_a = definition == null ? void 0 : definition.config.mode) != null ? _a : RichTextV2Mode.Block);
65
+ const descendantsAsString = toText(descendants, (_a = definition == null ? void 0 : definition.config.mode) != null ? _a : RichTextV2Mode.Block);
64
66
  return /* @__PURE__ */ jsx("div", {
65
67
  ref,
66
68
  style: {
@@ -182,60 +184,5 @@ function Descendants({
182
184
  })
183
185
  });
184
186
  }
185
- function isBlock(descendant) {
186
- if (isText(descendant))
187
- return false;
188
- switch (descendant.type) {
189
- case BlockType.Heading1:
190
- case BlockType.Heading2:
191
- case BlockType.Heading3:
192
- case BlockType.Heading4:
193
- case BlockType.Heading5:
194
- case BlockType.Heading6:
195
- case BlockType.BlockQuote:
196
- case BlockType.Paragraph:
197
- case BlockType.Default:
198
- case BlockType.OrderedList:
199
- case BlockType.UnorderedList:
200
- case BlockType.ListItem:
201
- case BlockType.ListItemChild:
202
- return true;
203
- default:
204
- return false;
205
- }
206
- }
207
- function getTextByDescendant(descendant, mode) {
208
- var _a, _b, _c, _d, _e;
209
- if (isText(descendant)) {
210
- return (_a = descendant.text) != null ? _a : "";
211
- }
212
- switch (descendant.type) {
213
- case BlockType.Default:
214
- return mode === RichTextV2Mode.Inline ? (_b = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join("")) != null ? _b : "" : (_c = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _c : "";
215
- case InlineType.Link:
216
- case InlineType.Code:
217
- case InlineType.SubScript:
218
- case InlineType.SuperScript:
219
- return (_d = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join("")) != null ? _d : "";
220
- case BlockType.Heading1:
221
- case BlockType.Heading2:
222
- case BlockType.Heading3:
223
- case BlockType.Heading4:
224
- case BlockType.Heading5:
225
- case BlockType.Heading6:
226
- case BlockType.BlockQuote:
227
- case BlockType.Paragraph:
228
- case BlockType.OrderedList:
229
- case BlockType.UnorderedList:
230
- case BlockType.ListItem:
231
- case BlockType.ListItemChild:
232
- return (_e = descendant.children.map((descendant2) => getTextByDescendant(descendant2, mode)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _e : "";
233
- default:
234
- return "";
235
- }
236
- }
237
- function getText(descendant, mode) {
238
- return descendant.map((node) => getTextByDescendant(node, mode)).join("\n");
239
- }
240
187
  export { LeafComponent, ReadOnlyTextV2 as default };
241
188
  //# sourceMappingURL=ReadOnlyTextV2.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport {\n InlineType,\n Block,\n BlockType,\n BlockPlugin,\n InlineModePlugin,\n InlinePlugin,\n LinkPlugin,\n TextAlignPlugin,\n TypographyPlugin,\n} from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\n\ntype Props = {\n text: RichTextV2ControlData\n definition: RichTextV2ControlDefinition | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: { descendants }, definition }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants, definition?.config.mode ?? RichTextV2Mode.Block)\n\n return (\n <div\n ref={ref}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n >\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants\n plugins={\n /**\n * TODO: we are manually referencing our default plugins for each mode here because\n * Referencing the real LinkPlugin causes a circular dependency.\n * When circular dependencies calm down we should update the plugin definition to use real plugins,\n * and just use the plugins that are defined by our config.\n */\n // definition?.config?.plugins ,\n definition?.config?.mode === RichTextV2Mode.Inline\n ? [InlineModePlugin()]\n : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]\n }\n descendants={descendants}\n />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\ntype LeafProps = {\n leaf: Text\n plugins: RichTextV2Plugin[]\n}\n\nexport function LeafComponent({ plugins, ...props }: LeafProps) {\n function initialRenderLeaf({ leaf }: RenderLeafProps) {\n return <span className={leaf.className}>{leaf.text === '' ? '\\uFEFF' : leaf.text}</span>\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf({ attributes: {} as any, leaf: props.leaf, children: null, text: props.leaf })\n}\n\ntype ElementProps = {\n descendant: Element\n plugins: RichTextV2Plugin[]\n}\n\nfunction ElementComponent({ plugins, ...props }: ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return <Descendants descendants={props.element.children} plugins={plugins} />\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement({ attributes: {} as any, children: null, element: props.descendant })\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: Descendant): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({\n descendants,\n plugins,\n}: {\n plugins: RichTextV2Plugin[]\n descendants: Descendant[]\n}) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <LeafComponent key={index} plugins={plugins} leaf={descendant} />\n }\n\n return <ElementComponent key={index} descendant={descendant} plugins={plugins} />\n })}\n </>\n )\n}\n\nfunction isBlock(descendant: Descendant): descendant is Block {\n if (isText(descendant)) return false\n\n switch (descendant.type) {\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.Default:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant, mode: RichTextV2Mode): string {\n if (isText(descendant)) {\n return descendant.text ?? ''\n }\n\n switch (descendant.type) {\n case BlockType.Default:\n return mode === RichTextV2Mode.Inline\n ? descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ??\n ''\n : descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n\n case InlineType.Link:\n case InlineType.Code:\n case InlineType.SubScript:\n case InlineType.SuperScript:\n return (\n descendant.children.map(descendant => getTextByDescendant(descendant, mode)).join('') ?? ''\n )\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.Heading4:\n case BlockType.Heading5:\n case BlockType.Heading6:\n case BlockType.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return (\n descendant.children\n .map(descendant => getTextByDescendant(descendant, mode))\n .join(descendant.children.every(isBlock) ? '\\n' : '') ?? ''\n )\n default:\n return ''\n }\n}\n\nfunction getText(descendant: Descendant[], mode: RichTextV2Mode): string {\n return descendant.map(node => getTextByDescendant(node, mode)).join('\\n')\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","definition","ref","descendantsAsString","getText","config","mode","RichTextV2Mode","Block","position","whiteSpace","wordWrap","_jsx","Inline","InlineModePlugin","BlockPlugin","TypographyPlugin","TextAlignPlugin","InlinePlugin","LinkPlugin","useStyle","display","width","maxWidth","opacity","verticalAlign","plugins","props","leaf","className","renderLeaf","reduce","renderFn","plugin","control","getLeafValue","undefined","value","initialRenderLeaf","attributes","children","element","renderElement","getElementValue","initialRenderElement","descendant","node","_Fragment","map","index","isText","type","BlockType","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","Paragraph","Default","OrderedList","UnorderedList","ListItem","ListItemChild","getTextByDescendant","join","every","isBlock","InlineType","Link","Code","SubScript","SuperScript"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BMA,MAAAA,iBAAiBC,WAAW,sBAChC;AAAA,EAAEC,MAAM;AAAA,IAAEC;AAAAA;AAAAA,EAAeC;AAAAA,GACzBC,KACA;;AACA,QAAMC,sBAAsBC,QAAQJ,aAAaC,+CAAYI,OAAOC,SAAnBL,YAA2BM,eAAeC,KAAxD;AAGjC,6BAAA,OAAA;AAAA,IACE;AAAA,IACA,OAAO;AAAA,MAMLC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAVd;AAAA,IAaGR,UAAAA,wBAAwB,KACvBS,oBAAC,aAAD,EAAA,IAEAA,oBAAC,aAAD;AAAA,MACE,SAQEX,gDAAYI,WAAZJ,mBAAoBK,UAASC,eAAeM,SACxC,CAACC,iBAAD,CAAA,IACA,CAACC,YAAD,GAAgBC,oBAAoBC,mBAAmBC,aAAY,GAAIC,YAAvE;AAAA,MAEN;AAAA,IAAA,CAbF;AAAA,EAAA,CAjBN;AAmCD,CAzCgC;AA6CjC,qBAAqB;AAAA,EAAEpB,OAAO;AAAA,GAA2C;AAErE,6BAAA,QAAA;AAAA,IACE,WAAWqB,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTC,OAAO;AAAA,MACPC,UAAU;AAAA,MACVb,YAAY;AAAA,MACZc,SAAS;AAAA,MACTC,eAA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,KAAKtB,WAAWL,SAAS4B,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAxB,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAA0BvC,MAA8B;AAChEuC,SAAAA,WAAWG,IAAIF,CAAQoB,SAAAA,oBAAoBpB,MAAMxC,IAAP,CAA1C,EAAwD6D,KAAK,IAA7D;AACR;;"}
1
+ {"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { ForwardedRef, forwardRef } from 'react'\nimport {\n RichTextV2ControlData,\n RichTextV2ControlDefinition,\n RichTextV2Mode,\n} from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Element, Text } from 'slate'\nimport {\n BlockPlugin,\n InlineModePlugin,\n InlinePlugin,\n LinkPlugin,\n TextAlignPlugin,\n TypographyPlugin,\n toText,\n} from '../../../../slate'\nimport { ControlValue } from '../control'\nimport { RenderElementProps, RenderLeafProps } from 'slate-react'\nimport { RichTextV2Plugin } from '../../../../controls/rich-text-v2/plugin'\n\ntype Props = {\n text: RichTextV2ControlData\n definition: RichTextV2ControlDefinition | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: { descendants }, definition }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = toText(descendants, definition?.config.mode ?? RichTextV2Mode.Block)\n\n return (\n <div\n ref={ref}\n style={{\n /**\n * These are the default styles that Slate uses for its editable div.\n * https://github.com/ianstormtaylor/slate/blob/4bd15ed3950e3a0871f5d0ecb391bb637c05e59d/packages/slate-react/src/components/editable.tsx\n * Search for `disableDefaultStyles`\n */\n position: 'relative',\n whiteSpace: 'pre-wrap',\n wordWrap: 'break-word',\n }}\n >\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants\n plugins={\n /**\n * TODO: we are manually referencing our default plugins for each mode here because\n * Referencing the real LinkPlugin causes a circular dependency.\n * When circular dependencies calm down we should update the plugin definition to use real plugins,\n * and just use the plugins that are defined by our config.\n */\n // definition?.config?.plugins ,\n definition?.config?.mode === RichTextV2Mode.Inline\n ? [InlineModePlugin()]\n : [BlockPlugin(), TypographyPlugin(), TextAlignPlugin(), InlinePlugin(), LinkPlugin()]\n }\n descendants={descendants}\n />\n )}\n </div>\n )\n})\n\nexport default ReadOnlyTextV2\n\nfunction Placeholder({ text = 'Write some text...' }: { text?: string }) {\n return (\n <span\n className={useStyle({\n display: 'inline-block',\n width: 0,\n maxWidth: '100%',\n whiteSpace: 'nowrap',\n opacity: 0.333,\n verticalAlign: 'text-top',\n })}\n >\n {text}\n </span>\n )\n}\n\ntype LeafProps = {\n leaf: Text\n plugins: RichTextV2Plugin[]\n}\n\nexport function LeafComponent({ plugins, ...props }: LeafProps) {\n function initialRenderLeaf({ leaf }: RenderLeafProps) {\n return <span className={leaf.className}>{leaf.text === '' ? '\\uFEFF' : leaf.text}</span>\n }\n\n const renderLeaf = plugins.reduce(\n (renderFn, plugin) => (props: RenderLeafProps) => {\n const { control, renderLeaf } = plugin\n\n if (control?.definition == null || renderLeaf == null) return renderFn(props)\n\n if (control.getLeafValue == null) return renderLeaf(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getLeafValue(props.leaf)}>\n {value => renderLeaf(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderLeaf,\n )\n\n return renderLeaf({ attributes: {} as any, leaf: props.leaf, children: null, text: props.leaf })\n}\n\ntype ElementProps = {\n descendant: Element\n plugins: RichTextV2Plugin[]\n}\n\nfunction ElementComponent({ plugins, ...props }: ElementProps) {\n function initialRenderElement(props: RenderElementProps) {\n return <Descendants descendants={props.element.children} plugins={plugins} />\n }\n\n const renderElement = plugins.reduce(\n (renderFn, plugin) => (props: RenderElementProps) => {\n const { control, renderElement } = plugin\n\n if (control?.definition == null || renderElement == null) return renderFn(props)\n\n if (control.getElementValue == null) return renderElement(renderFn, undefined)(props)\n\n return (\n <ControlValue definition={control.definition} data={control.getElementValue(props.element)}>\n {value => renderElement(renderFn, value)(props)}\n </ControlValue>\n )\n },\n initialRenderElement,\n )\n\n return renderElement({ attributes: {} as any, children: null, element: props.descendant })\n}\n\n// reimplemented from slate source for code splitting\nfunction isText(node: Descendant): node is Text {\n if (typeof node === 'object' && 'text' in node) return true\n\n return false\n}\n\nfunction Descendants({\n descendants,\n plugins,\n}: {\n plugins: RichTextV2Plugin[]\n descendants: Descendant[]\n}) {\n return (\n <>\n {descendants.map((descendant, index) => {\n if (isText(descendant)) {\n return <LeafComponent key={index} plugins={plugins} leaf={descendant} />\n }\n\n return <ElementComponent key={index} descendant={descendant} plugins={plugins} />\n })}\n </>\n )\n}\n"],"names":["ReadOnlyTextV2","forwardRef","text","descendants","definition","ref","descendantsAsString","toText","config","mode","RichTextV2Mode","Block","position","whiteSpace","wordWrap","_jsx","Inline","InlineModePlugin","BlockPlugin","TypographyPlugin","TextAlignPlugin","InlinePlugin","LinkPlugin","useStyle","display","width","maxWidth","opacity","verticalAlign","plugins","props","leaf","className","renderLeaf","reduce","renderFn","plugin","control","getLeafValue","undefined","value","initialRenderLeaf","attributes","children","element","renderElement","getElementValue","initialRenderElement","descendant","node","_Fragment","map","index","isText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BMA,MAAAA,iBAAiBC,WAAW,sBAChC;AAAA,EAAEC,MAAM;AAAA,IAAEC;AAAAA;AAAAA,EAAeC;AAAAA,GACzBC,KACA;;AACA,QAAMC,sBAAsBC,OAAOJ,aAAaC,+CAAYI,OAAOC,SAAnBL,YAA2BM,eAAeC,KAAxD;AAGhC,6BAAA,OAAA;AAAA,IACE;AAAA,IACA,OAAO;AAAA,MAMLC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,UAAU;AAAA,IAVd;AAAA,IAaGR,UAAAA,wBAAwB,KACvBS,oBAAC,aAAD,EAAA,IA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ACH,YAAYI,UAAU;AAClCC,UAAAA,OAAOL,UAAD,GAAc;AACtB,mCAAQ,eAAD;AAAA,UAA2B;AAAA,UAAkB,MAAMA;AAAAA,WAA/BI,KAApB;AAAA,MACR;AAED,iCAAQ,kBAAD;AAAA,QAA8B;AAAA,QAAwB;AAAA,SAA/BA,KAAvB;AAAA,IAAA,CALR;AAAA,EAAA,CAFL;AAWD;;"}
package/dist/Root.cjs.js CHANGED
@@ -15,6 +15,7 @@ require("redux-thunk");
15
15
  require("./actions.cjs.js");
16
16
  require("zod");
17
17
  require("./state/breakpoints.cjs.js");
18
+ require("corporate-ipsum");
18
19
  require("slate");
19
20
  require("uuid");
20
21
  require("is-hotkey");
@@ -39,9 +40,6 @@ require("cookie");
39
40
  require("http-proxy");
40
41
  require("set-cookie-parser");
41
42
  require("./constants.cjs.js");
42
- require("corporate-ipsum");
43
- require("slate-react");
44
- require("next/link");
45
43
  require("./useMediaQuery.cjs.js");
46
44
  require("next/image");
47
45
  require("./useIsomorphicLayoutEffect.cjs.js");
@@ -1 +1 @@
1
- {"version":3,"file":"Root.cjs.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","React","injectGlobal","serializeStyles","cache","useRef","insertStyles","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","BackgroundsContainer","display","flexWrap","elements","length","map","child","index","GridItem","columns","Element","key","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAeA,cAAAA,MAAAA,WAA2B,sBAAqBC,QAAQC,KAAK;AAExE,wCAAA,OAAA;AAAA,IACE;AAAA,IACA,WAAWC,UAAAA,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;A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A;AAAA,QALF,yCAOGG,cAAD;AAAA,UAAS,SAASJ;AAAAA,QAAAA,CAAlB;AAAA,MAAA,GANKA,MAAMK,GADb,CADF,IAYCC,2BAAAA,IAAA,aAAD,CAAA,CAAA;AAAA,IAAA,CAdJ;AAAA,EAAA,CAFJ;AAqBD,CApCsB;;"}
1
+ {"version":3,"file":"Root.cjs.js","sources":["../src/components/builtin/Root/components/Placeholder/index.tsx","../src/runtimes/react/use-global-style.ts","../src/components/builtin/Root/Root.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\n\nexport default forwardRef<HTMLDivElement>(function Placeholder(_props, ref) {\n return (\n <div\n ref={ref}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n height: 80,\n padding: 8,\n })}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n style={{ overflow: 'visible' }}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n </svg>\n </div>\n )\n})\n","import * as React from 'react'\nimport { useRef } from 'react'\nimport { cache, injectGlobal } from '@emotion/css'\nimport { CSSInterpolation, serializeStyles } from '@emotion/serialize'\nimport { StyleSheet } from '@emotion/sheet'\nimport { insertStyles } from '@emotion/utils'\n\nconst isServer = typeof window === 'undefined'\nconst useInsertionEffectSpecifier = 'useInsertionEffect'\nconst useInsertionEffect = React[useInsertionEffectSpecifier] ?? React.useLayoutEffect\n\nexport function useGlobalStyle(...args: CSSInterpolation[]): void {\n if (isServer) return injectGlobal(args)\n\n const serialized = serializeStyles(args, cache.registered)\n const sheetRef = useRef<[StyleSheet, boolean]>()\n\n // Hydration\n useInsertionEffect(() => {\n const key = `${cache.key}-global`\n\n const cacheSheet = cache.sheet as StyleSheet\n const sheet = new (cacheSheet.constructor as typeof StyleSheet)({\n key,\n nonce: cacheSheet.nonce,\n container: cacheSheet.container,\n speedy: cacheSheet.isSpeedy,\n })\n\n const node = document.querySelector<HTMLStyleElement>(\n `style[data-emotion=\"${key} ${serialized.name}\"]`,\n )\n\n if (cache.sheet.tags.length > 0) {\n sheet.before = cache.sheet.tags[0]\n }\n\n let rehydrating = false\n\n if (node != null) {\n rehydrating = true\n node.setAttribute('data-emotion', key)\n sheet.hydrate([node])\n }\n\n sheetRef.current = [sheet, rehydrating]\n\n return () => {\n sheet.flush()\n }\n })\n\n // Insertion\n useInsertionEffect(() => {\n const [sheet, rehydrating] = sheetRef.current ?? []\n\n if (sheet == null || rehydrating == null) return\n\n if (rehydrating) {\n sheetRef.current = [sheet, false]\n\n return\n }\n\n if (serialized.next != null) {\n insertStyles(cache, serialized.next, true)\n }\n\n if (sheet.tags.length > 0) {\n const element = sheet.tags[sheet.tags.length - 1].nextElementSibling\n\n sheet.before = element\n\n sheet.flush()\n }\n\n cache.insert('', serialized, sheet, false)\n })\n}\n","import { normalize } from 'polished'\nimport { forwardRef, Ref } from 'react'\n\nimport Placeholder from './components/Placeholder'\nimport type {\n GridValue,\n BackgroundsValue,\n GapXValue,\n GapYValue,\n} from '../../../prop-controllers/descriptors'\nimport { Element } from '../../../runtimes/react'\nimport BackgroundsContainer from '../../shared/BackgroundsContainer'\nimport { useGlobalStyle } from '../../../runtimes/react/use-global-style'\nimport { GridItem } from '../../shared/grid-item'\nimport { useStyle } from '../../../runtimes/react/use-style'\n\ntype Props = {\n children?: GridValue\n backgrounds?: BackgroundsValue\n rowGap?: GapYValue\n columnGap?: GapXValue\n}\n\nconst Root = forwardRef(function Page(\n { children, backgrounds, rowGap, columnGap }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n useGlobalStyle({\n html: {\n boxSizing: 'border-box',\n },\n '*, *::before, *::after': {\n boxSizing: 'inherit',\n },\n })\n\n useGlobalStyle(normalize())\n\n return (\n <BackgroundsContainer ref={ref} style={{ background: 'white' }} backgrounds={backgrounds}>\n <div className={useStyle({ display: 'flex', flexWrap: 'wrap', width: '100%' })}>\n {children && children.elements.length > 0 ? (\n children.elements.map((child, index) => (\n <GridItem\n key={child.key}\n grid={children.columns}\n index={index}\n columnGap={columnGap}\n rowGap={rowGap}\n >\n <Element element={child} />\n </GridItem>\n ))\n ) : (\n <Placeholder />\n )}\n </div>\n </BackgroundsContainer>\n )\n})\n\nexport default Root\n"],"names":["forwardRef","_props","ref","useStyle","width","background","height","padding","overflow","React","injectGlobal","serializeStyles","cache","useRef","insertStyles","Root","children","backgrounds","rowGap","columnGap","html","boxSizing","useGlobalStyle","normalize","BackgroundsContainer","display","flexWrap","elements","length","map","child","index","GridItem","columns","Element","key","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAeA,cAAAA,MAAAA,WAA2B,sBAAqBC,QAAQC,KAAK;AAExE,wCAAA,OAAA;AAAA,IACE;AAAA,IACA,WAAWC,UAAAA,SAAS;AAAA,MAClBC,OAAO;AAAA,MACPC,YAAY;AAAA,MACZC,QAAQ;AAAA,MACRC,SAAS;AAAA,IAAA,CAJQ;AAAA,IAOnB,yCAAA,OAAA;AAAA,MACE,OAAM;AAAA,MACN,OAAM;AAAA,MACN,QAAO;AAAA,MACP,OAAO;AAAA,QAAEC,UAAU;AAAA,MAJrB;AAAA,MAME,yCAAA,QAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,OAAM;AAAA,QACN,QAAO;AAAA,QACP,aAAa;AAAA,QACb,iBAAgB;AAAA,QAChB,MAAK;AAAA,QACL,QAAO;AAAA,QACP,IAAG;AAAA,QACH,IAAG;AAAA,MAAA,CAVL;AAAA,IAAA,CANF;AAAA,EAAA,CAVJ;AA+BD,CAhCwB;ACIzB,MAAM,WAAW,OAAO,WAAW;AACnC,MAAM,8BAA8B;AACpC,MAAM,q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