@makeswift/runtime 0.7.6 → 0.7.8

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 (280) hide show
  1. package/dist/Box.cjs.js +2 -1
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -1
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +2 -1
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +2 -1
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +2 -1
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +2 -1
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +2 -1
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +2 -1
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +2 -1
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +2 -1
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +2 -1
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +2 -1
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +3 -2
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +3 -2
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +2 -1
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +2 -1
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +2 -1
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +3 -2
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +2 -1
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +2 -1
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +29 -1
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +33 -4
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +185 -154
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +182 -154
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/Root.cjs.js +2 -1
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +2 -1
  52. package/dist/Root.es.js.map +1 -1
  53. package/dist/SocialLinks.cjs.js +2 -1
  54. package/dist/SocialLinks.cjs.js.map +1 -1
  55. package/dist/SocialLinks.es.js +2 -1
  56. package/dist/SocialLinks.es.js.map +1 -1
  57. package/dist/Text.cjs.js +3 -2
  58. package/dist/Text.cjs.js.map +1 -1
  59. package/dist/Text.es.js +3 -2
  60. package/dist/Text.es.js.map +1 -1
  61. package/dist/Video.cjs.js +2 -1
  62. package/dist/Video.cjs.js.map +1 -1
  63. package/dist/Video.es.js +2 -1
  64. package/dist/Video.es.js.map +1 -1
  65. package/dist/actions.cjs.js +1 -0
  66. package/dist/actions.cjs.js.map +1 -1
  67. package/dist/actions.es.js +1 -1
  68. package/dist/builder.cjs.js +2 -1
  69. package/dist/builder.cjs.js.map +1 -1
  70. package/dist/builder.es.js +2 -1
  71. package/dist/builder.es.js.map +1 -1
  72. package/dist/compare.cjs.js +126 -0
  73. package/dist/compare.cjs.js.map +1 -0
  74. package/dist/compare.es.js +124 -0
  75. package/dist/compare.es.js.map +1 -0
  76. package/dist/components.cjs.js +2 -1
  77. package/dist/components.cjs.js.map +1 -1
  78. package/dist/components.es.js +2 -1
  79. package/dist/components.es.js.map +1 -1
  80. package/dist/constants.cjs.js +4 -3
  81. package/dist/constants.cjs.js.map +1 -1
  82. package/dist/constants.es.js +3 -2
  83. package/dist/constants.es.js.map +1 -1
  84. package/dist/control-serialization.cjs.js +136 -108
  85. package/dist/control-serialization.cjs.js.map +1 -1
  86. package/dist/control-serialization.es.js +31 -2
  87. package/dist/control-serialization.es.js.map +1 -1
  88. package/dist/controls.cjs.js +27 -11
  89. package/dist/controls.cjs.js.map +1 -1
  90. package/dist/controls.es.js +4 -2
  91. package/dist/controls.es.js.map +1 -1
  92. package/dist/index.cjs.js +137 -116
  93. package/dist/index.cjs.js.map +1 -1
  94. package/dist/index.cjs2.js +2 -0
  95. package/dist/index.cjs2.js.map +1 -1
  96. package/dist/index.cjs5.js +2 -1
  97. package/dist/index.cjs5.js.map +1 -1
  98. package/dist/index.cjs6.js +663 -96
  99. package/dist/index.cjs6.js.map +1 -1
  100. package/dist/index.es.js +111 -90
  101. package/dist/index.es.js.map +1 -1
  102. package/dist/index.es2.js +2 -0
  103. package/dist/index.es2.js.map +1 -1
  104. package/dist/index.es5.js +2 -1
  105. package/dist/index.es5.js.map +1 -1
  106. package/dist/index.es6.js +657 -95
  107. package/dist/index.es6.js.map +1 -1
  108. package/dist/main.cjs.js +2 -1
  109. package/dist/main.cjs.js.map +1 -1
  110. package/dist/main.es.js +2 -1
  111. package/dist/main.es.js.map +1 -1
  112. package/dist/next.cjs.js +2 -1
  113. package/dist/next.cjs.js.map +1 -1
  114. package/dist/next.es.js +2 -1
  115. package/dist/next.es.js.map +1 -1
  116. package/dist/prop-controllers.cjs.js +2 -0
  117. package/dist/prop-controllers.cjs.js.map +1 -1
  118. package/dist/prop-controllers.es.js +3 -1
  119. package/dist/prop-controllers.es.js.map +1 -1
  120. package/dist/react.cjs.js +2 -1
  121. package/dist/react.cjs.js.map +1 -1
  122. package/dist/react.es.js +2 -1
  123. package/dist/react.es.js.map +1 -1
  124. package/dist/rich-text.cjs.js +1393 -29
  125. package/dist/rich-text.cjs.js.map +1 -1
  126. package/dist/rich-text.es.js +1371 -29
  127. package/dist/rich-text.es.js.map +1 -1
  128. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  129. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  130. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts +13 -0
  131. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/ListPlugin.d.ts.map +1 -0
  132. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/constants.d.ts +3 -0
  133. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/constants.d.ts.map +1 -0
  134. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts +2 -0
  135. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/index.d.ts.map +1 -0
  136. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.d.ts +3 -0
  137. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/dedent.d.ts.map +1 -0
  138. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/indent.d.ts +4 -0
  139. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/indent.d.ts.map +1 -0
  140. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts +6 -0
  141. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/index.d.ts.map +1 -0
  142. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.d.ts +8 -0
  143. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/toggleList.d.ts.map +1 -0
  144. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.d.ts +4 -0
  145. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/unwrapList.d.ts.map +1 -0
  146. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.d.ts +7 -0
  147. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/editor.d.ts.map +1 -0
  148. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.d.ts +26 -0
  149. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/element.d.ts.map +1 -0
  150. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.d.ts +3 -0
  151. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/filterForSubtreeRoots.d.ts.map +1 -0
  152. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.d.ts +5 -0
  153. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/getSelectedListItems.d.ts.map +1 -0
  154. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.d.ts +5 -0
  155. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/utils/location.d.ts.map +1 -0
  156. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.d.ts +8 -0
  157. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/lib/wrapList.d.ts.map +1 -0
  158. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts +3 -0
  159. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/dedent.test.d.ts.map +1 -0
  160. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts +3 -0
  161. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/indent.test.d.ts.map +1 -0
  162. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts +3 -0
  163. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/normalization.test.d.ts.map +1 -0
  164. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts +48 -0
  165. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/slate-test-helper.d.ts.map +1 -0
  166. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts +3 -0
  167. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/toggleList.test.d.ts.map +1 -0
  168. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts +21 -0
  169. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/types.d.ts.map +1 -0
  170. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts +3 -0
  171. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/unwrapList.test.d.ts.map +1 -0
  172. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts +2 -0
  173. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/filterForSubtreeRoots.test.d.ts.map +1 -0
  174. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts +3 -0
  175. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/utils/getSelectedListItems.test.d.ts.map +1 -0
  176. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts +3 -0
  177. package/dist/types/src/components/builtin/Text/EditableText/ListPlugin/test/wrapList.test.d.ts.map +1 -0
  178. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts +13 -0
  179. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -0
  180. package/dist/types/src/components/builtin/Text/EditableText/index.d.ts +4 -0
  181. package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +1 -0
  182. package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts +8 -0
  183. package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
  184. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts +16 -0
  185. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  186. package/dist/types/src/components/builtin/Text/Text.d.ts +1 -1
  187. package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
  188. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts +8 -0
  189. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -0
  190. package/dist/types/src/components/builtin/Text/components/Element/element.d.ts +4 -0
  191. package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +1 -0
  192. package/dist/types/src/components/builtin/Text/components/Element/index.d.ts +2 -0
  193. package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +1 -0
  194. package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts +8 -0
  195. package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +1 -0
  196. package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts +3 -0
  197. package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +1 -0
  198. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +4 -0
  199. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -0
  200. package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts +27 -0
  201. package/dist/types/src/components/builtin/Text/components/Leaf/typography.d.ts.map +1 -0
  202. package/dist/types/src/components/builtin/Text/components/index.d.ts +3 -0
  203. package/dist/types/src/components/builtin/Text/components/index.d.ts.map +1 -0
  204. package/dist/types/src/components/utils/types.d.ts +1 -1
  205. package/dist/types/src/components/utils/types.d.ts.map +1 -1
  206. package/dist/types/src/controls/control.d.ts +2 -1
  207. package/dist/types/src/controls/control.d.ts.map +1 -1
  208. package/dist/types/src/controls/list.d.ts +20 -0
  209. package/dist/types/src/controls/list.d.ts.map +1 -1
  210. package/dist/types/src/controls/rich-text/compare.d.ts +5 -0
  211. package/dist/types/src/controls/rich-text/compare.d.ts.map +1 -0
  212. package/dist/types/src/controls/rich-text/compare.test.d.ts +2 -0
  213. package/dist/types/src/controls/rich-text/compare.test.d.ts.map +1 -0
  214. package/dist/types/src/controls/rich-text/dto-types.d.ts +131 -0
  215. package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -0
  216. package/dist/types/src/controls/rich-text/fixtures/blockquote.d.ts +3 -0
  217. package/dist/types/src/controls/rich-text/fixtures/blockquote.d.ts.map +1 -0
  218. package/dist/types/src/controls/rich-text/fixtures/index.d.ts +4 -0
  219. package/dist/types/src/controls/rich-text/fixtures/index.d.ts.map +1 -0
  220. package/dist/types/src/controls/rich-text/fixtures/list.d.ts +3 -0
  221. package/dist/types/src/controls/rich-text/fixtures/list.d.ts.map +1 -0
  222. package/dist/types/src/controls/rich-text/fixtures/typography.d.ts +3 -0
  223. package/dist/types/src/controls/rich-text/fixtures/typography.d.ts.map +1 -0
  224. package/dist/types/src/controls/rich-text/index.d.ts +6 -0
  225. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -0
  226. package/dist/types/src/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +8 -10
  227. package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -0
  228. package/dist/types/src/controls/rich-text/translation.d.ts +8 -0
  229. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -0
  230. package/dist/types/src/controls/rich-text/translation.test.d.ts +2 -0
  231. package/dist/types/src/controls/rich-text/translation.test.d.ts.map +1 -0
  232. package/dist/types/src/controls/rich-text/types.d.ts +134 -0
  233. package/dist/types/src/controls/rich-text/types.d.ts.map +1 -0
  234. package/dist/types/src/controls/shape.d.ts +21 -0
  235. package/dist/types/src/controls/shape.d.ts.map +1 -1
  236. package/dist/types/src/prop-controllers/descriptors.d.ts +2 -3
  237. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  238. package/dist/types/src/prop-controllers/instances.d.ts +6 -8
  239. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  240. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  241. package/dist/types/src/runtimes/react/controls/control.d.ts +6 -3
  242. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  243. package/dist/types/src/runtimes/react/controls/list.d.ts +3 -2
  244. package/dist/types/src/runtimes/react/controls/list.d.ts.map +1 -1
  245. package/dist/types/src/runtimes/react/controls/shape.d.ts +3 -2
  246. package/dist/types/src/runtimes/react/controls/shape.d.ts.map +1 -1
  247. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  248. package/dist/types/src/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  249. package/dist/typography.cjs.js +146 -0
  250. package/dist/typography.cjs.js.map +1 -0
  251. package/dist/typography.es.js +143 -0
  252. package/dist/typography.es.js.map +1 -0
  253. package/package.json +7 -10
  254. package/dist/EditableText.cjs.js +0 -381
  255. package/dist/EditableText.cjs.js.map +0 -1
  256. package/dist/EditableText.es.js +0 -374
  257. package/dist/EditableText.es.js.map +0 -1
  258. package/dist/control.cjs.js +0 -437
  259. package/dist/control.cjs.js.map +0 -1
  260. package/dist/control.es.js +0 -426
  261. package/dist/control.es.js.map +0 -1
  262. package/dist/types/src/components/builtin/Text/EditableText.d.ts +0 -16
  263. package/dist/types/src/components/builtin/Text/EditableText.d.ts.map +0 -1
  264. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts +0 -10
  265. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts.map +0 -1
  266. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.d.ts +0 -25
  267. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.d.ts.map +0 -1
  268. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts +0 -10
  269. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts.map +0 -1
  270. package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts +0 -5
  271. package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts.map +0 -1
  272. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.d.ts +0 -3
  273. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.d.ts.map +0 -1
  274. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.d.ts +0 -3
  275. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.d.ts.map +0 -1
  276. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.d.ts +0 -3
  277. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.d.ts.map +0 -1
  278. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Link.d.ts +0 -3
  279. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Link.d.ts.map +0 -1
  280. package/dist/types/src/controls/rich-text.d.ts.map +0 -1
@@ -0,0 +1,143 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import { T as getTypographyStyleSwatchIds, l as isNonNullable } from "./constants.es.js";
33
+ import { W as useTypography, K as useSwatches, G as findDeviceOverride, o as useStyle, r as responsiveStyle, X as shallowMergeFallbacks, s as colorToString } from "./index.es.js";
34
+ import { jsx } from "react/jsx-runtime";
35
+ function isDeviceOverride(value) {
36
+ return value.deviceId === "desktop" || value.deviceId === "tablet" || value.deviceId === "mobile";
37
+ }
38
+ const withColor = (swatches) => (deviceRawTypographyValue) => {
39
+ var _b, _c;
40
+ const {
41
+ value,
42
+ deviceId
43
+ } = deviceRawTypographyValue;
44
+ if (value.color == null) {
45
+ const _a = value, {
46
+ color
47
+ } = _a, nextValue = __objRest(_a, [
48
+ "color"
49
+ ]);
50
+ return {
51
+ deviceId,
52
+ value: nextValue
53
+ };
54
+ }
55
+ return {
56
+ deviceId,
57
+ value: __spreadProps(__spreadValues({}, value), {
58
+ color: {
59
+ swatch: swatches.find((s) => {
60
+ var _a2;
61
+ return s && s.id === ((_a2 = value.color) == null ? void 0 : _a2.swatchId);
62
+ }),
63
+ alpha: (_c = (_b = value.color) == null ? void 0 : _b.alpha) != null ? _c : void 0
64
+ }
65
+ })
66
+ };
67
+ };
68
+ const getDeviceId = ({
69
+ deviceId
70
+ }) => deviceId;
71
+ function useEnhancedTypography(value) {
72
+ var _a, _b, _c;
73
+ const typography = useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null);
74
+ const source = (_b = typography == null ? void 0 : typography.style.filter(isDeviceOverride)) != null ? _b : [];
75
+ const override = (_c = value == null ? void 0 : value.style.filter(isDeviceOverride)) != null ? _c : [];
76
+ const swatchIds = [...getTypographyStyleSwatchIds(value == null ? void 0 : value.style), ...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)];
77
+ const swatches = useSwatches(swatchIds).filter(isNonNullable);
78
+ const enhancedSource = source.map(withColor(swatches));
79
+ const enhancedOverride = override.map(withColor(swatches));
80
+ const devices = [...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId)))];
81
+ return devices.map((deviceId) => {
82
+ var _a2, _b2;
83
+ const deviceSource = (_a2 = findDeviceOverride(enhancedSource, deviceId)) == null ? void 0 : _a2.value;
84
+ const deviceOverride = (_b2 = findDeviceOverride(enhancedOverride, deviceId)) == null ? void 0 : _b2.value;
85
+ if (deviceSource && deviceOverride) {
86
+ return {
87
+ deviceId,
88
+ value: __spreadValues(__spreadValues({}, deviceSource), deviceOverride)
89
+ };
90
+ } else if (deviceOverride) {
91
+ return {
92
+ deviceId,
93
+ value: deviceOverride
94
+ };
95
+ } else if (deviceSource) {
96
+ return {
97
+ deviceId,
98
+ value: deviceSource
99
+ };
100
+ }
101
+ return null;
102
+ }).filter(isNonNullable);
103
+ }
104
+ function useTypographyClassName(value) {
105
+ return useStyle(responsiveStyle([value], ([value2]) => {
106
+ if (value2 === void 0)
107
+ return {};
108
+ let styles = {};
109
+ if (value2.color != null)
110
+ styles.color = colorToString(value2.color);
111
+ if (value2.fontFamily != null)
112
+ styles.fontFamily = value2.fontFamily;
113
+ if (value2.fontSize != null && value2.fontSize.value != null && value2.fontSize.unit != null)
114
+ styles.fontSize = `${value2.fontSize.value}${value2.fontSize.unit}`;
115
+ if (value2.fontWeight != null)
116
+ styles.fontWeight = value2.fontWeight;
117
+ if (value2.lineHeight != null)
118
+ styles.lineHeight = value2.lineHeight;
119
+ if (value2.letterSpacing != null)
120
+ styles.letterSpacing = `${value2.letterSpacing / 10}em`;
121
+ if (value2.uppercase != null)
122
+ styles.textTransform = value2.uppercase === true ? "uppercase" : "initial";
123
+ if (value2.underline != null || value2.strikethrough != null)
124
+ styles.textDecoration = [Boolean(value2.underline) && "underline", Boolean(value2.strikethrough) && "line-through"].filter(Boolean).join(" ");
125
+ if (value2.italic != null)
126
+ styles.fontStyle = value2.italic === true ? "italic" : "initial";
127
+ return styles;
128
+ }, shallowMergeFallbacks));
129
+ }
130
+ function TypographyLeaf({
131
+ leaf,
132
+ children,
133
+ attributes
134
+ }) {
135
+ const enhancedTypography = useEnhancedTypography(leaf.typography);
136
+ const typographyClassName = useTypographyClassName(enhancedTypography);
137
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
138
+ className: typographyClassName,
139
+ children
140
+ }));
141
+ }
142
+ export { TypographyLeaf as T, useTypographyClassName as a, useEnhancedTypography as u };
143
+ //# sourceMappingURL=typography.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.es.js","sources":["../src/components/builtin/Text/components/Leaf/typography.tsx"],"sourcesContent":["import { CSSObject } from '@emotion/serialize'\nimport { RenderLeafProps } from 'slate-react'\nimport { Swatch, Typography } from '../../../../../api'\nimport { TypographyText } from '../../../../../controls'\nimport { DeviceOverride, ResponsiveValue } from '../../../../../prop-controllers'\nimport { getTypographyStyleSwatchIds } from '../../../../../prop-controllers/introspection'\nimport { useTypography, useSwatches } from '../../../../../runtimes/react/hooks/makeswift-api'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { colorToString } from '../../../../utils/colorToString'\nimport { findDeviceOverride, shallowMergeFallbacks } from '../../../../utils/devices'\nimport { isNonNullable } from '../../../../utils/isNonNullable'\nimport { responsiveStyle } from '../../../../utils/responsive-style'\nimport { ColorValue } from '../../../../utils/types'\n\nexport type TypographyValue = Typography['style'][number]['value']\n\ntype EnhancedColor = {\n color?: ColorValue\n}\n\ntype EnhancedTypographyValue = Omit<TypographyValue, keyof EnhancedColor> & EnhancedColor\n\nexport type EnhancedTypography = Array<DeviceOverride<EnhancedTypographyValue>>\n\nexport function isDeviceOverride(value: {\n deviceId: string\n value: TypographyValue\n}): value is DeviceOverride<TypographyValue> {\n return value.deviceId === 'desktop' || value.deviceId === 'tablet' || value.deviceId === 'mobile'\n}\n\nconst withColor =\n (swatches: Swatch[]) =>\n (\n deviceRawTypographyValue: DeviceOverride<TypographyValue>,\n ): DeviceOverride<EnhancedTypographyValue> => {\n const { value, deviceId } = deviceRawTypographyValue\n\n if (value.color == null) {\n const { color, ...nextValue } = value\n return {\n deviceId,\n value: nextValue,\n }\n }\n return {\n deviceId,\n value: {\n ...value,\n color: {\n swatch: swatches.find(s => s && s.id === value.color?.swatchId),\n alpha: value.color?.alpha ?? undefined,\n },\n },\n }\n }\n\nconst getDeviceId = ({ deviceId }: DeviceOverride<unknown>) => deviceId\n\n/**\n * `enhanced` here just means typography ids have been replaced with the related entity.\n */\nexport default function useEnhancedTypography(value: Typography): EnhancedTypography {\n const typography = useTypography(value?.id ?? null)\n const source = typography?.style.filter(isDeviceOverride) ?? []\n const override = value?.style.filter(isDeviceOverride) ?? []\n\n const swatchIds = [\n ...getTypographyStyleSwatchIds(value?.style),\n ...getTypographyStyleSwatchIds(typography?.style),\n ]\n const swatches = useSwatches(swatchIds).filter(isNonNullable)\n\n const enhancedSource = source.map(withColor(swatches))\n const enhancedOverride = override.map(withColor(swatches))\n\n const devices = [\n ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId))),\n ]\n\n return devices\n .map(deviceId => {\n const deviceSource = findDeviceOverride(enhancedSource, deviceId)?.value\n const deviceOverride = findDeviceOverride(enhancedOverride, deviceId)?.value\n\n if (deviceSource && deviceOverride) {\n return {\n deviceId,\n value: { ...deviceSource, ...deviceOverride },\n }\n } else if (deviceOverride) {\n return {\n deviceId,\n value: deviceOverride,\n }\n } else if (deviceSource) {\n return {\n deviceId,\n value: deviceSource,\n }\n }\n return null\n })\n .filter(isNonNullable)\n}\n\nexport function useTypographyClassName(value: EnhancedTypography): string {\n return useStyle(\n responsiveStyle<\n EnhancedTypographyValue,\n [ResponsiveValue<EnhancedTypographyValue> | null | undefined]\n >(\n [value],\n ([value]) => {\n if (value === undefined) return {}\n\n let styles: CSSObject = {}\n if (value.color != null) styles.color = colorToString(value.color)\n if (value.fontFamily != null) styles.fontFamily = value.fontFamily\n if (value.fontSize != null && value.fontSize.value != null && value.fontSize.unit != null)\n styles.fontSize = `${value.fontSize.value}${value.fontSize.unit}`\n if (value.fontWeight != null) styles.fontWeight = value.fontWeight\n if (value.lineHeight != null) styles.lineHeight = value.lineHeight\n if (value.letterSpacing != null) styles.letterSpacing = `${value.letterSpacing / 10}em`\n if (value.uppercase != null)\n styles.textTransform = value.uppercase === true ? 'uppercase' : 'initial'\n if (value.underline != null || value.strikethrough != null)\n styles.textDecoration = [\n Boolean(value.underline) && 'underline',\n Boolean(value.strikethrough) && 'line-through',\n ]\n .filter(Boolean)\n .join(' ')\n if (value.italic != null) styles.fontStyle = value.italic === true ? 'italic' : 'initial'\n\n return styles\n },\n shallowMergeFallbacks,\n ),\n )\n}\n\nexport interface TypographyRenderLeafProps extends RenderLeafProps {\n leaf: TypographyText\n}\n\nexport function TypographyLeaf({ leaf, children, attributes }: TypographyRenderLeafProps) {\n const enhancedTypography = useEnhancedTypography(leaf.typography)\n const typographyClassName = useTypographyClassName(enhancedTypography)\n return (\n <span {...attributes} className={typographyClassName}>\n {children}\n </span>\n )\n}\n"],"names":["value","deviceId","withColor","swatches","deviceRawTypographyValue","color","nextValue","swatch","find","s","id","swatchId","alpha","undefined","getDeviceId","typography","useTypography","source","style","filter","isDeviceOverride","override","swatchIds","getTypographyStyleSwatchIds","useSwatches","isNonNullable","enhancedSource","map","enhancedOverride","devices","Set","concat","deviceSource","findDeviceOverride","deviceOverride","useStyle","responsiveStyle","styles","colorToString","fontFamily","fontSize","unit","fontWeight","lineHeight","letterSpacing","uppercase","textTransform","underline","strikethrough","textDecoration","Boolean","join","italic","fontStyle","shallowMergeFallbacks","leaf","children","attributes","enhancedTypography","useEnhancedTypography","typographyClassName","useTypographyClassName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,0BAA0BA,OAGY;AAC3C,SAAOA,MAAMC,aAAa,aAAaD,MAAMC,aAAa,YAAYD,MAAMC,aAAa;AAC1F;AAED,MAAMC,YACJ,CAACC,aACD,CACEC,6BAC4C;;AACtC,QAAA;AAAA,IAAEJ;AAAAA,IAAOC;AAAAA,MAAaG;AAExBJ,MAAAA,MAAMK,SAAS,MAAM;AACjB,UAA0BL,YAAxBK;AAAAA;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,aAC5BG,QAAQlD,OAAMgD,aAAP,KAAyB,cAFV,EAIrB7B,OAAO+B,OAJc,EAKrBC,KAAK,GALgB;AAM1B,QAAInD,OAAMoD,UAAU;AAAMf,aAAOgB,YAAYrD,OAAMoD,WAAW,OAAO,WAAW;AAEzEf,WAAAA;AAAAA,EAAAA,GAETiB,qBA7Ba,CADF;AAiChB;AAM8B,wBAAA;AAAA,EAAEC;AAAAA,EAAMC;AAAAA,EAAUC;AAAAA,GAAyC;AAClFC,QAAAA,qBAAqBC,sBAAsBJ,KAAKxC,UAAN;AAC1C6C,QAAAA,sBAAsBC,uBAAuBH,kBAAD;AAClD,sEACYD;IAAY,WAAWG;AAAAA,IAC9BJ;AAAAA,EAAAA,EAFL;AAKD;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeswift/runtime",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "license": "MIT",
5
5
  "main": "dist/main.cjs",
6
6
  "module": "dist/main.es",
@@ -91,7 +91,7 @@
91
91
  "preview": "vite preview",
92
92
  "prepare": "yarn build",
93
93
  "generate": "graphql-codegen --config codegen.yml",
94
- "test": "vitest"
94
+ "test": "vitest --config vite.test.config.ts"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "next": ">=12.2.0 <13.0.0 || ^13.0.0",
@@ -99,7 +99,6 @@
99
99
  "react-dom": "^17.0.1 || ^18.0.0"
100
100
  },
101
101
  "dependencies": {
102
- "@convertkit/slate-lists": "^0.2.4",
103
102
  "@emotion/css": "^11.9.0",
104
103
  "@emotion/serialize": "^1.0.3",
105
104
  "@emotion/server": "^11.4.0",
@@ -113,8 +112,6 @@
113
112
  "@types/react": "^18.0.21",
114
113
  "@types/react-dom": "^18.0.6",
115
114
  "@types/set-cookie-parser": "^2.4.2",
116
- "@types/slate": "0.47.11",
117
- "@types/slate-react": "^0.22.9",
118
115
  "@types/use-sync-external-store": "^0.0.3",
119
116
  "@types/uuid": "^7.0.3",
120
117
  "color": "^3.1.3",
@@ -138,9 +135,8 @@
138
135
  "redux-thunk": "^2.3.0",
139
136
  "scroll-into-view-if-needed": "^2.2.20",
140
137
  "set-cookie-parser": "^2.5.1",
141
- "slate": "^0.47.8",
142
- "slate-hotkeys": "^0.2.9",
143
- "slate-react": "^0.22.9",
138
+ "slate": "^0.91.4",
139
+ "slate-react": "^0.91.7",
144
140
  "use-sync-external-store": "^1.0.0-rc.0",
145
141
  "uuid": "^3.3.3"
146
142
  },
@@ -159,8 +155,9 @@
159
155
  "prettier": "^2.5.1",
160
156
  "react": "18.0.0",
161
157
  "react-dom": "18.0.0",
162
- "slate": "^0.47.8",
163
- "slate-react": "^0.22.9",
158
+ "slate": "^0.91.4",
159
+ "slate-hyperscript": "^0.77.0",
160
+ "slate-react": "^0.91.7",
164
161
  "typescript": "^4.5.5",
165
162
  "vite": "^2.8.6",
166
163
  "vitest": "^0.7.4"
@@ -1,381 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
33
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
34
- var React = require("react");
35
- var slate = require("slate");
36
- var Hotkeys = require("slate-hotkeys");
37
- var isHotkey = require("is-hotkey");
38
- var boxModels = require("./box-models.cjs.js");
39
- var slateReact = require("slate-react");
40
- var Lists = require("@convertkit/slate-lists");
41
- var index = require("./index.cjs6.js");
42
- var jsxRuntime = require("react/jsx-runtime");
43
- var css = require("@emotion/css");
44
- var next = require("./index.cjs.js");
45
- var index$1 = require("./index.cjs3.js");
46
- require("use-sync-external-store/shim");
47
- var richText = require("./rich-text.cjs.js");
48
- require("css-box-model");
49
- require("./actions.cjs.js");
50
- require("./constants.cjs.js");
51
- require("redux");
52
- require("redux-thunk");
53
- require("./control.cjs.js");
54
- require("use-sync-external-store/shim/with-selector");
55
- require("next/dynamic");
56
- require("@emotion/serialize");
57
- require("@emotion/utils");
58
- require("./text-input.cjs.js");
59
- require("./combobox.cjs.js");
60
- require("./types.cjs.js");
61
- require("color");
62
- require("scroll-into-view-if-needed");
63
- require("react-dom");
64
- require("html-react-parser");
65
- require("next/head");
66
- require("@emotion/server/create-instance");
67
- require("next/document");
68
- require("cookie");
69
- require("cors");
70
- require("http-proxy");
71
- require("set-cookie-parser");
72
- require("uuid/v4");
73
- require("corporate-ipsum");
74
- require("next/link");
75
- function _interopDefaultLegacy(e) {
76
- return e && typeof e === "object" && "default" in e ? e : { "default": e };
77
- }
78
- var Hotkeys__default = /* @__PURE__ */ _interopDefaultLegacy(Hotkeys);
79
- var Lists__default = /* @__PURE__ */ _interopDefaultLegacy(Lists);
80
- const TYPOGRAPHY_TYPE = "typography";
81
- function DeviceOverridesMarksPlugin() {
82
- return {
83
- renderMark({
84
- mark,
85
- children
86
- }, _editor, next2) {
87
- if (mark.type === TYPOGRAPHY_TYPE) {
88
- return /* @__PURE__ */ jsxRuntime.jsx(index.Mark, {
89
- value: mark.data.get("value"),
90
- children
91
- });
92
- }
93
- return next2();
94
- }
95
- };
96
- }
97
- function DeviceOverridesBlockPlugin() {
98
- return {
99
- renderBlock(props, _editor, next2) {
100
- const {
101
- node,
102
- attributes,
103
- children
104
- } = props;
105
- const blockProps = {
106
- textAlign: node.data.get("textAlign")
107
- };
108
- switch (node.type) {
109
- case "paragraph":
110
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
111
- as: "p",
112
- children
113
- }));
114
- case "heading-one":
115
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
116
- as: "h1",
117
- children
118
- }));
119
- case "heading-two":
120
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
121
- as: "h2",
122
- children
123
- }));
124
- case "heading-three":
125
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
126
- as: "h3",
127
- children
128
- }));
129
- case "heading-four":
130
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
131
- as: "h4",
132
- children
133
- }));
134
- case "heading-five":
135
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
136
- as: "h5",
137
- children
138
- }));
139
- case "heading-six":
140
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
141
- as: "h6",
142
- children
143
- }));
144
- case "blockquote":
145
- return /* @__PURE__ */ jsxRuntime.jsx(index.DeviceOverrideBlock, __spreadProps(__spreadValues(__spreadValues({}, attributes), blockProps), {
146
- as: "blockquote",
147
- children
148
- }));
149
- default:
150
- return next2();
151
- }
152
- }
153
- };
154
- }
155
- function StyledLink(_a) {
156
- var _b = _a, {
157
- className
158
- } = _b, restOfProps = __objRest(_b, [
159
- "className"
160
- ]);
161
- return /* @__PURE__ */ jsxRuntime.jsx(index$1.Link, __spreadProps(__spreadValues({}, restOfProps), {
162
- className: css.cx(next.useStyle({
163
- textDecoration: "none"
164
- }), className)
165
- }));
166
- }
167
- function LinkPlugin() {
168
- return {
169
- renderInline(props, _editor, next2) {
170
- const {
171
- attributes,
172
- children,
173
- node
174
- } = props;
175
- switch (node.type) {
176
- case "link": {
177
- const {
178
- data
179
- } = node;
180
- return /* @__PURE__ */ jsxRuntime.jsx(StyledLink, __spreadProps(__spreadValues({}, attributes), {
181
- link: data.toJS(),
182
- children
183
- }));
184
- }
185
- default: {
186
- return next2();
187
- }
188
- }
189
- }
190
- };
191
- }
192
- function Inlines() {
193
- return {
194
- renderInline(props, _editor, next2) {
195
- const {
196
- attributes,
197
- children,
198
- node
199
- } = props;
200
- switch (node.type) {
201
- case "code": {
202
- return /* @__PURE__ */ jsxRuntime.jsx("code", __spreadProps(__spreadValues({}, attributes), {
203
- children
204
- }));
205
- }
206
- case "superscript": {
207
- return /* @__PURE__ */ jsxRuntime.jsx("sup", __spreadProps(__spreadValues({}, attributes), {
208
- children
209
- }));
210
- }
211
- case "subscript": {
212
- return /* @__PURE__ */ jsxRuntime.jsx("sub", __spreadProps(__spreadValues({}, attributes), {
213
- children
214
- }));
215
- }
216
- default: {
217
- return next2();
218
- }
219
- }
220
- }
221
- };
222
- }
223
- const RichTextEditor = React.forwardRef(function RichTextEditor2(_c, ref) {
224
- var _d = _c, {
225
- placeholder = "Write some text...",
226
- className
227
- } = _d, restOfProps = __objRest(_d, [
228
- "placeholder",
229
- "className"
230
- ]);
231
- const plugins = React.useMemo(() => [Lists__default["default"](), LinkPlugin(), Inlines(), DeviceOverridesBlockPlugin(), DeviceOverridesMarksPlugin()], []);
232
- return /* @__PURE__ */ jsxRuntime.jsx(slateReact.Editor, __spreadProps(__spreadValues({}, restOfProps), {
233
- style: {
234
- WebkitUserModify: void 0
235
- },
236
- className: css.cx(next.useStyle({
237
- "ul, ol": {
238
- margin: 0
239
- }
240
- }), className),
241
- ref,
242
- autoFocus: false,
243
- plugins,
244
- placeholder
245
- }));
246
- });
247
- const defaultText = {
248
- document: {
249
- nodes: [{
250
- object: "block",
251
- type: "paragraph",
252
- nodes: []
253
- }]
254
- },
255
- data: {}
256
- };
257
- const COMMIT_DEBOUNCE_DELAY = 500;
258
- const EditableText = React.forwardRef(function EditableText2({
259
- id,
260
- text,
261
- width,
262
- margin
263
- }, ref) {
264
- const [editor, setEditor] = React.useState(null);
265
- const [propControllers, setPropControllers] = React.useState(null);
266
- const controller = propControllers == null ? void 0 : propControllers.text;
267
- const editMode = next.useBuilderEditMode();
268
- React.useEffect(() => {
269
- const element = editor == null ? void 0 : editor.findDOMNode([]);
270
- if (element == null || !(element instanceof HTMLElement) || controller == null)
271
- return;
272
- return next.pollBoxModel({
273
- element,
274
- onBoxModelChange: (boxModel) => controller.changeBoxModel(boxModel)
275
- });
276
- }, [editor, controller]);
277
- React.useImperativeHandle(ref, () => ({
278
- getDomNode() {
279
- const el = editor == null ? void 0 : editor.findDOMNode([]);
280
- return el instanceof Element ? el : null;
281
- },
282
- getBoxModel() {
283
- const el = editor == null ? void 0 : editor.findDOMNode([]);
284
- return el instanceof Element ? boxModels.getBox(el) : null;
285
- },
286
- setPropControllers
287
- }), [editor, setPropControllers]);
288
- React.useEffect(() => {
289
- if (editor)
290
- controller == null ? void 0 : controller.setSlateEditor(editor);
291
- }, [controller, editor]);
292
- const [value, setValue] = React.useState(() => {
293
- const _a = text != null ? text : defaultText, {
294
- selection
295
- } = _a, textWithoutSelection = __objRest(_a, [
296
- "selection"
297
- ]);
298
- return slate.Value.fromJSON(textWithoutSelection);
299
- });
300
- const [shouldCommit, setShouldCommit] = React.useState(true);
301
- React.useEffect(() => {
302
- if (shouldCommit) {
303
- const nextValue = slate.Value.fromJSON(text != null ? text : defaultText);
304
- setValue((currentValue) => currentValue.selection.isBlurred ? slate.Value.fromJSON(nextValue.toJSON({
305
- preserveSelection: false
306
- })) : nextValue);
307
- }
308
- }, [shouldCommit, text]);
309
- React.useEffect(() => {
310
- if (shouldCommit)
311
- return;
312
- const timeoutId = window.setTimeout(() => {
313
- setShouldCommit(true);
314
- }, COMMIT_DEBOUNCE_DELAY);
315
- return () => {
316
- window.clearTimeout(timeoutId);
317
- };
318
- }, [shouldCommit]);
319
- function handleChange(change) {
320
- setValue(change.value);
321
- if (change.value !== value) {
322
- setShouldCommit(false);
323
- controller == null ? void 0 : controller.onChange(change);
324
- }
325
- }
326
- const lastController = React.useRef(controller);
327
- if (lastController.current !== controller)
328
- lastController.current = controller;
329
- const handleFocus = React.useCallback(() => {
330
- var _a;
331
- (_a = lastController.current) == null ? void 0 : _a.focus();
332
- }, []);
333
- const handleKeyDown = React.useCallback((event, _editor, next2) => {
334
- var _a, _b, _c;
335
- if (Hotkeys__default["default"].isUndo(event)) {
336
- (_a = lastController.current) == null ? void 0 : _a.undo();
337
- return true;
338
- }
339
- if (Hotkeys__default["default"].isRedo(event)) {
340
- (_b = lastController.current) == null ? void 0 : _b.redo();
341
- return true;
342
- }
343
- if (isHotkey.isHotkey("escape")(event)) {
344
- (_c = lastController.current) == null ? void 0 : _c.blur();
345
- return true;
346
- }
347
- return next2();
348
- }, []);
349
- const handleBlur = React.useCallback((event, editor2, next2) => {
350
- const selection = editor2.value.selection;
351
- next2();
352
- if (event.relatedTarget == null)
353
- editor2.select(selection);
354
- }, []);
355
- const lastEditMode = React.useRef(editMode);
356
- if (lastEditMode.current !== editMode)
357
- lastEditMode.current = editMode;
358
- const handleClick = (event, _editor, next2) => {
359
- next2();
360
- if (lastEditMode.current === richText.BuilderEditMode.CONTENT)
361
- event.stopPropagation();
362
- };
363
- return /* @__PURE__ */ jsxRuntime.jsx(RichTextEditor, {
364
- id,
365
- ref: setEditor,
366
- className: css.cx(next.useStyle({
367
- "ul, ol": {
368
- margin: 0
369
- }
370
- }), width, margin),
371
- value,
372
- onChange: handleChange,
373
- onFocus: handleFocus,
374
- onKeyDown: handleKeyDown,
375
- onBlur: handleBlur,
376
- onClick: handleClick,
377
- readOnly: editMode !== richText.BuilderEditMode.CONTENT
378
- });
379
- });
380
- exports["default"] = EditableText;
381
- //# sourceMappingURL=EditableText.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditableText.cjs.js","sources":["../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Link.tsx","../src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.tsx","../src/components/builtin/Text/components/RichTextEditor/index.tsx","../src/components/builtin/Text/EditableText.tsx"],"sourcesContent":["import type { Plugin } from 'slate-react'\n\nimport Mark from '../components/Mark'\n\nconst TYPOGRAPHY_TYPE = 'typography'\n\nexport default function DeviceOverridesMarksPlugin(): Plugin {\n return {\n renderMark({ mark, children }, _editor, next) {\n if (mark.type === TYPOGRAPHY_TYPE) {\n return <Mark value={mark.data.get('value')}>{children}</Mark>\n }\n\n return next()\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nimport Block from '../components/Block'\n\nexport default function DeviceOverridesBlockPlugin(): Plugin {\n return {\n renderBlock(props, _editor, next): JSX.Element {\n const { node, attributes, children } = props\n const blockProps = { textAlign: node.data.get('textAlign') }\n\n switch (node.type) {\n case 'paragraph':\n return (\n <Block {...attributes} {...blockProps} as=\"p\">\n {children}\n </Block>\n )\n\n case 'heading-one':\n return (\n <Block {...attributes} {...blockProps} as=\"h1\">\n {children}\n </Block>\n )\n\n case 'heading-two':\n return (\n <Block {...attributes} {...blockProps} as=\"h2\">\n {children}\n </Block>\n )\n\n case 'heading-three':\n return (\n <Block {...attributes} {...blockProps} as=\"h3\">\n {children}\n </Block>\n )\n\n case 'heading-four':\n return (\n <Block {...attributes} {...blockProps} as=\"h4\">\n {children}\n </Block>\n )\n\n case 'heading-five':\n return (\n <Block {...attributes} {...blockProps} as=\"h5\">\n {children}\n </Block>\n )\n\n case 'heading-six':\n return (\n <Block {...attributes} {...blockProps} as=\"h6\">\n {children}\n </Block>\n )\n\n case 'blockquote':\n return (\n <Block {...attributes} {...blockProps} as=\"blockquote\">\n {children}\n </Block>\n )\n\n default:\n return next()\n }\n },\n }\n}\n","import { cx } from '@emotion/css'\nimport { ComponentPropsWithoutRef } from 'react'\nimport { Plugin } from 'slate-react'\nimport { useStyle } from '../../../../../../runtimes/react/use-style'\n\nimport { Link } from '../../../../../shared/Link'\n\nfunction StyledLink({ className, ...restOfProps }: ComponentPropsWithoutRef<typeof Link>) {\n return <Link {...restOfProps} className={cx(useStyle({ textDecoration: 'none' }), className)} />\n}\n\nexport default function LinkPlugin(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'link': {\n const { data } = node\n\n return (\n <StyledLink {...attributes} link={data.toJS()}>\n {children}\n </StyledLink>\n )\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { Plugin } from 'slate-react'\n\nexport default function Inlines(): Plugin {\n return {\n renderInline(props, _editor, next) {\n const { attributes, children, node } = props\n\n switch (node.type) {\n case 'code': {\n return <code {...attributes}>{children}</code>\n }\n\n case 'superscript': {\n return <sup {...attributes}>{children}</sup>\n }\n\n case 'subscript': {\n return <sub {...attributes}>{children}</sub>\n }\n\n default: {\n return next()\n }\n }\n },\n }\n}\n","import { ComponentPropsWithoutRef, forwardRef, useMemo } from 'react'\n\nimport { Editor as SlateEditor } from 'slate-react'\n\n// @ts-expect-error: no types for '@convertkit/slate-lists'\nimport Lists from '@convertkit/slate-lists'\n\nimport DeviceOverridesMarks from './plugins/DeviceOverridesMarks'\nimport DeviceOverridesBlocks from './plugins/DeviceOverridesBlocks'\nimport Link from './plugins/Link'\nimport Inlines from './plugins/Inlines'\nimport { useStyle } from '../../../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\nexport { overrideTypographyStyle } from './components/Mark'\n\ntype Props = ComponentPropsWithoutRef<typeof SlateEditor>\n\nexport const RichTextEditor = forwardRef<SlateEditor, Props>(function RichTextEditor(\n { placeholder = 'Write some text...', className, ...restOfProps }: Props,\n ref,\n) {\n const plugins = useMemo(\n () => [Lists(), Link(), Inlines(), DeviceOverridesBlocks(), DeviceOverridesMarks()],\n [],\n )\n\n return (\n <SlateEditor\n {...restOfProps}\n // Workaround because our Slate editor is broken on Chrome 105\n // Problem: https://linear.app/makeswift/issue/PRD-434/our-rich-text-component-breaks-in-the-latest-version-of-chrome\n // Workaround: https://github.com/ianstormtaylor/slate/issues/5110#issuecomment-1234951122\n style={{ WebkitUserModify: undefined }}\n className={cx(useStyle({ 'ul, ol': { margin: 0 } }), className)}\n ref={ref}\n autoFocus={false}\n plugins={plugins}\n placeholder={placeholder}\n />\n )\n})\n","import {\n useState,\n Ref,\n useImperativeHandle,\n forwardRef,\n useEffect,\n useCallback,\n useRef,\n KeyboardEvent as ReactKeyboardEvent,\n FocusEvent as ReactFocusEvent,\n MouseEvent as ReactMouseEvent,\n} from 'react'\nimport { Editor, OnChangeParam } from 'slate-react'\nimport { Value, ValueJSON } from 'slate'\n// @ts-expect-error: no types for 'slate-hotkeys'\nimport Hotkeys from 'slate-hotkeys'\nimport { isHotkey } from 'is-hotkey'\n\nimport {\n ElementIDValue,\n RichTextDescriptor,\n RichTextValue,\n} from '../../../prop-controllers/descriptors'\nimport { BoxModelHandle, getBox } from '../../../box-model'\nimport { PropControllersHandle } from '../../../state/modules/prop-controller-handles'\nimport { RichTextEditor } from './components/RichTextEditor'\nimport { DescriptorsPropControllers } from '../../../prop-controllers/instances'\nimport { cx } from '@emotion/css'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { pollBoxModel } from '../../../runtimes/react/poll-box-model'\nimport { useBuilderEditMode } from '../../../runtimes/react'\nimport { BuilderEditMode } from '../../../state/modules/builder-edit-mode'\n\ntype Props = {\n id?: ElementIDValue\n text?: RichTextValue\n width?: string\n margin?: string\n}\n\nconst defaultText: ValueJSON = {\n document: { nodes: [{ object: 'block' as const, type: 'paragraph' as const, nodes: [] }] },\n data: {},\n}\n\nconst COMMIT_DEBOUNCE_DELAY = 500\n\ntype Descriptors = { text?: RichTextDescriptor }\n\nconst EditableText = forwardRef(function EditableText(\n { id, text, width, margin }: Props,\n ref: Ref<BoxModelHandle & PropControllersHandle<Descriptors>>,\n) {\n const [editor, setEditor] = useState<Editor | null>(null)\n const [propControllers, setPropControllers] =\n useState<DescriptorsPropControllers<Descriptors> | null>(null)\n const controller = propControllers?.text\n const editMode = useBuilderEditMode()\n\n useEffect(() => {\n const element = editor?.findDOMNode([])\n if (element == null || !(element instanceof HTMLElement) || controller == null) return\n return pollBoxModel({\n element: element,\n onBoxModelChange: boxModel => controller.changeBoxModel(boxModel),\n })\n }, [editor, controller])\n\n useImperativeHandle(\n ref,\n () => ({\n getDomNode() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? el : null\n },\n getBoxModel() {\n const el = editor?.findDOMNode([])\n\n return el instanceof Element ? getBox(el) : null\n },\n setPropControllers,\n }),\n [editor, setPropControllers],\n )\n\n useEffect(() => {\n if (editor) controller?.setSlateEditor(editor)\n }, [controller, editor])\n\n /**\n * We must keep local state so that we can reflect the user's typed changes immediately. At the\n * same time, though, the source of truth for the data is the prop data. This presents a\n * challenge: how do we keep local state in sync with the prop data without mangling user input as\n * data comes in?\n *\n * Consider, for example, that the user types \"Hello\". If at a later time, when the user is trying\n * to type \", world\" the component re-renders with prop data \"H\", \"He\", \"Hel\", \"Hell\", \"Hello\", it\n * will disrupt the user's typing. This could also happen as a result of the prop data changing\n * for other reasons, like collaborators changing the prop data concurrently. We want to avoid to\n * disrupt the user's typing, while at the same time display the \"true\" value as quickly as\n * possible.\n *\n * The approach we take here is to commit the prop data at an opportune time: as the user is\n * typing we avoid to commit prop data. But once they've stopped typing, we commit it as soon as\n * possible. This is known as a debounce.\n */\n const [value, setValue] = useState(() => {\n const { selection, ...textWithoutSelection } = text ?? defaultText\n\n return Value.fromJSON(textWithoutSelection)\n })\n const [shouldCommit, setShouldCommit] = useState(true)\n\n useEffect(() => {\n if (shouldCommit) {\n const nextValue = Value.fromJSON(text ?? defaultText)\n\n setValue(currentValue =>\n currentValue.selection.isBlurred\n ? Value.fromJSON(nextValue.toJSON({ preserveSelection: false }))\n : nextValue,\n )\n }\n }, [shouldCommit, text])\n\n useEffect(() => {\n if (shouldCommit) return\n\n const timeoutId = window.setTimeout(() => {\n setShouldCommit(true)\n }, COMMIT_DEBOUNCE_DELAY)\n\n return () => {\n window.clearTimeout(timeoutId)\n }\n }, [shouldCommit])\n\n function handleChange(change: OnChangeParam) {\n setValue(change.value as Value)\n\n if (change.value !== value) {\n setShouldCommit(false)\n\n controller?.onChange(change)\n }\n }\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change. Since `controller` is first `undefined` then we must use a ref.\n const lastController = useRef(controller)\n if (lastController.current !== controller) lastController.current = controller\n const handleFocus = useCallback(() => {\n lastController.current?.focus()\n }, [])\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent, _editor: Editor, next: () => any) => {\n if (Hotkeys.isUndo(event)) {\n lastController.current?.undo()\n\n return true\n }\n\n if (Hotkeys.isRedo(event)) {\n lastController.current?.redo()\n\n return true\n }\n\n if (isHotkey('escape')(event)) {\n lastController.current?.blur()\n\n return true\n }\n\n return next()\n },\n [],\n )\n const handleBlur = useCallback((event: ReactFocusEvent, editor: Editor, next: () => any) => {\n const selection = editor.value.selection\n\n next()\n\n // Normally, after a user highlight a text, clicking on the panel will remove the text selection.\n // This line is a workaround for that. Because the panel is not in the iframe, relatedTarget\n // would be null, and we select the previous text selection to maintain the text highlight.\n // Inspiration: https://github.com/ianstormtaylor/slate/issues/3412#issuecomment-663906003\n if (event.relatedTarget == null) editor.select(selection)\n }, [])\n\n // HACK: Slate holds on to the very first DOM event handlers passed in and doesn't update them\n // even if they change.\n const lastEditMode = useRef(editMode)\n if (lastEditMode.current !== editMode) lastEditMode.current = editMode\n\n const handleClick = (event: ReactMouseEvent, _editor: Editor, next: () => any) => {\n next()\n\n // This is needed to prevent clicks from propagating in content mode.\n // This is not ideal because it might break if we implement a plugin in the future that depends on click.\n // Also, we might also want to stop hover/mousedown event\n if (lastEditMode.current === BuilderEditMode.CONTENT) event.stopPropagation()\n }\n\n return (\n <RichTextEditor\n // @ts-expect-error: types don't allow for 'id' prop even though it's used.\n id={id}\n ref={setEditor}\n className={cx(useStyle({ 'ul, ol': { margin: 0 } }), width, margin)}\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n onClick={handleClick}\n readOnly={editMode !== BuilderEditMode.CONTENT}\n />\n )\n})\n\nexport default EditableText\n"],"names":["TYPOGRAPHY_TYPE","renderMark","mark","children","_editor","next","type","Mark","data","get","renderBlock","props","node","attributes","blockProps","textAlign","Block","className","restOfProps","Link","cx","useStyle","textDecoration","renderInline","toJS","RichTextEditor","forwardRef","ref","placeholder","plugins","useMemo","Lists","Inlines","DeviceOverridesBlocks","DeviceOverridesMarks","SlateEditor","WebkitUserModify","undefined","margin","defaultText","document","nodes","object","COMMIT_DEBOUNCE_DELAY","EditableText","id","text","width","editor","setEditor","useState","propControllers","setPropControllers","controller","editMode","useBuilderEditMode","useEffect","element","findDOMNode","HTMLElement","pollBoxModel","onBoxModelChange","boxModel","changeBoxModel","useImperativeHandle","getDomNode","el","Element","getBoxModel","getBox","setSlateEditor","value","setValue","selection","textWithoutSelection","Value","fromJSON","shouldCommit","setShouldCommit","nextValue","currentValue","isBlurred","toJSON","preserveSelection","timeoutId","window","setTimeout","clearTimeout","change","onChange","lastController","useRef","current","handleFocus","useCallback","focus","handleKeyDown","event","Hotkeys","isUndo","undo","isRedo","redo","isHotkey","blur","handleBlur","relatedTarget","select","lastEditMode","handleClick","BuilderEditMode","CONTENT","stopPropagation","handleChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAMA,kBAAkB;AAEqC,sCAAA;AACpD,SAAA;AAAA,IACLC,WAAW;AAAA,MAAEC;AAAAA,MAAMC;AAAAA,OAAYC,SAASC,OAAM;AACxCH,UAAAA,KAAKI,SAASN,iBAAiB;AACjC,8CAAQO,MAAAA,MAAD;AAAA,UAAM,OAAOL,KAAKM,KAAKC,IAAI,OAAd;AAAA,UAAyBN;AAAAA,QAAAA,CAA7C;AAAA,MACD;AAED,aAAOE,MAAP;AAAA,IACD;AAAA,EAAA;AAEJ;ACZ4D,sCAAA;AACpD,SAAA;AAAA,IACLK,YAAYC,OAAOP,SAASC,OAAmB;AACvC,YAAA;AAAA,QAAEO;AAAAA,QAAMC;AAAAA,QAAYV;AAAAA,UAAaQ;AACvC,YAAMG,aAAa;AAAA,QAAEC,WAAWH,KAAKJ,KAAKC,IAAI,WAAd;AAAA,MAAA;AAExBG,cAAAA,KAAKN;AAAAA,aACN;AAED,gDAACU,MAAAA,qBAAD,gDAAWH,aAAgBC,aAA3B;AAAA,YAAuC,IAAG;AAAA,YACvCX;AAAAA,UAAAA,EAFL;AAAA,aAMG;AAED,gDAACa,MAAAA,qBAAD,gDAAWH,aAAgBC,aAA3B;AAAA,YAAuC,IAAG;AAAA,YACvCX;AAAAA,UAAAA,EAFL;AAAA,aAMG;AAED,gDAACa,MAAAA,qBAAD,gDAAWH,aAAgBC,aAA3B;AAAA,YAAuC,IAAG;AAAA,YACvCX;AAAAA,UAAAA,EAFL;AAAA,aAMG;AAED,gDAACa,MAAAA,qBAAD,gDAAWH,aAAgBC,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