@makeswift/runtime 0.9.4 → 0.9.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 (125) hide show
  1. package/dist/Box.cjs.js +3 -3
  2. package/dist/Box.es.js +3 -3
  3. package/dist/Button.cjs.js +3 -3
  4. package/dist/Button.es.js +3 -3
  5. package/dist/Carousel.cjs.js +3 -3
  6. package/dist/Carousel.es.js +3 -3
  7. package/dist/Countdown.cjs.js +1 -1
  8. package/dist/Countdown.es.js +1 -1
  9. package/dist/Divider.cjs.js +3 -3
  10. package/dist/Divider.es.js +3 -3
  11. package/dist/Embed.cjs.js +1 -0
  12. package/dist/Embed.cjs.js.map +1 -1
  13. package/dist/Embed.es.js +1 -0
  14. package/dist/Embed.es.js.map +1 -1
  15. package/dist/Form.cjs.js +1 -1
  16. package/dist/Form.es.js +1 -1
  17. package/dist/Image.cjs.js +1 -1
  18. package/dist/Image.es.js +1 -1
  19. package/dist/LiveProvider.cjs.js +4 -4
  20. package/dist/LiveProvider.es.js +4 -4
  21. package/dist/Navigation.cjs.js +2 -2
  22. package/dist/Navigation.es.js +2 -2
  23. package/dist/PreviewProvider.cjs.js +8 -7
  24. package/dist/PreviewProvider.cjs.js.map +1 -1
  25. package/dist/PreviewProvider.es.js +10 -9
  26. package/dist/PreviewProvider.es.js.map +1 -1
  27. package/dist/ReadOnlyText.cjs.js +1 -1
  28. package/dist/ReadOnlyText.es.js +2 -2
  29. package/dist/ReadOnlyTextV2.cjs.js +10 -11
  30. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  31. package/dist/ReadOnlyTextV2.es.js +11 -12
  32. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  33. package/dist/Root.cjs.js +1 -1
  34. package/dist/Root.es.js +1 -1
  35. package/dist/SocialLinks.cjs.js +3 -3
  36. package/dist/SocialLinks.es.js +3 -3
  37. package/dist/Text.cjs.js +1 -1
  38. package/dist/Text.es.js +1 -1
  39. package/dist/Video.cjs.js +1 -0
  40. package/dist/Video.cjs.js.map +1 -1
  41. package/dist/Video.es.js +1 -0
  42. package/dist/Video.es.js.map +1 -1
  43. package/dist/actions.cjs.js +467 -3
  44. package/dist/actions.cjs.js.map +1 -1
  45. package/dist/actions.es.js +467 -4
  46. package/dist/actions.es.js.map +1 -1
  47. package/dist/box-model.cjs.js +1 -0
  48. package/dist/box-model.cjs.js.map +1 -1
  49. package/dist/box-model.es.js +1 -0
  50. package/dist/box-model.es.js.map +1 -1
  51. package/dist/builder.cjs.js +1 -0
  52. package/dist/builder.cjs.js.map +1 -1
  53. package/dist/builder.es.js +1 -0
  54. package/dist/builder.es.js.map +1 -1
  55. package/dist/components.cjs.js +1 -1
  56. package/dist/components.es.js +1 -1
  57. package/dist/control-serialization.cjs.js +1 -0
  58. package/dist/control-serialization.cjs.js.map +1 -1
  59. package/dist/control-serialization.es.js +1 -0
  60. package/dist/control-serialization.es.js.map +1 -1
  61. package/dist/controls.cjs.js +1 -0
  62. package/dist/controls.cjs.js.map +1 -1
  63. package/dist/controls.es.js +2 -1
  64. package/dist/controls.es.js.map +1 -1
  65. package/dist/index.cjs.js +22 -12
  66. package/dist/index.cjs.js.map +1 -1
  67. package/dist/index.cjs10.js +3 -3
  68. package/dist/index.cjs2.js +1 -0
  69. package/dist/index.cjs2.js.map +1 -1
  70. package/dist/index.cjs5.js +1 -4
  71. package/dist/index.cjs5.js.map +1 -1
  72. package/dist/index.cjs8.js +1 -1
  73. package/dist/index.cjs9.js +4 -4
  74. package/dist/index.es.js +24 -14
  75. package/dist/index.es.js.map +1 -1
  76. package/dist/index.es10.js +4 -4
  77. package/dist/index.es2.js +2 -1
  78. package/dist/index.es2.js.map +1 -1
  79. package/dist/index.es5.js +2 -5
  80. package/dist/index.es5.js.map +1 -1
  81. package/dist/index.es6.js +1 -1
  82. package/dist/index.es8.js +1 -1
  83. package/dist/index.es9.js +5 -5
  84. package/dist/main.cjs.js +1 -0
  85. package/dist/main.cjs.js.map +1 -1
  86. package/dist/main.es.js +1 -0
  87. package/dist/main.es.js.map +1 -1
  88. package/dist/next.cjs.js +1 -1
  89. package/dist/next.es.js +1 -1
  90. package/dist/prop-controllers.cjs.js +1 -0
  91. package/dist/prop-controllers.cjs.js.map +1 -1
  92. package/dist/prop-controllers.es.js +1 -0
  93. package/dist/prop-controllers.es.js.map +1 -1
  94. package/dist/react-page.cjs.js +17 -23
  95. package/dist/react-page.cjs.js.map +1 -1
  96. package/dist/react-page.es.js +17 -5
  97. package/dist/react-page.es.js.map +1 -1
  98. package/dist/react.cjs.js +1 -1
  99. package/dist/react.es.js +1 -1
  100. package/dist/slate.cjs.js +6 -6
  101. package/dist/slate.es.js +8 -8
  102. package/dist/state/breakpoints.cjs.js +1 -0
  103. package/dist/state/breakpoints.cjs.js.map +1 -1
  104. package/dist/state/breakpoints.es.js +1 -0
  105. package/dist/state/breakpoints.es.js.map +1 -1
  106. package/dist/types/src/components/page/Page.d.ts.map +1 -1
  107. package/dist/types/src/next/client.d.ts +9 -1
  108. package/dist/types/src/next/client.d.ts.map +1 -1
  109. package/dist/types/src/next/index.d.ts.map +1 -1
  110. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  111. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  112. package/dist/types/src/state/actions.d.ts +7 -7
  113. package/dist/types/src/state/actions.d.ts.map +1 -1
  114. package/dist/types/src/state/modules/locales.d.ts +6 -7
  115. package/dist/types/src/state/modules/locales.d.ts.map +1 -1
  116. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  117. package/dist/types/src/state/react-page.d.ts +3 -1
  118. package/dist/types/src/state/react-page.d.ts.map +1 -1
  119. package/dist/types/types/locale.d.ts +9 -0
  120. package/dist/types/types/locale.d.ts.map +1 -0
  121. package/dist/types.cjs2.js +8 -11
  122. package/dist/types.cjs2.js.map +1 -1
  123. package/dist/types.es2.js +9 -12
  124. package/dist/types.es2.js.map +1 -1
  125. package/package.json +1 -1
@@ -4,6 +4,7 @@ var css = require("@emotion/css");
4
4
  var React = require("react");
5
5
  var next = require("./index.cjs.js");
6
6
  var reactPage = require("./react-page.cjs.js");
7
+ require("./actions.cjs.js");
7
8
  var index = require("./index.cjs3.js");
8
9
  require("slate");
9
10
  require("./state/breakpoints.cjs.js");
@@ -13,7 +14,6 @@ require("slate-react");
13
14
  var jsxRuntime = require("react/jsx-runtime");
14
15
  require("use-sync-external-store/shim/with-selector");
15
16
  require("next/dynamic");
16
- require("./actions.cjs.js");
17
17
  require("./typography.cjs.js");
18
18
  require("./combobox.cjs.js");
19
19
  require("use-sync-external-store/shim");
@@ -23,8 +23,6 @@ require("./types.cjs.js");
23
23
  require("./box-models.cjs.js");
24
24
  require("css-box-model");
25
25
  require("color");
26
- require("@emotion/serialize");
27
- require("@emotion/utils");
28
26
  require("scroll-into-view-if-needed");
29
27
  require("react-dom");
30
28
  require("html-react-parser");
@@ -40,6 +38,8 @@ require("set-cookie-parser");
40
38
  require("./constants.cjs.js");
41
39
  require("uuid");
42
40
  require("corporate-ipsum");
41
+ require("@emotion/serialize");
42
+ require("@emotion/utils");
43
43
  require("next/link");
44
44
  const ReadOnlyTextV2 = React.forwardRef(function ReadOnlyText({
45
45
  text: descendants,
@@ -136,6 +136,11 @@ function BlockElement({
136
136
  fontWeight: "300",
137
137
  borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
138
138
  });
139
+ const listStyles = reactPage.useStyle({
140
+ listStylePosition: "inside",
141
+ paddingInlineStart: "20px",
142
+ listStyleType: "disc"
143
+ });
139
144
  switch (descendant.type) {
140
145
  case reactPage.BlockType.Text:
141
146
  return /* @__PURE__ */ jsxRuntime.jsx("span", {
@@ -211,10 +216,7 @@ function BlockElement({
211
216
  });
212
217
  case reactPage.BlockType.OrderedList:
213
218
  return /* @__PURE__ */ jsxRuntime.jsx("ol", {
214
- className: css.cx(...blockStyles),
215
- style: {
216
- listStylePosition: "inside"
217
- },
219
+ className: css.cx(...blockStyles, listStyles),
218
220
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
219
221
  descendants: descendant.children,
220
222
  mode
@@ -222,10 +224,7 @@ function BlockElement({
222
224
  });
223
225
  case reactPage.BlockType.UnorderedList:
224
226
  return /* @__PURE__ */ jsxRuntime.jsx("ul", {
225
- className: css.cx(...blockStyles),
226
- style: {
227
- listStylePosition: "inside"
228
- },
227
+ className: css.cx(...blockStyles, listStyles),
229
228
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
230
229
  descendants: descendant.children,
231
230
  mode
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyTextV2.cjs.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\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\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 mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: 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} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: 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.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\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, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\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} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\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.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(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.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))\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":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,MAAAA,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AAAAA,GACrBC,KACA;;AACMC,QAAAA,sBAAsBC,QAAQJ,WAAD;AAEnC,QAAMK,OAAOJ,yCAASK,WAAWC,OAAOF,SAA3BJ,YAAmCO,UAAeC,eAAAA;AAG7D,wCAAA,OAAA;AAAA,IAAK;AAAA,IACFN,UAAAA,wBAAwB,KACvBO,2BAAA,IAAC,aAAD,EAAA,IAEAA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,MAA0B;AAAA,IAAA,CAAvC;AAAA,EAAA,CALN;AASD,CAjBgC;AAqBjC,qBAAqB;AAAA,EAAEX,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWY,UAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTC,OAAO;AAAA,MACPC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBlB,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEmB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAAqBC,KAAAA,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,4BAAuBJ,kBAAD;AAGhD,wCAAA,QAAA;AAAA,IAAM,WAAWG;AAAAA,IACdJ,UA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AUI;AAAAA,SACVJ,UAAAA,UAAUK;AAAAA,SACVL,UAAAA,UAAUM;AAAAA,SACVN,UAAAA,UAAUU;AAAAA,SACVV,UAAAA,UAAUG;AAAAA,SACVH,UAAAA,UAAUW;AAAAA,SACVX,UAAAA,UAAUa;AAAAA,SACVb,UAAAA,UAAUc;AAAAA,SACVd,UAAUe,UAAAA;AAEXxC,aAAAA,iBAAWW,SACRiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CADxC,EAEGgD,KAAKhD,WAAWW,SAASsC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAlD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW4C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
1
+ {"version":3,"file":"ReadOnlyTextV2.cjs.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\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\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 mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: 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} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: 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 const listStyles = useStyle({\n listStylePosition: 'inside',\n paddingInlineStart: '20px',\n listStyleType: 'disc',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles, listStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles, listStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\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, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\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} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\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.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(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.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))\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":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","listStyles","listStylePosition","paddingInlineStart","listStyleType","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,MAAAA,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AAAAA,GACrBC,KACA;;AACMC,QAAAA,sBAAsBC,QAAQJ,WAAD;AAEnC,QAAMK,OAAOJ,yCAASK,WAAWC,OAAOF,SAA3BJ,YAAmCO,UAAeC,eAAAA;AAG7D,wCAAA,OAAA;AAAA,IAAK;AAAA,IACFN,UAAAA,wBAAwB,KACvBO,2BAAA,IAAC,aAAD,EAAA,IAEAA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,MAA0B;AAAA,IAAA,CAAvC;AAAA,EAAA,CALN;AASD,CAjBgC;AAqBjC,qBAAqB;AAAA,EAAEX,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWY,UAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTC,OAAO;AAAA,MACPC,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBlB,UAAAA;AAAA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,WAAWQ;AAAAA,SACZC,UAAAA,WAAWK;AAAAA,SACXL,UAAAA,WAAWC;AAAAA,SACXD,UAAAA,WAAWI;AAAAA,SACXJ,UAAWG,WAAAA;AACPZ,aAAAA,iBAAWW,SAASoC,IAAI/C,CAAckD,gBAAAA,oBAAoBlD,WAAD,CAAzD,EAAuEmD,KAAK,EAA5E,MAAAnD,YAAmF;AAAA,SACvF6B,UAAAA,UAAUI;AAAAA,SACVJ,UAAAA,UAAUK;AAAAA,SACVL,UAAAA,UAAUM;AAAAA,SACVN,UAAAA,UAAUU;AAAAA,SACVV,UAAAA,UAAUG;AAAAA,SACVH,UAAAA,UAAUW;AAAAA,SACVX,UAAAA,UAAUY;AAAAA,SACVZ,UAAAA,UAAUa;AAAAA,SACVb,UAAUc,UAAAA;AAEX3C,aAAAA,iBAAWW,SACRoC,IAAI/C,CAAckD,gBAAAA,oBAAoBlD,WAAD,CADxC,EAEGmD,KAAKnD,WAAWW,SAASyC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAArD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW+C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
@@ -1,7 +1,8 @@
1
1
  import { cx } from "@emotion/css";
2
2
  import { forwardRef } from "react";
3
3
  import { U as useEnhancedTypography, V as useTypographyClassName, n as useResponsiveStyle } from "./index.es.js";
4
- import { b7 as RichTextV2Mode, U as useStyle, be as BlockType, bc as InlineType } from "./react-page.es.js";
4
+ import { b8 as RichTextV2Mode, U as useStyle, bf as BlockType, bd as InlineType } from "./react-page.es.js";
5
+ import "./actions.es.js";
5
6
  import { L as Link } from "./index.es3.js";
6
7
  import "slate";
7
8
  import "./state/breakpoints.es.js";
@@ -11,7 +12,6 @@ import "slate-react";
11
12
  import { jsx, Fragment } from "react/jsx-runtime";
12
13
  import "use-sync-external-store/shim/with-selector";
13
14
  import "next/dynamic";
14
- import "./actions.es.js";
15
15
  import "./typography.es.js";
16
16
  import "./combobox.es.js";
17
17
  import "use-sync-external-store/shim";
@@ -21,8 +21,6 @@ import "./types.es.js";
21
21
  import "./box-models.es.js";
22
22
  import "css-box-model";
23
23
  import "color";
24
- import "@emotion/serialize";
25
- import "@emotion/utils";
26
24
  import "scroll-into-view-if-needed";
27
25
  import "react-dom";
28
26
  import "html-react-parser";
@@ -38,6 +36,8 @@ import "set-cookie-parser";
38
36
  import "./constants.es.js";
39
37
  import "uuid";
40
38
  import "corporate-ipsum";
39
+ import "@emotion/serialize";
40
+ import "@emotion/utils";
41
41
  import "next/link";
42
42
  const ReadOnlyTextV2 = forwardRef(function ReadOnlyText({
43
43
  text: descendants,
@@ -134,6 +134,11 @@ function BlockElement({
134
134
  fontWeight: "300",
135
135
  borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
136
136
  });
137
+ const listStyles = useStyle({
138
+ listStylePosition: "inside",
139
+ paddingInlineStart: "20px",
140
+ listStyleType: "disc"
141
+ });
137
142
  switch (descendant.type) {
138
143
  case BlockType.Text:
139
144
  return /* @__PURE__ */ jsx("span", {
@@ -209,10 +214,7 @@ function BlockElement({
209
214
  });
210
215
  case BlockType.OrderedList:
211
216
  return /* @__PURE__ */ jsx("ol", {
212
- className: cx(...blockStyles),
213
- style: {
214
- listStylePosition: "inside"
215
- },
217
+ className: cx(...blockStyles, listStyles),
216
218
  children: /* @__PURE__ */ jsx(Descendants, {
217
219
  descendants: descendant.children,
218
220
  mode
@@ -220,10 +222,7 @@ function BlockElement({
220
222
  });
221
223
  case BlockType.UnorderedList:
222
224
  return /* @__PURE__ */ jsx("ul", {
223
- className: cx(...blockStyles),
224
- style: {
225
- listStylePosition: "inside"
226
- },
225
+ className: cx(...blockStyles, listStyles),
227
226
  children: /* @__PURE__ */ jsx(Descendants, {
228
227
  descendants: descendant.children,
229
228
  mode
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\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\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 mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: 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} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: 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.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles)} style={{ listStylePosition: 'inside' }}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\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, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\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} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\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.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(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.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))\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":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,E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OA,iBAAWnB,SAAXmB,YAAmB;AAAA,EAC3B;AAEOA,UAAAA,WAAWQ;AAAAA,SACZC,WAAWK;AAAAA,SACXL,WAAWC;AAAAA,SACXD,WAAWI;AAAAA,SACXJ,WAAWG;AACPZ,aAAAA,iBAAWW,SAASiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CAAzD,EAAuEgD,KAAK,EAA5E,MAAAhD,YAAmF;AAAA,SACvFyB,UAAUI;AAAAA,SACVJ,UAAUK;AAAAA,SACVL,UAAUM;AAAAA,SACVN,UAAUU;AAAAA,SACVV,UAAUG;AAAAA,SACVH,UAAUW;AAAAA,SACVX,UAAUa;AAAAA,SACVb,UAAUc;AAAAA,SACVd,UAAUe;AAEXxC,aAAAA,iBAAWW,SACRiC,IAAI5C,CAAc+C,gBAAAA,oBAAoB/C,WAAD,CADxC,EAEGgD,KAAKhD,WAAWW,SAASsC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAAlD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW4C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
1
+ {"version":3,"file":"ReadOnlyTextV2.es.js","sources":["../src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { useResponsiveStyle } from '../../../../components/utils/responsive-style'\nimport { RichTextV2Control, RichTextV2ControlData, RichTextV2Mode } from '../../../../controls'\nimport { useStyle } from '../../use-style'\nimport { Descendant, Text } from 'slate'\nimport { Link } from '../../../../components/shared/Link'\nimport { Inline, InlineType, Block, BlockType } from '../../../../slate'\nimport useEnhancedTypography, { useTypographyClassName } from '../typography'\n\ntype Props = {\n text: RichTextV2ControlData\n control: RichTextV2Control | null\n}\n\nconst ReadOnlyTextV2 = forwardRef(function ReadOnlyText(\n { text: descendants, control }: Props,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const descendantsAsString = getText(descendants)\n\n const mode = control?.descriptor.config.mode ?? RichTextV2Mode.Block\n\n return (\n <div ref={ref}>\n {descendantsAsString === '' ? (\n <Placeholder />\n ) : (\n <Descendants descendants={descendants} mode={mode} />\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\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 mode: RichTextV2Mode\n}\n\nfunction InlineElement({ descendant, mode }: 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} mode={mode} />\n </code>\n )\n\n case InlineType.SuperScript:\n return (\n <sup>\n <Descendants descendants={descendant.children} mode={mode} />\n </sup>\n )\n\n case InlineType.SubScript:\n return (\n <sub>\n <Descendants descendants={descendant.children} mode={mode} />\n </sub>\n )\n\n case InlineType.Link:\n return (\n <Link className={linkClassName} link={descendant.link}>\n <Descendants descendants={descendant.children} mode={mode} />\n </Link>\n )\n }\n}\n\nexport interface BlockProps {\n descendant: Block\n mode: RichTextV2Mode\n}\n\nexport function BlockElement({ descendant, mode }: 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 const listStyles = useStyle({\n listStylePosition: 'inside',\n paddingInlineStart: '20px',\n listStyleType: 'disc',\n })\n\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n case BlockType.Paragraph:\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\n case BlockType.Heading1:\n return (\n <h1 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h1>\n )\n case BlockType.Heading2:\n return (\n <h2 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h2>\n )\n case BlockType.Heading3:\n return (\n <h3 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h3>\n )\n case BlockType.Heading4:\n return (\n <h4 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h4>\n )\n case BlockType.Heading5:\n return (\n <h5 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h5>\n )\n case BlockType.Heading6:\n return (\n <h6 className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </h6>\n )\n case BlockType.BlockQuote:\n return (\n <blockquote className={cx(...blockStyles, quoteStyle)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </blockquote>\n )\n case BlockType.OrderedList:\n return (\n <ol className={cx(...blockStyles, listStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ol>\n )\n case BlockType.UnorderedList:\n return (\n <ul className={cx(...blockStyles, listStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </ul>\n )\n case BlockType.ListItem:\n return (\n <li className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </li>\n )\n case BlockType.ListItemChild:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n default:\n if (mode === RichTextV2Mode.Inline)\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </span>\n )\n return (\n <p className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} mode={mode} />\n </p>\n )\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, mode }: { descendants: Descendant[]; mode: RichTextV2Mode }) {\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} mode={mode} />\n case BlockType.Heading1:\n case BlockType.Heading2:\n case BlockType.Heading3:\n case BlockType.BlockQuote:\n case BlockType.Text:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n return <BlockElement key={index} descendant={descendant} mode={mode} />\n default:\n return null\n }\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.BlockQuote:\n case BlockType.Paragraph:\n case BlockType.OrderedList:\n case BlockType.UnorderedList:\n case BlockType.ListItem:\n case BlockType.ListItemChild:\n case BlockType.Text:\n return true\n\n default:\n return false\n }\n}\n\nfunction getTextByDescendant(descendant: Descendant): string {\n if (isText(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.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))\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":["ReadOnlyTextV2","forwardRef","text","descendants","control","ref","descendantsAsString","getText","mode","descriptor","config","RichTextV2Mode","Block","_jsx","useStyle","display","width","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","margin","useResponsiveStyle","textAlign","quoteStyle","padding","fontSize","fontWeight","borderLeft","listStyles","listStylePosition","paddingInlineStart","listStyleType","BlockType","Text","cx","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","OrderedList","UnorderedList","ListItem","ListItemChild","Inline","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeMA,MAAAA,iBAAiBC,WAAW,sBAChC;AAAA,EAAEC,MAAMC;AAAAA,EAAaC;AAAAA,GACrBC,KACA;;AACMC,QAAAA,sBAAsBC,QAAQJ,WAAD;AAEnC,QAAMK,OAAOJ,yCAASK,WAAWC,OAAOF,SAA3BJ,YAAmCO,eAAeC;AAG7D,6BAAA,OAAA;AAAA,IAAK;AAAA,IACFN,UAAAA,wBAAwB,KACvBO,oBAAC,aAAD,EAAA,IAEAA,oBAAC,aAAD;AAAA,MAAa;AAAA,MAA0B;AAAA,IAAA,CAAvC;AAAA,EAAA,CALN;AASD,CAjBgC;AAqBjC,qBAAqB;AAAA,EAAEX,OAAO;AAAA,GAA2C;AAErE,6BAAA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UAAUU;AAAAA,SACVV,UAAUG;AAAAA,SACVH,UAAUW;AAAAA,SACVX,UAAUY;AAAAA,SACVZ,UAAUa;AAAAA,SACVb,UAAUc;AAEX3C,aAAAA,iBAAWW,SACRoC,IAAI/C,CAAckD,gBAAAA,oBAAoBlD,WAAD,CADxC,EAEGmD,KAAKnD,WAAWW,SAASyC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAArD,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAW+C,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
package/dist/Root.cjs.js CHANGED
@@ -13,6 +13,7 @@ var utils = require("@emotion/utils");
13
13
  require("redux");
14
14
  require("redux-thunk");
15
15
  require("./actions.cjs.js");
16
+ require("zod");
16
17
  require("./state/breakpoints.cjs.js");
17
18
  require("slate");
18
19
  require("use-sync-external-store/shim/with-selector");
@@ -28,7 +29,6 @@ require("scroll-into-view-if-needed");
28
29
  require("react-dom");
29
30
  require("html-react-parser");
30
31
  require("next/head");
31
- require("zod");
32
32
  require("@emotion/server/create-instance");
33
33
  require("next/document");
34
34
  require("cors");
package/dist/Root.es.js CHANGED
@@ -12,6 +12,7 @@ import { insertStyles } from "@emotion/utils";
12
12
  import "redux";
13
13
  import "redux-thunk";
14
14
  import "./actions.es.js";
15
+ import "zod";
15
16
  import "./state/breakpoints.es.js";
16
17
  import "slate";
17
18
  import "use-sync-external-store/shim/with-selector";
@@ -27,7 +28,6 @@ import "scroll-into-view-if-needed";
27
28
  import "react-dom";
28
29
  import "html-react-parser";
29
30
  import "next/head";
30
- import "zod";
31
31
  import "@emotion/server/create-instance";
32
32
  import "next/document";
33
33
  import "cors";
@@ -43,6 +43,7 @@ require("next/link");
43
43
  require("use-sync-external-store/shim/with-selector");
44
44
  require("next/dynamic");
45
45
  require("./actions.cjs.js");
46
+ require("zod");
46
47
  require("./typography.cjs.js");
47
48
  require("./combobox.cjs.js");
48
49
  require("slate");
@@ -54,12 +55,9 @@ require("./state/breakpoints.cjs.js");
54
55
  require("./box-models.cjs.js");
55
56
  require("css-box-model");
56
57
  require("color");
57
- require("@emotion/serialize");
58
- require("@emotion/utils");
59
58
  require("react-dom");
60
59
  require("html-react-parser");
61
60
  require("next/head");
62
- require("zod");
63
61
  require("@emotion/server/create-instance");
64
62
  require("next/document");
65
63
  require("cors");
@@ -70,6 +68,8 @@ require("set-cookie-parser");
70
68
  require("./constants.cjs.js");
71
69
  require("uuid");
72
70
  require("corporate-ipsum");
71
+ require("@emotion/serialize");
72
+ require("@emotion/utils");
73
73
  function _interopNamespace(e) {
74
74
  if (e && e.__esModule)
75
75
  return e;
@@ -42,6 +42,7 @@ import "next/link";
42
42
  import "use-sync-external-store/shim/with-selector";
43
43
  import "next/dynamic";
44
44
  import "./actions.es.js";
45
+ import "zod";
45
46
  import "./typography.es.js";
46
47
  import "./combobox.es.js";
47
48
  import "slate";
@@ -53,12 +54,9 @@ import "./state/breakpoints.es.js";
53
54
  import "./box-models.es.js";
54
55
  import "css-box-model";
55
56
  import "color";
56
- import "@emotion/serialize";
57
- import "@emotion/utils";
58
57
  import "react-dom";
59
58
  import "html-react-parser";
60
59
  import "next/head";
61
- import "zod";
62
60
  import "@emotion/server/create-instance";
63
61
  import "next/document";
64
62
  import "cors";
@@ -69,6 +67,8 @@ import "set-cookie-parser";
69
67
  import "./constants.es.js";
70
68
  import "uuid";
71
69
  import "corporate-ipsum";
70
+ import "@emotion/serialize";
71
+ import "@emotion/utils";
72
72
  var _path$m;
73
73
  function _extends$m() {
74
74
  _extends$m = Object.assign || function(target) {
package/dist/Text.cjs.js CHANGED
@@ -28,6 +28,7 @@ require("./react-page.cjs.js");
28
28
  require("redux");
29
29
  require("redux-thunk");
30
30
  require("./actions.cjs.js");
31
+ require("zod");
31
32
  require("./state/breakpoints.cjs.js");
32
33
  require("@emotion/css");
33
34
  require("@emotion/serialize");
@@ -44,7 +45,6 @@ require("scroll-into-view-if-needed");
44
45
  require("react-dom");
45
46
  require("html-react-parser");
46
47
  require("next/head");
47
- require("zod");
48
48
  require("@emotion/server/create-instance");
49
49
  require("next/document");
50
50
  require("cors");
package/dist/Text.es.js CHANGED
@@ -26,6 +26,7 @@ import "./react-page.es.js";
26
26
  import "redux";
27
27
  import "redux-thunk";
28
28
  import "./actions.es.js";
29
+ import "zod";
29
30
  import "./state/breakpoints.es.js";
30
31
  import "@emotion/css";
31
32
  import "@emotion/serialize";
@@ -42,7 +43,6 @@ import "scroll-into-view-if-needed";
42
43
  import "react-dom";
43
44
  import "html-react-parser";
44
45
  import "next/head";
45
- import "zod";
46
46
  import "@emotion/server/create-instance";
47
47
  import "next/document";
48
48
  import "cors";
package/dist/Video.cjs.js CHANGED
@@ -28,6 +28,7 @@ var jsxRuntime = require("react/jsx-runtime");
28
28
  require("redux");
29
29
  require("redux-thunk");
30
30
  require("./actions.cjs.js");
31
+ require("zod");
31
32
  require("./state/breakpoints.cjs.js");
32
33
  require("@emotion/serialize");
33
34
  require("@emotion/utils");
@@ -1 +1 @@
1
- {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,qBAAAA,WAAYC,QAAQR,MAAMM,GAA1B;AAI3C,QAAA,CAACG,yBAAyBC,8BAA8BC,MAAAA,SAAS,KAAD;AAEtEC,QAAAA,UAAU,MAAM;AACdF,+BAA2B,IAAD;AAAA,EADnB,GAEN,CAFM,CAAA;AAKP,wCAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAWG,OACTC,mBAAS;AAAA,MAAEC,SAAS;AAAA,MAAQC,eAAe;AAAA,MAAUC,UAAU;AAAA,IAAA,CAAvD,GACRhB,OACAC,QACAC,YAJW;AAAA,IAOb,yCAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEe,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMvB;AAAAA,MAAzD;AAAA,MACE,yCAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEsB,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QACGd,UAAAA,2BAA2BJ,eAAe,sCACxCE,qBAAAA,YAAD,iCACMP,QADN;AAAA,UAEE,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNwB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAY1B,SAAS,QAAQ,CAACA,MAAM2B;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkB9B,SAAS,QAAQA,MAAM+B,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAC,2BAAA,IAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKC,aAAAA,aAAajC,MAAMkC;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAXJ;AAkCD,CAhDuB;;"}
1
+ {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAA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AA,IAAA,CADF;AAAA,EAAA,CAXJ;AAkCD,CAhDuB;;"}
package/dist/Video.es.js CHANGED
@@ -26,6 +26,7 @@ import { jsx } from "react/jsx-runtime";
26
26
  import "redux";
27
27
  import "redux-thunk";
28
28
  import "./actions.es.js";
29
+ import "zod";
29
30
  import "./state/breakpoints.es.js";
30
31
  import "@emotion/serialize";
31
32
  import "@emotion/utils";
@@ -1 +1 @@
1
- {"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,YAAYC,QAAQR,MAAMM,GAA1B;AAI3C,QAAA,CAACG,yBAAyBC,8BAA8BC,SAAS,KAAD;AAEtEC,YAAU,MAAM;AACdF,+BAA2B,IAAD;AAAA,EADnB,GAEN,CAFM,CAAA;AAKP,6BAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAWG,GACTC,SAAS;AAAA,MAAEC,SAAS;AAAA,MAAQC,eAAe;AAAA,MAAUC,UAAU;AAAA,IAAA,CAAvD,GACRhB,OACAC,QACAC,YAJW;AAAA,IAOb,8BAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEe,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMvB;AAAAA,MAAzD;AAAA,MACE,8BAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEsB,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QACGd,UAAAA,2BAA2BJ,eAAe,2BACxC,aAAD,iCACML,QADN;AAAA,UAEE,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNwB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAY1B,SAAS,QAAQ,CAACA,MAAM2B;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkB9B,SAAS,QAAQA,MAAM+B,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAC,oBAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKC,aAAajC,MAAMkC;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAXJ;AAkCD,CAhDuB;;"}
1
+ {"version":3,"file":"Video.es.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,YAAYC,QAAQR,MAAMM,GAA1B;AAI3C,QAAA,CAACG,yBAAyBC,8BAA8BC,SAAS,KAAD;AAEtEC,YAAU,MAAM;AACdF,+BAA2B,IAAD;AAAA,EADnB,GAEN,CAFM,CAAA;AAKP,6BAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAWG,GACTC,SAAS;AAAA,MAAEC,SAAS;AAAA,MAAQC,eAAe;AAAA,MAAUC,UAAU;AAAA,IAAA,CAAvD,GACRhB,OACAC,QACAC,YAJW;AAAA,IAOb,8BAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEe,UAAU;AAAA,QAAYC,YAAa,GAAE,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