@makeswift/runtime 0.8.10 → 0.8.11

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 (518) hide show
  1. package/dist/Box.cjs.js +6 -4
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +6 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +6 -4
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +6 -4
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +9 -7
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +9 -7
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +6 -4
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +6 -4
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +6 -4
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +6 -4
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +6 -4
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +6 -4
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +6 -4
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +6 -4
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +6 -4
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +6 -4
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +8 -6
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +7 -5
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +6 -4
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +6 -4
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +35 -33
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +6 -4
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +65 -61
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +11 -7
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/ReadOnlyTextV2.cjs.js +129 -85
  50. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  51. package/dist/ReadOnlyTextV2.es.js +75 -31
  52. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  53. package/dist/Root.cjs.js +6 -4
  54. package/dist/Root.cjs.js.map +1 -1
  55. package/dist/Root.es.js +6 -4
  56. package/dist/Root.es.js.map +1 -1
  57. package/dist/SocialLinks.cjs.js +6 -4
  58. package/dist/SocialLinks.cjs.js.map +1 -1
  59. package/dist/SocialLinks.es.js +6 -4
  60. package/dist/SocialLinks.es.js.map +1 -1
  61. package/dist/Text.cjs.js +7 -5
  62. package/dist/Text.cjs.js.map +1 -1
  63. package/dist/Text.es.js +7 -5
  64. package/dist/Text.es.js.map +1 -1
  65. package/dist/Video.cjs.js +6 -4
  66. package/dist/Video.cjs.js.map +1 -1
  67. package/dist/Video.es.js +6 -4
  68. package/dist/Video.es.js.map +1 -1
  69. package/dist/builder.cjs.js +7 -2
  70. package/dist/builder.cjs.js.map +1 -1
  71. package/dist/builder.es.js +7 -2
  72. package/dist/builder.es.js.map +1 -1
  73. package/dist/components.cjs.js +8 -6
  74. package/dist/components.cjs.js.map +1 -1
  75. package/dist/components.es.js +8 -6
  76. package/dist/components.es.js.map +1 -1
  77. package/dist/constants.cjs.js +0 -408
  78. package/dist/constants.cjs.js.map +1 -1
  79. package/dist/constants.es.js +1 -372
  80. package/dist/constants.es.js.map +1 -1
  81. package/dist/control-serialization.cjs.js +84 -41
  82. package/dist/control-serialization.cjs.js.map +1 -1
  83. package/dist/control-serialization.es.js +44 -1
  84. package/dist/control-serialization.es.js.map +1 -1
  85. package/dist/controls.cjs.js +59 -50
  86. package/dist/controls.cjs.js.map +1 -1
  87. package/dist/controls.es.js +9 -3
  88. package/dist/controls.es.js.map +1 -1
  89. package/dist/index.cjs.js +286 -282
  90. package/dist/index.cjs.js.map +1 -1
  91. package/dist/index.cjs10.js +371 -0
  92. package/dist/index.cjs10.js.map +1 -0
  93. package/dist/index.cjs2.js +10 -8
  94. package/dist/index.cjs2.js.map +1 -1
  95. package/dist/index.cjs5.js +107 -63
  96. package/dist/index.cjs5.js.map +1 -1
  97. package/dist/index.cjs6.js +7 -7
  98. package/dist/index.cjs6.js.map +1 -1
  99. package/dist/index.cjs7.js +69 -39
  100. package/dist/index.cjs7.js.map +1 -1
  101. package/dist/index.cjs8.js +14 -180
  102. package/dist/index.cjs8.js.map +1 -1
  103. package/dist/index.cjs9.js +152 -265
  104. package/dist/index.cjs9.js.map +1 -1
  105. package/dist/index.es.js +50 -46
  106. package/dist/index.es.js.map +1 -1
  107. package/dist/index.es10.js +364 -0
  108. package/dist/index.es10.js.map +1 -0
  109. package/dist/index.es2.js +5 -3
  110. package/dist/index.es2.js.map +1 -1
  111. package/dist/index.es5.js +70 -26
  112. package/dist/index.es5.js.map +1 -1
  113. package/dist/index.es6.js +5 -5
  114. package/dist/index.es6.js.map +1 -1
  115. package/dist/index.es7.js +68 -37
  116. package/dist/index.es7.js.map +1 -1
  117. package/dist/index.es8.js +13 -175
  118. package/dist/index.es8.js.map +1 -1
  119. package/dist/index.es9.js +149 -262
  120. package/dist/index.es9.js.map +1 -1
  121. package/dist/leaf.cjs.js +4 -4
  122. package/dist/leaf.cjs.js.map +1 -1
  123. package/dist/leaf.es.js +1 -1
  124. package/dist/leaf.es.js.map +1 -1
  125. package/dist/main.cjs.js +5 -4
  126. package/dist/main.cjs.js.map +1 -1
  127. package/dist/main.es.js +5 -4
  128. package/dist/main.es.js.map +1 -1
  129. package/dist/next.cjs.js +6 -4
  130. package/dist/next.cjs.js.map +1 -1
  131. package/dist/next.es.js +6 -4
  132. package/dist/next.es.js.map +1 -1
  133. package/dist/prop-controllers.cjs.js +11 -7
  134. package/dist/prop-controllers.cjs.js.map +1 -1
  135. package/dist/prop-controllers.es.js +7 -3
  136. package/dist/prop-controllers.es.js.map +1 -1
  137. package/dist/{descriptors.cjs.js → react-page.cjs.js} +899 -92
  138. package/dist/react-page.cjs.js.map +1 -0
  139. package/dist/{descriptors.es.js → react-page.es.js} +821 -70
  140. package/dist/react-page.es.js.map +1 -0
  141. package/dist/react.cjs.js +6 -4
  142. package/dist/react.cjs.js.map +1 -1
  143. package/dist/react.es.js +6 -4
  144. package/dist/react.es.js.map +1 -1
  145. package/dist/select.cjs.js +8 -0
  146. package/dist/select.cjs.js.map +1 -0
  147. package/dist/select.es.js +6 -0
  148. package/dist/select.es.js.map +1 -0
  149. package/dist/slate.cjs.js +15 -7
  150. package/dist/slate.cjs.js.map +1 -1
  151. package/dist/slate.es.js +7 -4
  152. package/dist/slate.es.js.map +1 -1
  153. package/dist/state/breakpoints.cjs.js.map +1 -1
  154. package/dist/state/breakpoints.es.js.map +1 -1
  155. package/dist/text-input.cjs.js +0 -6
  156. package/dist/text-input.cjs.js.map +1 -1
  157. package/dist/text-input.es.js +1 -5
  158. package/dist/text-input.es.js.map +1 -1
  159. package/dist/types/src/api/graphql/generated/types.d.ts +36 -36
  160. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  161. package/dist/types/src/api/graphql/types.d.ts +2 -2
  162. package/dist/types/src/api/graphql/types.d.ts.map +1 -1
  163. package/dist/types/src/api/react.d.ts +3 -3
  164. package/dist/types/src/api/react.d.ts.map +1 -1
  165. package/dist/types/src/builder/serialization/control-serialization.d.ts +66 -66
  166. package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
  167. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +5 -0
  168. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -0
  169. package/dist/types/src/builder/serialization/controls/types.d.ts +3 -3
  170. package/dist/types/src/builder/serialization/controls/types.d.ts.map +1 -1
  171. package/dist/types/src/builder/serialization/function-serialization.d.ts +4 -4
  172. package/dist/types/src/builder/serialization/function-serialization.d.ts.map +1 -1
  173. package/dist/types/src/components/builtin/Box/animations.d.ts +1 -1
  174. package/dist/types/src/components/builtin/Box/animations.d.ts.map +1 -1
  175. package/dist/types/src/components/builtin/Box/components/Placeholder/index.d.ts +1 -1
  176. package/dist/types/src/components/builtin/Box/components/Placeholder/index.d.ts.map +1 -1
  177. package/dist/types/src/components/builtin/Box/constants.d.ts +1 -1
  178. package/dist/types/src/components/builtin/Box/constants.d.ts.map +1 -1
  179. package/dist/types/src/components/builtin/Button/Button.d.ts +3 -3
  180. package/dist/types/src/components/builtin/Button/Button.d.ts.map +1 -1
  181. package/dist/types/src/components/builtin/Button/contants.d.ts +1 -1
  182. package/dist/types/src/components/builtin/Button/contants.d.ts.map +1 -1
  183. package/dist/types/src/components/builtin/Carousel/Carousel.d.ts +1 -1
  184. package/dist/types/src/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  185. package/dist/types/src/components/builtin/Countdown/Countdown.d.ts +1 -1
  186. package/dist/types/src/components/builtin/Countdown/Countdown.d.ts.map +1 -1
  187. package/dist/types/src/components/builtin/Divider/Divider.d.ts +2 -2
  188. package/dist/types/src/components/builtin/Divider/Divider.d.ts.map +1 -1
  189. package/dist/types/src/components/builtin/Embed/Embed.d.ts +1 -1
  190. package/dist/types/src/components/builtin/Embed/Embed.d.ts.map +1 -1
  191. package/dist/types/src/components/builtin/Form/Form.d.ts +2 -2
  192. package/dist/types/src/components/builtin/Form/Form.d.ts.map +1 -1
  193. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +2 -2
  194. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts.map +1 -1
  195. package/dist/types/src/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts +1 -1
  196. package/dist/types/src/components/builtin/Form/components/Field/components/CheckboxTableField/index.d.ts.map +1 -1
  197. package/dist/types/src/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts +1 -1
  198. package/dist/types/src/components/builtin/Form/components/Field/components/EmailTableField/index.d.ts.map +1 -1
  199. package/dist/types/src/components/builtin/Form/components/Field/components/Input/index.d.ts +1 -1
  200. package/dist/types/src/components/builtin/Form/components/Field/components/Input/index.d.ts.map +1 -1
  201. package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts +2 -2
  202. package/dist/types/src/components/builtin/Form/components/Field/components/Label/index.d.ts.map +1 -1
  203. package/dist/types/src/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts +1 -1
  204. package/dist/types/src/components/builtin/Form/components/Field/components/LongTextTableField/index.d.ts.map +1 -1
  205. package/dist/types/src/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts +1 -1
  206. package/dist/types/src/components/builtin/Form/components/Field/components/MultipleSelectTableField/index.d.ts.map +1 -1
  207. package/dist/types/src/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts +1 -1
  208. package/dist/types/src/components/builtin/Form/components/Field/components/NumberTableField/index.d.ts.map +1 -1
  209. package/dist/types/src/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts +1 -1
  210. package/dist/types/src/components/builtin/Form/components/Field/components/PhoneNumberTableField/index.d.ts.map +1 -1
  211. package/dist/types/src/components/builtin/Form/components/Field/components/RadioButton/index.d.ts +1 -1
  212. package/dist/types/src/components/builtin/Form/components/Field/components/RadioButton/index.d.ts.map +1 -1
  213. package/dist/types/src/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts +1 -1
  214. package/dist/types/src/components/builtin/Form/components/Field/components/SingleLineTextTableField/index.d.ts.map +1 -1
  215. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts +1 -1
  216. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnRadioButtonGroup/index.d.ts.map +1 -1
  217. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts +1 -1
  218. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/components/TableColumnSingleSelect/index.d.ts.map +1 -1
  219. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts +1 -1
  220. package/dist/types/src/components/builtin/Form/components/Field/components/SingleSelectTableField/index.d.ts.map +1 -1
  221. package/dist/types/src/components/builtin/Form/components/Field/components/TextArea/index.d.ts +1 -1
  222. package/dist/types/src/components/builtin/Form/components/Field/components/TextArea/index.d.ts.map +1 -1
  223. package/dist/types/src/components/builtin/Form/components/Field/components/URLTableField/index.d.ts +1 -1
  224. package/dist/types/src/components/builtin/Form/components/Field/components/URLTableField/index.d.ts.map +1 -1
  225. package/dist/types/src/components/builtin/Form/components/Field/index.d.ts +2 -2
  226. package/dist/types/src/components/builtin/Form/components/Field/index.d.ts.map +1 -1
  227. package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts +1 -1
  228. package/dist/types/src/components/builtin/Form/components/Placeholder/index.d.ts.map +1 -1
  229. package/dist/types/src/components/builtin/Form/context/FormContext.d.ts +5 -5
  230. package/dist/types/src/components/builtin/Form/context/FormContext.d.ts.map +1 -1
  231. package/dist/types/src/components/builtin/Form/types.d.ts +13 -13
  232. package/dist/types/src/components/builtin/Form/types.d.ts.map +1 -1
  233. package/dist/types/src/components/builtin/Image/Image.d.ts +1 -1
  234. package/dist/types/src/components/builtin/Image/Image.d.ts.map +1 -1
  235. package/dist/types/src/components/builtin/Navigation/Navigation.d.ts +1 -1
  236. package/dist/types/src/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  237. package/dist/types/src/components/builtin/Navigation/components/DropDownButton/index.d.ts +3 -3
  238. package/dist/types/src/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  239. package/dist/types/src/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts +1 -1
  240. package/dist/types/src/components/builtin/Navigation/components/LinksPlaceholder/index.d.ts.map +1 -1
  241. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +3 -3
  242. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  243. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts +1 -1
  244. package/dist/types/src/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  245. package/dist/types/src/components/builtin/Root/Root.d.ts +1 -1
  246. package/dist/types/src/components/builtin/Root/Root.d.ts.map +1 -1
  247. package/dist/types/src/components/builtin/SocialLinks/SocialLinks.d.ts +1 -1
  248. package/dist/types/src/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
  249. package/dist/types/src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts +1 -1
  250. package/dist/types/src/components/builtin/SocialLinks/components/SocialLinksPlaceholder/index.d.ts.map +1 -1
  251. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts +1 -1
  252. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
  253. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts +3 -3
  254. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  255. package/dist/types/src/components/builtin/Text/Text.d.ts +1 -1
  256. package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
  257. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts +2 -2
  258. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
  259. package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts +1 -1
  260. package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +1 -1
  261. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +5 -5
  262. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  263. package/dist/types/src/components/builtin/Video/Video.d.ts +1 -1
  264. package/dist/types/src/components/builtin/Video/Video.d.ts.map +1 -1
  265. package/dist/types/src/components/hooks/useBackgrounds.d.ts +8 -8
  266. package/dist/types/src/components/hooks/useBackgrounds.d.ts.map +1 -1
  267. package/dist/types/src/components/hooks/useBorder.d.ts +3 -3
  268. package/dist/types/src/components/hooks/useBorder.d.ts.map +1 -1
  269. package/dist/types/src/components/hooks/useBoxShadow.d.ts +3 -3
  270. package/dist/types/src/components/hooks/useBoxShadow.d.ts.map +1 -1
  271. package/dist/types/src/components/page/BodySnippet.d.ts +1 -1
  272. package/dist/types/src/components/page/BodySnippet.d.ts.map +1 -1
  273. package/dist/types/src/components/page/Page.d.ts +1 -1
  274. package/dist/types/src/components/page/Page.d.ts.map +1 -1
  275. package/dist/types/src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts +1 -1
  276. package/dist/types/src/components/shared/BackgroundsContainer/components/BackgroundVideo/index.d.ts.map +1 -1
  277. package/dist/types/src/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts +1 -1
  278. package/dist/types/src/components/shared/BackgroundsContainer/components/Backgrounds/index.d.ts.map +1 -1
  279. package/dist/types/src/components/shared/BackgroundsContainer/components/Parallax/index.d.ts +1 -1
  280. package/dist/types/src/components/shared/BackgroundsContainer/components/Parallax/index.d.ts.map +1 -1
  281. package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts +1 -1
  282. package/dist/types/src/components/shared/BackgroundsContainer/index.d.ts.map +1 -1
  283. package/dist/types/src/components/shared/FallbackComponent/FallbackComponent.d.ts +1 -1
  284. package/dist/types/src/components/shared/FallbackComponent/FallbackComponent.d.ts.map +1 -1
  285. package/dist/types/src/components/shared/GutterContainer/index.d.ts +2 -2
  286. package/dist/types/src/components/shared/GutterContainer/index.d.ts.map +1 -1
  287. package/dist/types/src/components/shared/Link/index.d.ts +1 -1
  288. package/dist/types/src/components/shared/Link/index.d.ts.map +1 -1
  289. package/dist/types/src/components/shared/grid-item.d.ts +2 -2
  290. package/dist/types/src/components/shared/grid-item.d.ts.map +1 -1
  291. package/dist/types/src/components/utils/drop-first.d.ts +1 -1
  292. package/dist/types/src/components/utils/drop-first.d.ts.map +1 -1
  293. package/dist/types/src/components/utils/types.d.ts +2 -2
  294. package/dist/types/src/components/utils/types.d.ts.map +1 -1
  295. package/dist/types/src/controls/checkbox.d.ts +3 -3
  296. package/dist/types/src/controls/checkbox.d.ts.map +1 -1
  297. package/dist/types/src/controls/color.d.ts +3 -3
  298. package/dist/types/src/controls/color.d.ts.map +1 -1
  299. package/dist/types/src/controls/combobox.d.ts +5 -5
  300. package/dist/types/src/controls/combobox.d.ts.map +1 -1
  301. package/dist/types/src/controls/control.d.ts +6 -4
  302. package/dist/types/src/controls/control.d.ts.map +1 -1
  303. package/dist/types/src/controls/image.d.ts +4 -4
  304. package/dist/types/src/controls/image.d.ts.map +1 -1
  305. package/dist/types/src/controls/link.d.ts +8 -8
  306. package/dist/types/src/controls/link.d.ts.map +1 -1
  307. package/dist/types/src/controls/list.d.ts +6 -6
  308. package/dist/types/src/controls/list.d.ts.map +1 -1
  309. package/dist/types/src/controls/number.d.ts +3 -3
  310. package/dist/types/src/controls/number.d.ts.map +1 -1
  311. package/dist/types/src/controls/rich-text/dto-types.d.ts +4 -4
  312. package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -1
  313. package/dist/types/src/controls/rich-text/rich-text.d.ts +11 -11
  314. package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
  315. package/dist/types/src/controls/rich-text/translation.d.ts +1 -1
  316. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
  317. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +38 -17
  318. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  319. package/dist/types/src/controls/select.d.ts +5 -5
  320. package/dist/types/src/controls/select.d.ts.map +1 -1
  321. package/dist/types/src/controls/shape.d.ts +5 -5
  322. package/dist/types/src/controls/shape.d.ts.map +1 -1
  323. package/dist/types/src/controls/slot.d.ts +17 -8
  324. package/dist/types/src/controls/slot.d.ts.map +1 -1
  325. package/dist/types/src/controls/style.d.ts +18 -18
  326. package/dist/types/src/controls/style.d.ts.map +1 -1
  327. package/dist/types/src/controls/text-area.d.ts +3 -3
  328. package/dist/types/src/controls/text-area.d.ts.map +1 -1
  329. package/dist/types/src/controls/text-input.d.ts +3 -3
  330. package/dist/types/src/controls/text-input.d.ts.map +1 -1
  331. package/dist/types/src/controls/types.d.ts +5 -5
  332. package/dist/types/src/controls/types.d.ts.map +1 -1
  333. package/dist/types/src/css/border-radius.d.ts +2 -2
  334. package/dist/types/src/css/border-radius.d.ts.map +1 -1
  335. package/dist/types/src/css/border.d.ts +2 -2
  336. package/dist/types/src/css/border.d.ts.map +1 -1
  337. package/dist/types/src/css/length-percentage.d.ts +2 -2
  338. package/dist/types/src/css/length-percentage.d.ts.map +1 -1
  339. package/dist/types/src/css/length.d.ts +1 -1
  340. package/dist/types/src/css/length.d.ts.map +1 -1
  341. package/dist/types/src/css/margin.d.ts +2 -2
  342. package/dist/types/src/css/margin.d.ts.map +1 -1
  343. package/dist/types/src/css/padding.d.ts +2 -2
  344. package/dist/types/src/css/padding.d.ts.map +1 -1
  345. package/dist/types/src/next/api-handler/handlers/element-tree.d.ts +3 -3
  346. package/dist/types/src/next/api-handler/handlers/element-tree.d.ts.map +1 -1
  347. package/dist/types/src/next/api-handler/handlers/fonts.d.ts +5 -5
  348. package/dist/types/src/next/api-handler/handlers/fonts.d.ts.map +1 -1
  349. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -3
  350. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  351. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts +2 -2
  352. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
  353. package/dist/types/src/next/api-handler/handlers/revalidate.d.ts +3 -3
  354. package/dist/types/src/next/api-handler/handlers/revalidate.d.ts.map +1 -1
  355. package/dist/types/src/next/api-handler/index.d.ts +3 -3
  356. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  357. package/dist/types/src/next/client.d.ts +8 -8
  358. package/dist/types/src/next/client.d.ts.map +1 -1
  359. package/dist/types/src/next/dynamic.d.ts +4 -4
  360. package/dist/types/src/next/dynamic.d.ts.map +1 -1
  361. package/dist/types/src/next/index.d.ts +2 -2
  362. package/dist/types/src/next/index.d.ts.map +1 -1
  363. package/dist/types/src/next/preview-mode.d.ts +2 -2
  364. package/dist/types/src/next/preview-mode.d.ts.map +1 -1
  365. package/dist/types/src/prop-controllers/descriptors.d.ts +179 -179
  366. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  367. package/dist/types/src/prop-controllers/instances.d.ts +17 -17
  368. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  369. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts +1 -1
  370. package/dist/types/src/runtimes/react/components/LiveProvider.d.ts.map +1 -1
  371. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts +1 -1
  372. package/dist/types/src/runtimes/react/components/PreviewProvider.d.ts.map +1 -1
  373. package/dist/types/src/runtimes/react/components/render-hook.d.ts +1 -1
  374. package/dist/types/src/runtimes/react/components/render-hook.d.ts.map +1 -1
  375. package/dist/types/src/runtimes/react/controls/checkbox.d.ts +1 -1
  376. package/dist/types/src/runtimes/react/controls/checkbox.d.ts.map +1 -1
  377. package/dist/types/src/runtimes/react/controls/color.d.ts +1 -1
  378. package/dist/types/src/runtimes/react/controls/color.d.ts.map +1 -1
  379. package/dist/types/src/runtimes/react/controls/combobox.d.ts +1 -1
  380. package/dist/types/src/runtimes/react/controls/combobox.d.ts.map +1 -1
  381. package/dist/types/src/runtimes/react/controls/control.d.ts +2 -2
  382. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  383. package/dist/types/src/runtimes/react/controls/image.d.ts +3 -3
  384. package/dist/types/src/runtimes/react/controls/image.d.ts.map +1 -1
  385. package/dist/types/src/runtimes/react/controls/link.d.ts +2 -2
  386. package/dist/types/src/runtimes/react/controls/link.d.ts.map +1 -1
  387. package/dist/types/src/runtimes/react/controls/list.d.ts +3 -3
  388. package/dist/types/src/runtimes/react/controls/list.d.ts.map +1 -1
  389. package/dist/types/src/runtimes/react/controls/number.d.ts +1 -1
  390. package/dist/types/src/runtimes/react/controls/number.d.ts.map +1 -1
  391. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +3 -3
  392. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  393. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +7 -4
  394. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  395. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +2 -2
  396. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  397. package/dist/types/src/runtimes/react/controls/rich-text.d.ts +2 -2
  398. package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +1 -1
  399. package/dist/types/src/runtimes/react/controls/select.d.ts +1 -1
  400. package/dist/types/src/runtimes/react/controls/select.d.ts.map +1 -1
  401. package/dist/types/src/runtimes/react/controls/shape.d.ts +2 -2
  402. package/dist/types/src/runtimes/react/controls/shape.d.ts.map +1 -1
  403. package/dist/types/src/runtimes/react/controls/slot.d.ts +4 -4
  404. package/dist/types/src/runtimes/react/controls/slot.d.ts.map +1 -1
  405. package/dist/types/src/runtimes/react/controls/style.d.ts +1 -1
  406. package/dist/types/src/runtimes/react/controls/style.d.ts.map +1 -1
  407. package/dist/types/src/runtimes/react/controls/text-area.d.ts +1 -1
  408. package/dist/types/src/runtimes/react/controls/text-area.d.ts.map +1 -1
  409. package/dist/types/src/runtimes/react/controls/text-input.d.ts +1 -1
  410. package/dist/types/src/runtimes/react/controls/text-input.d.ts.map +1 -1
  411. package/dist/types/src/runtimes/react/controls.d.ts +8 -8
  412. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  413. package/dist/types/src/runtimes/react/element-imperative-handle.d.ts +1 -1
  414. package/dist/types/src/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  415. package/dist/types/src/runtimes/react/find-dom-node.d.ts +1 -1
  416. package/dist/types/src/runtimes/react/find-dom-node.d.ts.map +1 -1
  417. package/dist/types/src/runtimes/react/index.d.ts +7 -7
  418. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  419. package/dist/types/src/slate/BlockPlugin/index.d.ts +33 -2
  420. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  421. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts +1 -1
  422. package/dist/types/src/slate/BlockPlugin/setBlockKeyForDevice.d.ts.map +1 -1
  423. package/dist/types/src/slate/BlockPlugin/types.d.ts +3 -3
  424. package/dist/types/src/slate/BlockPlugin/types.d.ts.map +1 -1
  425. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts +1 -1
  426. package/dist/types/src/slate/BlockPlugin/unwrapInline.d.ts.map +1 -1
  427. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts +1 -1
  428. package/dist/types/src/slate/BlockPlugin/wrapInline.d.ts.map +1 -1
  429. package/dist/types/src/slate/BuilderPlugin/index.d.ts +1 -1
  430. package/dist/types/src/slate/BuilderPlugin/index.d.ts.map +1 -1
  431. package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -2
  432. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  433. package/dist/types/src/slate/ListPlugin/index.d.ts +2 -2
  434. package/dist/types/src/slate/ListPlugin/index.d.ts.map +1 -1
  435. package/dist/types/src/slate/ListPlugin/toggleList.d.ts +2 -2
  436. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +1 -1
  437. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts +1 -1
  438. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +1 -1
  439. package/dist/types/src/slate/ListPlugin/wrapList.d.ts +2 -2
  440. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +1 -1
  441. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts +1 -1
  442. package/dist/types/src/slate/TypographyPlugin/clearActiveTypographyStyle.d.ts.map +1 -1
  443. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts +1 -1
  444. package/dist/types/src/slate/TypographyPlugin/clearDeviceActiveTypography.d.ts.map +1 -1
  445. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts +2 -2
  446. package/dist/types/src/slate/TypographyPlugin/detachActiveTypography.d.ts.map +1 -1
  447. package/dist/types/src/slate/TypographyPlugin/index.d.ts +2 -2
  448. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  449. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts +1 -1
  450. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyId.d.ts.map +1 -1
  451. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts +1 -1
  452. package/dist/types/src/slate/TypographyPlugin/setActiveTypographyStyle.d.ts.map +1 -1
  453. package/dist/types/src/slate/index.d.ts +1 -0
  454. package/dist/types/src/slate/index.d.ts.map +1 -1
  455. package/dist/types/src/slate/selectors.d.ts +1 -1
  456. package/dist/types/src/slate/selectors.d.ts.map +1 -1
  457. package/dist/types/{types/slate.d.ts → src/slate/types.d.ts} +42 -35
  458. package/dist/types/src/slate/types.d.ts.map +1 -0
  459. package/dist/types/src/slate/utils/editor.d.ts +1 -1
  460. package/dist/types/src/slate/utils/editor.d.ts.map +1 -1
  461. package/dist/types/src/slate/utils/element.d.ts +1 -1
  462. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  463. package/dist/types/src/state/actions.d.ts +41 -41
  464. package/dist/types/src/state/actions.d.ts.map +1 -1
  465. package/dist/types/src/state/makeswift-api-client.d.ts +5 -5
  466. package/dist/types/src/state/makeswift-api-client.d.ts.map +1 -1
  467. package/dist/types/src/state/modules/api-resources.d.ts +2 -2
  468. package/dist/types/src/state/modules/api-resources.d.ts.map +1 -1
  469. package/dist/types/src/state/modules/box-models.d.ts +2 -2
  470. package/dist/types/src/state/modules/box-models.d.ts.map +1 -1
  471. package/dist/types/src/state/modules/breakpoints.d.ts +9 -9
  472. package/dist/types/src/state/modules/breakpoints.d.ts.map +1 -1
  473. package/dist/types/src/state/modules/builder-edit-mode.d.ts +2 -2
  474. package/dist/types/src/state/modules/builder-edit-mode.d.ts.map +1 -1
  475. package/dist/types/src/state/modules/components-meta.d.ts +3 -3
  476. package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
  477. package/dist/types/src/state/modules/element-imperative-handles.d.ts +1 -1
  478. package/dist/types/src/state/modules/element-imperative-handles.d.ts.map +1 -1
  479. package/dist/types/src/state/modules/is-in-builder.d.ts +1 -1
  480. package/dist/types/src/state/modules/is-in-builder.d.ts.map +1 -1
  481. package/dist/types/src/state/modules/is-preview.d.ts +1 -1
  482. package/dist/types/src/state/modules/is-preview.d.ts.map +1 -1
  483. package/dist/types/src/state/modules/pointer.d.ts +2 -2
  484. package/dist/types/src/state/modules/pointer.d.ts.map +1 -1
  485. package/dist/types/src/state/modules/prop-controller-handles.d.ts +1 -1
  486. package/dist/types/src/state/modules/prop-controller-handles.d.ts.map +1 -1
  487. package/dist/types/src/state/modules/prop-controllers.d.ts +1 -1
  488. package/dist/types/src/state/modules/prop-controllers.d.ts.map +1 -1
  489. package/dist/types/src/state/modules/react-components.d.ts +2 -2
  490. package/dist/types/src/state/modules/react-components.d.ts.map +1 -1
  491. package/dist/types/src/state/modules/read-only-documents.d.ts +7 -7
  492. package/dist/types/src/state/modules/read-only-documents.d.ts.map +1 -1
  493. package/dist/types/src/state/modules/read-write-documents.d.ts +1 -1
  494. package/dist/types/src/state/modules/read-write-documents.d.ts.map +1 -1
  495. package/dist/types/src/state/react-builder-preview.d.ts +5 -6
  496. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  497. package/dist/types/src/state/react-page.d.ts +10 -6
  498. package/dist/types/src/state/react-page.d.ts.map +1 -1
  499. package/dist/types/src/state/react-page.test.d.ts +3 -0
  500. package/dist/types/src/state/react-page.test.d.ts.map +1 -0
  501. package/dist/types/src/utils/isErrorWithMessage.d.ts +1 -1
  502. package/dist/types/src/utils/isErrorWithMessage.d.ts.map +1 -1
  503. package/package.json +4 -3
  504. package/dist/descriptors.cjs.js.map +0 -1
  505. package/dist/descriptors.es.js.map +0 -1
  506. package/dist/element.cjs.js +0 -55
  507. package/dist/element.cjs.js.map +0 -1
  508. package/dist/element.es.js +0 -54
  509. package/dist/element.es.js.map +0 -1
  510. package/dist/introspection.cjs.js +0 -329
  511. package/dist/introspection.cjs.js.map +0 -1
  512. package/dist/introspection.es.js +0 -315
  513. package/dist/introspection.es.js.map +0 -1
  514. package/dist/slate.cjs2.js +0 -46
  515. package/dist/slate.cjs2.js.map +0 -1
  516. package/dist/slate.es2.js +0 -44
  517. package/dist/slate.es2.js.map +0 -1
  518. package/dist/types/types/slate.d.ts.map +0 -1
@@ -4,23 +4,24 @@ var css = require("@emotion/css");
4
4
  var React = require("react");
5
5
  var next = require("./index.cjs.js");
6
6
  var index = require("./index.cjs3.js");
7
- var slate = require("./slate.cjs2.js");
7
+ require("slate");
8
+ require("is-hotkey");
9
+ var reactPage = require("./react-page.cjs.js");
10
+ require("./state/breakpoints.cjs.js");
11
+ require("slate-react");
8
12
  var jsxRuntime = require("react/jsx-runtime");
9
13
  var leaf = require("./leaf.cjs.js");
10
- var descriptors = require("./descriptors.cjs.js");
11
14
  require("use-sync-external-store/shim/with-selector");
12
15
  require("next/dynamic");
13
- require("./constants.cjs.js");
14
- require("redux");
15
- require("redux-thunk");
16
16
  require("./actions.cjs.js");
17
- require("./state/breakpoints.cjs.js");
18
- require("./introspection.cjs.js");
19
17
  require("@emotion/serialize");
20
18
  require("@emotion/utils");
21
19
  require("./text-input.cjs.js");
22
20
  require("./combobox.cjs.js");
21
+ require("./select.cjs.js");
23
22
  require("use-sync-external-store/shim");
23
+ require("redux");
24
+ require("redux-thunk");
24
25
  require("./types.cjs.js");
25
26
  require("./box-models.cjs.js");
26
27
  require("css-box-model");
@@ -36,6 +37,7 @@ require("path-to-regexp");
36
37
  require("cookie");
37
38
  require("http-proxy");
38
39
  require("set-cookie-parser");
40
+ require("./constants.cjs.js");
39
41
  require("uuid");
40
42
  require("corporate-ipsum");
41
43
  require("next/link");
@@ -45,7 +47,7 @@ const ReadOnlyText = React.forwardRef(function ReadOnlyText2({
45
47
  width,
46
48
  margin
47
49
  }, ref) {
48
- const descendants = text == null ? [] : descriptors.richTextDTOtoDAO(text);
50
+ const descendants = text == null ? [] : reactPage.richTextDTOtoDAO(text);
49
51
  const descendantsAsString = getText(descendants);
50
52
  return /* @__PURE__ */ jsxRuntime.jsx("div", {
51
53
  ref,
@@ -88,25 +90,25 @@ function InlineElement({
88
90
  textDecoration: "none"
89
91
  });
90
92
  switch (descendant.type) {
91
- case slate.InlineType.Code:
93
+ case reactPage.InlineType.Code:
92
94
  return /* @__PURE__ */ jsxRuntime.jsx("code", {
93
95
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
94
96
  descendants: descendant.children
95
97
  })
96
98
  });
97
- case slate.InlineType.SuperScript:
99
+ case reactPage.InlineType.SuperScript:
98
100
  return /* @__PURE__ */ jsxRuntime.jsx("sup", {
99
101
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
100
102
  descendants: descendant.children
101
103
  })
102
104
  });
103
- case slate.InlineType.SubScript:
105
+ case reactPage.InlineType.SubScript:
104
106
  return /* @__PURE__ */ jsxRuntime.jsx("sub", {
105
107
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
106
108
  descendants: descendant.children
107
109
  })
108
110
  });
109
- case slate.InlineType.Link:
111
+ case reactPage.InlineType.Link:
110
112
  return /* @__PURE__ */ jsxRuntime.jsx(index.Link, {
111
113
  className: linkClassName,
112
114
  link: descendant.link,
@@ -125,63 +127,63 @@ function BlockElement({
125
127
  textAlign
126
128
  })))];
127
129
  switch (descendant.type) {
128
- case slate.BlockType.Text:
130
+ case reactPage.BlockType.Text:
129
131
  return /* @__PURE__ */ jsxRuntime.jsx("span", {
130
132
  className: css.cx(...blockStyles),
131
133
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
132
134
  descendants: descendant.children
133
135
  })
134
136
  });
135
- case slate.BlockType.Paragraph:
137
+ case reactPage.BlockType.Paragraph:
136
138
  return /* @__PURE__ */ jsxRuntime.jsx("p", {
137
139
  className: css.cx(...blockStyles),
138
140
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
139
141
  descendants: descendant.children
140
142
  })
141
143
  });
142
- case slate.BlockType.Heading1:
144
+ case reactPage.BlockType.Heading1:
143
145
  return /* @__PURE__ */ jsxRuntime.jsx("h1", {
144
146
  className: css.cx(...blockStyles),
145
147
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
146
148
  descendants: descendant.children
147
149
  })
148
150
  });
149
- case slate.BlockType.Heading2:
151
+ case reactPage.BlockType.Heading2:
150
152
  return /* @__PURE__ */ jsxRuntime.jsx("h2", {
151
153
  className: css.cx(...blockStyles),
152
154
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
153
155
  descendants: descendant.children
154
156
  })
155
157
  });
156
- case slate.BlockType.Heading3:
158
+ case reactPage.BlockType.Heading3:
157
159
  return /* @__PURE__ */ jsxRuntime.jsx("h3", {
158
160
  className: css.cx(...blockStyles),
159
161
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
160
162
  descendants: descendant.children
161
163
  })
162
164
  });
163
- case slate.BlockType.Heading4:
165
+ case reactPage.BlockType.Heading4:
164
166
  return /* @__PURE__ */ jsxRuntime.jsx("h4", {
165
167
  className: css.cx(...blockStyles),
166
168
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
167
169
  descendants: descendant.children
168
170
  })
169
171
  });
170
- case slate.BlockType.Heading5:
172
+ case reactPage.BlockType.Heading5:
171
173
  return /* @__PURE__ */ jsxRuntime.jsx("h5", {
172
174
  className: css.cx(...blockStyles),
173
175
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
174
176
  descendants: descendant.children
175
177
  })
176
178
  });
177
- case slate.BlockType.Heading6:
179
+ case reactPage.BlockType.Heading6:
178
180
  return /* @__PURE__ */ jsxRuntime.jsx("h6", {
179
181
  className: css.cx(...blockStyles),
180
182
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
181
183
  descendants: descendant.children
182
184
  })
183
185
  });
184
- case slate.BlockType.BlockQuote:
186
+ case reactPage.BlockType.BlockQuote:
185
187
  return /* @__PURE__ */ jsxRuntime.jsx("blockquote", {
186
188
  className: css.cx(...blockStyles, next.useStyle({
187
189
  padding: "0.5em 10px",
@@ -193,7 +195,7 @@ function BlockElement({
193
195
  descendants: descendant.children
194
196
  })
195
197
  });
196
- case slate.BlockType.OrderedList:
198
+ case reactPage.BlockType.OrderedList:
197
199
  return /* @__PURE__ */ jsxRuntime.jsx("ol", {
198
200
  className: css.cx(...blockStyles),
199
201
  style: {
@@ -203,7 +205,7 @@ function BlockElement({
203
205
  descendants: descendant.children
204
206
  })
205
207
  });
206
- case slate.BlockType.UnorderedList:
208
+ case reactPage.BlockType.UnorderedList:
207
209
  return /* @__PURE__ */ jsxRuntime.jsx("ul", {
208
210
  className: css.cx(...blockStyles),
209
211
  style: {
@@ -213,20 +215,22 @@ function BlockElement({
213
215
  descendants: descendant.children
214
216
  })
215
217
  });
216
- case slate.BlockType.ListItem:
218
+ case reactPage.BlockType.ListItem:
217
219
  return /* @__PURE__ */ jsxRuntime.jsx("li", {
218
220
  className: css.cx(...blockStyles),
219
221
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
220
222
  descendants: descendant.children
221
223
  })
222
224
  });
223
- case slate.BlockType.ListItemChild:
225
+ case reactPage.BlockType.ListItemChild:
224
226
  return /* @__PURE__ */ jsxRuntime.jsx("span", {
225
227
  className: css.cx(...blockStyles),
226
228
  children: /* @__PURE__ */ jsxRuntime.jsx(Descendants, {
227
229
  descendants: descendant.children
228
230
  })
229
231
  });
232
+ default:
233
+ return null;
230
234
  }
231
235
  }
232
236
  function isText(node) {
@@ -245,23 +249,23 @@ function Descendants({
245
249
  }, index2);
246
250
  }
247
251
  switch (descendant.type) {
248
- case slate.InlineType.Link:
249
- case slate.InlineType.Code:
250
- case slate.InlineType.SubScript:
251
- case slate.InlineType.SuperScript:
252
+ case reactPage.InlineType.Link:
253
+ case reactPage.InlineType.Code:
254
+ case reactPage.InlineType.SubScript:
255
+ case reactPage.InlineType.SuperScript:
252
256
  return /* @__PURE__ */ jsxRuntime.jsx(InlineElement, {
253
257
  descendant
254
258
  }, index2);
255
- case slate.BlockType.Heading1:
256
- case slate.BlockType.Heading2:
257
- case slate.BlockType.Heading3:
258
- case slate.BlockType.BlockQuote:
259
- case slate.BlockType.Text:
260
- case slate.BlockType.Paragraph:
261
- case slate.BlockType.OrderedList:
262
- case slate.BlockType.UnorderedList:
263
- case slate.BlockType.ListItem:
264
- case slate.BlockType.ListItemChild:
259
+ case reactPage.BlockType.Heading1:
260
+ case reactPage.BlockType.Heading2:
261
+ case reactPage.BlockType.Heading3:
262
+ case reactPage.BlockType.BlockQuote:
263
+ case reactPage.BlockType.Text:
264
+ case reactPage.BlockType.Paragraph:
265
+ case reactPage.BlockType.OrderedList:
266
+ case reactPage.BlockType.UnorderedList:
267
+ case reactPage.BlockType.ListItem:
268
+ case reactPage.BlockType.ListItemChild:
265
269
  return /* @__PURE__ */ jsxRuntime.jsx(BlockElement, {
266
270
  descendant
267
271
  }, index2);
@@ -275,15 +279,15 @@ function isBlock(descendant) {
275
279
  if ("text" in descendant)
276
280
  return false;
277
281
  switch (descendant.type) {
278
- case slate.BlockType.Heading1:
279
- case slate.BlockType.Heading2:
280
- case slate.BlockType.Heading3:
281
- case slate.BlockType.BlockQuote:
282
- case slate.BlockType.Paragraph:
283
- case slate.BlockType.OrderedList:
284
- case slate.BlockType.UnorderedList:
285
- case slate.BlockType.ListItem:
286
- case slate.BlockType.ListItemChild:
282
+ case reactPage.BlockType.Heading1:
283
+ case reactPage.BlockType.Heading2:
284
+ case reactPage.BlockType.Heading3:
285
+ case reactPage.BlockType.BlockQuote:
286
+ case reactPage.BlockType.Paragraph:
287
+ case reactPage.BlockType.OrderedList:
288
+ case reactPage.BlockType.UnorderedList:
289
+ case reactPage.BlockType.ListItem:
290
+ case reactPage.BlockType.ListItemChild:
287
291
  return true;
288
292
  default:
289
293
  return false;
@@ -295,20 +299,20 @@ function getTextByDescendant(descendant) {
295
299
  return (_a = descendant.text) != null ? _a : "";
296
300
  }
297
301
  switch (descendant.type) {
298
- case slate.InlineType.Link:
299
- case slate.InlineType.Code:
300
- case slate.InlineType.SubScript:
301
- case slate.InlineType.SuperScript:
302
+ case reactPage.InlineType.Link:
303
+ case reactPage.InlineType.Code:
304
+ case reactPage.InlineType.SubScript:
305
+ case reactPage.InlineType.SuperScript:
302
306
  return (_b = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join("")) != null ? _b : "";
303
- case slate.BlockType.Heading1:
304
- case slate.BlockType.Heading2:
305
- case slate.BlockType.Heading3:
306
- case slate.BlockType.BlockQuote:
307
- case slate.BlockType.Paragraph:
308
- case slate.BlockType.OrderedList:
309
- case slate.BlockType.UnorderedList:
310
- case slate.BlockType.ListItem:
311
- case slate.BlockType.ListItemChild:
307
+ case reactPage.BlockType.Heading1:
308
+ case reactPage.BlockType.Heading2:
309
+ case reactPage.BlockType.Heading3:
310
+ case reactPage.BlockType.BlockQuote:
311
+ case reactPage.BlockType.Paragraph:
312
+ case reactPage.BlockType.OrderedList:
313
+ case reactPage.BlockType.UnorderedList:
314
+ case reactPage.BlockType.ListItem:
315
+ case reactPage.BlockType.ListItemChild:
312
316
  return (_c = descendant.children.map((descendant2) => getTextByDescendant(descendant2)).join(descendant.children.every(isBlock) ? "\n" : "")) != null ? _c : "";
313
317
  default:
314
318
  return "";
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\n\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\nimport { Inline, InlineType, Block, BlockType } from '../../../../types/slate'\nimport { richTextDTOtoDAO } from '../../../controls'\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 ref={ref} id={id} className={cx(width, margin)}>\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}>\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\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\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\n className={cx(\n ...blockStyles,\n 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 >\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 }\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.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} />\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.BlockQuote:\n case BlockType.Paragraph:\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.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":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","useResponsiveStyle","textAlign","BlockType","Text","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBMA,MAAAA,eAAeC,MAAAA,WAAW,uBAC9B;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAMC;AAAAA,EAAOC;AAAAA,GACnBC,KACA;AACMC,QAAAA,cAAcJ,QAAQ,OAAO,CAAA,IAAKK,YAAAA,iBAAiBL,IAAD;AAClDM,QAAAA,sBAAsBC,QAAQH,WAAD;AAGjC,wCAAA,OAAA;A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,UAAUG;AAAAA,SACVH,MAAAA,UAAUI;AAAAA,SACVJ,MAAAA,UAAUK;AAAAA,SACVL,MAAAA,UAAUS;AAAAA,SACVT,MAAAA,UAAUE;AAAAA,SACVF,MAAAA,UAAUc;AAAAA,SACVd,MAAAA,UAAUgB;AAAAA,SACVhB,MAAAA,UAAUiB;AAAAA,SACVjB,MAAUkB,UAAAA;AAEXrC,aAAAA,iBAAWW,SACR6B,IAAIxC,CAAc2C,gBAAAA,oBAAoB3C,WAAD,CADxC,EAEG4C,KAAK5C,WAAWW,SAASkC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAA9C,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAWwC,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
1
+ {"version":3,"file":"ReadOnlyText.cjs.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\n\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\nimport { Inline, InlineType, Block, BlockType } from '../../../slate'\nimport { richTextDTOtoDAO } from '../../../controls'\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 ref={ref} id={id} className={cx(width, margin)}>\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}>\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\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\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\n className={cx(\n ...blockStyles,\n 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 >\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.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} />\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.BlockQuote:\n case BlockType.Paragraph:\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.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":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","useResponsiveStyle","textAlign","BlockType","Text","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBMA,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,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWI,IAAAA,GAAGP,OAAOC,MAAR;AAAA,IACjCI,UAAAA,wBAAwB,KAAKG,2BAAA,IAAC,aAAD,EAAA,IAAkBA,2BAAA,IAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAFpD;AAKD,CAZ8B;AAgB/B,qBAAqB;AAAA,EAAET,OAAO;AAAA,GAA2C;AAErE,wCAAA,QAAA;AAAA,IACE,WAAWU,KAAAA,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTV,OAAO;AAAA,MACPW,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBf,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEgB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAAqBC,KAAAA,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,4BAAuBJ,kBAAD;AAGhD,wCAAA,QAAA;AAAA,IAAM,WAAWG;AAAAA,IACdJ,UAAAA,WAAWhB,SAAS,KAAK,WAAWgB,WAAWhB;AAAAA,EAAAA,CAFpD;AAKD;AAMD,uBAAuB;AAAA,EAAEgB;AAAAA,GAA2B;AAC5CM,QAAAA,gBAAgBZ,KAAAA,SAAS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AAA;AAGA,aAAA;AAAA;AAEZ;AAED,6BAA6BrC,YAAgC;;AACvD,MAAA,UAAUA,YAAY;AACxB,WAAOA,iBAAWhB,SAAXgB,YAAmB;AAAA,EAC3B;AAEOA,UAAAA,WAAWQ;AAAAA,SACZC,UAAAA,WAAWK;AAAAA,SACXL,UAAAA,WAAWC;AAAAA,SACXD,UAAAA,WAAWI;AAAAA,SACXJ,UAAWG,WAAAA;AACPZ,aAAAA,iBAAWW,SAAS6B,IAAIxC,CAAc2C,gBAAAA,oBAAoB3C,WAAD,CAAzD,EAAuE4C,KAAK,EAA5E,MAAA5C,YAAmF;AAAA,SACvFmB,UAAAA,UAAUG;AAAAA,SACVH,UAAAA,UAAUI;AAAAA,SACVJ,UAAAA,UAAUK;AAAAA,SACVL,UAAAA,UAAUS;AAAAA,SACVT,UAAAA,UAAUE;AAAAA,SACVF,UAAAA,UAAUc;AAAAA,SACVd,UAAAA,UAAUgB;AAAAA,SACVhB,UAAAA,UAAUiB;AAAAA,SACVjB,UAAUkB,UAAAA;AAEXrC,aAAAA,iBAAWW,SACR6B,IAAIxC,CAAc2C,gBAAAA,oBAAoB3C,WAAD,CADxC,EAEG4C,KAAK5C,WAAWW,SAASkC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAA9C,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAWwC,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;;;"}
@@ -2,23 +2,24 @@ import { cx } from "@emotion/css";
2
2
  import { forwardRef } from "react";
3
3
  import { n as useStyle, o as useResponsiveStyle } from "./index.es.js";
4
4
  import { L as Link } from "./index.es3.js";
5
- import { B as BlockType, I as InlineType } from "./slate.es2.js";
5
+ import "slate";
6
+ import "is-hotkey";
7
+ import { aX as richTextDTOtoDAO, b4 as BlockType, b5 as InlineType } from "./react-page.es.js";
8
+ import "./state/breakpoints.es.js";
9
+ import "slate-react";
6
10
  import { jsx, Fragment } from "react/jsx-runtime";
7
11
  import { u as useEnhancedTypography, a as useTypographyClassName } from "./leaf.es.js";
8
- import { au as richTextDTOtoDAO } from "./descriptors.es.js";
9
12
  import "use-sync-external-store/shim/with-selector";
10
13
  import "next/dynamic";
11
- import "./constants.es.js";
12
- import "redux";
13
- import "redux-thunk";
14
14
  import "./actions.es.js";
15
- import "./state/breakpoints.es.js";
16
- import "./introspection.es.js";
17
15
  import "@emotion/serialize";
18
16
  import "@emotion/utils";
19
17
  import "./text-input.es.js";
20
18
  import "./combobox.es.js";
19
+ import "./select.es.js";
21
20
  import "use-sync-external-store/shim";
21
+ import "redux";
22
+ import "redux-thunk";
22
23
  import "./types.es.js";
23
24
  import "./box-models.es.js";
24
25
  import "css-box-model";
@@ -34,6 +35,7 @@ import "path-to-regexp";
34
35
  import "cookie";
35
36
  import "http-proxy";
36
37
  import "set-cookie-parser";
38
+ import "./constants.es.js";
37
39
  import "uuid";
38
40
  import "corporate-ipsum";
39
41
  import "next/link";
@@ -225,6 +227,8 @@ function BlockElement({
225
227
  descendants: descendant.children
226
228
  })
227
229
  });
230
+ default:
231
+ return null;
228
232
  }
229
233
  }
230
234
  function isText(node) {
@@ -1 +1 @@
1
- {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\n\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\nimport { Inline, InlineType, Block, BlockType } from '../../../../types/slate'\nimport { richTextDTOtoDAO } from '../../../controls'\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 ref={ref} id={id} className={cx(width, margin)}>\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}>\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\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\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\n className={cx(\n ...blockStyles,\n 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 >\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 }\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.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} />\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.BlockQuote:\n case BlockType.Paragraph:\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.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":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","useResponsiveStyle","textAlign","BlockType","Text","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBMA,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,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWI,GAAGP,OAAOC,MAAR;AAAA,IACjCI,UAAAA,wBAAwB,KAAKG,oBAAC,aAAD,EAAA,IAAkBA,oBAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAFpD;AAKD,CAZ8B;AAgB/B,qBAAqB;AAAA,EAAET,OAAO;AAAA,GAA2C;AAErE,6BAAA,QAAA;AAAA,IACE,WAAWU,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTV,OAAO;AAAA,MACPW,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBf,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEgB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAAqBC,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,uBAAuBJ,kBAAD;AAGhD,6BAAA,QAAA;AAAA,IAAM,WAAWG;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AIxC,CAAc2C,gBAAAA,oBAAoB3C,WAAD,CAAzD,EAAuE4C,KAAK,EAA5E,MAAA5C,YAAmF;AAAA,SACvFmB,UAAUG;AAAAA,SACVH,UAAUI;AAAAA,SACVJ,UAAUK;AAAAA,SACVL,UAAUS;AAAAA,SACVT,UAAUE;AAAAA,SACVF,UAAUc;AAAAA,SACVd,UAAUgB;AAAAA,SACVhB,UAAUiB;AAAAA,SACVjB,UAAUkB;AAEXrC,aAAAA,iBAAWW,SACR6B,IAAIxC,CAAc2C,gBAAAA,oBAAoB3C,WAAD,CADxC,EAEG4C,KAAK5C,WAAWW,SAASkC,MAAMC,OAA1B,IAAqC,OAAO,EAFpD,MAAA9C,YAE2D;AAAA;AAGtD,aAAA;AAAA;AAEZ;AAED,iBAAiBA,YAAkC;AAC1CA,SAAAA,WAAWwC,IAAIG,mBAAf,EAAoCC,KAAK,IAAzC;AACR;;"}
1
+ {"version":3,"file":"ReadOnlyText.es.js","sources":["../src/components/builtin/Text/ReadOnlyText.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { ForwardedRef, forwardRef } from 'react'\nimport { Descendant, Text } from 'slate'\n\nimport type { ElementIDValue, RichTextValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { Link } from '../../shared/Link'\nimport { useResponsiveStyle } from '../../utils/responsive-style'\nimport { useTypographyClassName } from './components'\nimport useEnhancedTypography from './components/Leaf/leaf'\nimport { Inline, InlineType, Block, BlockType } from '../../../slate'\nimport { richTextDTOtoDAO } from '../../../controls'\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 ref={ref} id={id} className={cx(width, margin)}>\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}>\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\n switch (descendant.type) {\n case BlockType.Text:\n return (\n <span className={cx(...blockStyles)}>\n <Descendants descendants={descendant.children} />\n </span>\n )\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\n className={cx(\n ...blockStyles,\n 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 >\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.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} />\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.BlockQuote:\n case BlockType.Paragraph:\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.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":["ReadOnlyText","forwardRef","id","text","width","margin","ref","descendants","richTextDTOtoDAO","descendantsAsString","getText","cx","_jsx","useStyle","display","maxWidth","whiteSpace","opacity","verticalAlign","descendant","enhancedTypography","useEnhancedTypography","typography","typographyClassName","useTypographyClassName","linkClassName","textDecoration","type","InlineType","Code","children","SuperScript","SubScript","Link","link","blockStyles","useResponsiveStyle","textAlign","BlockType","Text","Paragraph","Heading1","Heading2","Heading3","Heading4","Heading5","Heading6","BlockQuote","padding","fontSize","fontWeight","borderLeft","OrderedList","listStylePosition","UnorderedList","ListItem","ListItemChild","node","_Fragment","map","index","isText","getTextByDescendant","join","every","isBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBMA,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,IAAK;AAAA,IAAU;AAAA,IAAQ,WAAWI,GAAGP,OAAOC,MAAR;AAAA,IACjCI,UAAAA,wBAAwB,KAAKG,oBAAC,aAAD,EAAA,IAAkBA,oBAAC,aAAD;AAAA,MAAa;AAAA,IAAA,CAAb;AAAA,EAAA,CAFpD;AAKD,CAZ8B;AAgB/B,qBAAqB;AAAA,EAAET,OAAO;AAAA,GAA2C;AAErE,6BAAA,QAAA;AAAA,IACE,WAAWU,SAAS;AAAA,MAClBC,SAAS;AAAA,MACTV,OAAO;AAAA,MACPW,UAAU;AAAA,MACVC,YAAY;AAAA,MACZC,SAAS;AAAA,MACTC,eAAe;AAAA,IAAA,CANE;AAAA,IASlBf,UAAAA;AAAAA,EAAAA,CAXL;AAcD;AAM2B,qBAAA;AAAA,EAAEgB;AAAAA,GAAyB;AAC/CC,QAAAA,qBAAqBC,sBAAsBF,WAAWG,UAAZ;AAC1CC,QAAAA,sBAAsBC,uBAAuBJ,kBAAD;AAGhD,6BAAA,QAAA;AAAA,IAAM,WAAWG;AAAAA,IACdJ,UAAAA,WAAWhB,SAAS,KAAK,WAAWgB,WAAWhB;AAAAA,EAAAA,CAFpD;AAKD;AAMD,uBAAuB;AAAA,EAAEgB;AAAAA,GAA2B;AAC5CM,QAAAA,gBAAgBZ,SAAS;AAAA,IAAEa,gBAAgB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