@makeswift/runtime 0.7.7 → 0.7.9

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 (264) hide show
  1. package/dist/Box.cjs.js +2 -0
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -0
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +2 -0
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +2 -0
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +2 -0
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +2 -0
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +2 -0
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +2 -0
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +2 -0
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +2 -0
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +2 -0
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +2 -0
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +3 -1
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +3 -1
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +2 -0
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +2 -0
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +2 -0
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +3 -1
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +2 -0
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +2 -0
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +29 -23
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +33 -25
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +185 -153
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +182 -153
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/Root.cjs.js +2 -0
  50. package/dist/Root.cjs.js.map +1 -1
  51. package/dist/Root.es.js +2 -0
  52. package/dist/Root.es.js.map +1 -1
  53. package/dist/SocialLinks.cjs.js +2 -0
  54. package/dist/SocialLinks.cjs.js.map +1 -1
  55. package/dist/SocialLinks.es.js +2 -0
  56. package/dist/SocialLinks.es.js.map +1 -1
  57. package/dist/Text.cjs.js +3 -1
  58. package/dist/Text.cjs.js.map +1 -1
  59. package/dist/Text.es.js +3 -1
  60. package/dist/Text.es.js.map +1 -1
  61. package/dist/Video.cjs.js +2 -0
  62. package/dist/Video.cjs.js.map +1 -1
  63. package/dist/Video.es.js +2 -0
  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 -0
  69. package/dist/builder.cjs.js.map +1 -1
  70. package/dist/builder.es.js +2 -0
  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 -0
  77. package/dist/components.cjs.js.map +1 -1
  78. package/dist/components.es.js +2 -0
  79. package/dist/components.es.js.map +1 -1
  80. package/dist/constants.cjs.js +2 -0
  81. package/dist/constants.cjs.js.map +1 -1
  82. package/dist/constants.es.js +2 -0
  83. package/dist/constants.es.js.map +1 -1
  84. package/dist/control-serialization.cjs.js +29 -0
  85. package/dist/control-serialization.cjs.js.map +1 -1
  86. package/dist/control-serialization.es.js +30 -0
  87. package/dist/control-serialization.es.js.map +1 -1
  88. package/dist/controls.cjs.js +13 -0
  89. package/dist/controls.cjs.js.map +1 -1
  90. package/dist/controls.es.js +4 -1
  91. package/dist/controls.es.js.map +1 -1
  92. package/dist/index.cjs.js +6 -4
  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 -0
  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 +6 -4
  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 -0
  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 -0
  109. package/dist/main.cjs.js.map +1 -1
  110. package/dist/main.es.js +2 -0
  111. package/dist/main.es.js.map +1 -1
  112. package/dist/next.cjs.js +2 -0
  113. package/dist/next.cjs.js.map +1 -1
  114. package/dist/next.es.js +2 -0
  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 +2 -0
  119. package/dist/prop-controllers.es.js.map +1 -1
  120. package/dist/react.cjs.js +2 -0
  121. package/dist/react.cjs.js.map +1 -1
  122. package/dist/react.es.js +2 -0
  123. package/dist/react.es.js.map +1 -1
  124. package/dist/rich-text.cjs.js +894 -22
  125. package/dist/rich-text.cjs.js.map +1 -1
  126. package/dist/rich-text.es.js +888 -23
  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/rich-text/compare.d.ts +5 -0
  207. package/dist/types/src/controls/rich-text/compare.d.ts.map +1 -0
  208. package/dist/types/src/controls/rich-text/compare.test.d.ts +2 -0
  209. package/dist/types/src/controls/rich-text/compare.test.d.ts.map +1 -0
  210. package/dist/types/src/controls/rich-text/dto-types.d.ts +131 -0
  211. package/dist/types/src/controls/rich-text/dto-types.d.ts.map +1 -0
  212. package/dist/types/src/controls/rich-text/fixtures/blockquote.d.ts +3 -0
  213. package/dist/types/src/controls/rich-text/fixtures/blockquote.d.ts.map +1 -0
  214. package/dist/types/src/controls/rich-text/fixtures/index.d.ts +4 -0
  215. package/dist/types/src/controls/rich-text/fixtures/index.d.ts.map +1 -0
  216. package/dist/types/src/controls/rich-text/fixtures/list.d.ts +3 -0
  217. package/dist/types/src/controls/rich-text/fixtures/list.d.ts.map +1 -0
  218. package/dist/types/src/controls/rich-text/fixtures/typography.d.ts +3 -0
  219. package/dist/types/src/controls/rich-text/fixtures/typography.d.ts.map +1 -0
  220. package/dist/types/src/controls/rich-text/index.d.ts +6 -0
  221. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -0
  222. package/dist/types/src/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +8 -10
  223. package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -0
  224. package/dist/types/src/controls/rich-text/translation.d.ts +8 -0
  225. package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -0
  226. package/dist/types/src/controls/rich-text/translation.test.d.ts +2 -0
  227. package/dist/types/src/controls/rich-text/translation.test.d.ts.map +1 -0
  228. package/dist/types/src/controls/rich-text/types.d.ts +134 -0
  229. package/dist/types/src/controls/rich-text/types.d.ts.map +1 -0
  230. package/dist/types/src/prop-controllers/descriptors.d.ts +2 -3
  231. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  232. package/dist/types/src/prop-controllers/instances.d.ts +4 -7
  233. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  234. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  235. package/dist/types/src/runtimes/react/element-imperative-handle.d.ts.map +1 -1
  236. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  237. package/dist/typography.cjs.js +146 -0
  238. package/dist/typography.cjs.js.map +1 -0
  239. package/dist/typography.es.js +143 -0
  240. package/dist/typography.es.js.map +1 -0
  241. package/package.json +7 -10
  242. package/dist/EditableText.cjs.js +0 -380
  243. package/dist/EditableText.cjs.js.map +0 -1
  244. package/dist/EditableText.es.js +0 -373
  245. package/dist/EditableText.es.js.map +0 -1
  246. package/dist/types/src/components/builtin/Text/EditableText.d.ts +0 -16
  247. package/dist/types/src/components/builtin/Text/EditableText.d.ts.map +0 -1
  248. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts +0 -10
  249. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts.map +0 -1
  250. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.d.ts +0 -25
  251. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/hooks/useTypographyMark.d.ts.map +0 -1
  252. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts +0 -10
  253. package/dist/types/src/components/builtin/Text/components/RichTextEditor/components/Mark/index.d.ts.map +0 -1
  254. package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts +0 -5
  255. package/dist/types/src/components/builtin/Text/components/RichTextEditor/index.d.ts.map +0 -1
  256. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.d.ts +0 -3
  257. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesBlocks.d.ts.map +0 -1
  258. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.d.ts +0 -3
  259. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/DeviceOverridesMarks.d.ts.map +0 -1
  260. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.d.ts +0 -3
  261. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Inlines.d.ts.map +0 -1
  262. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Link.d.ts +0 -3
  263. package/dist/types/src/components/builtin/Text/components/RichTextEditor/plugins/Link.d.ts.map +0 -1
  264. package/dist/types/src/controls/rich-text.d.ts.map +0 -1
@@ -23,6 +23,8 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var actions = require("./actions.cjs.js");
26
+ var slate = require("slate");
27
+ var slateReact = require("slate-react");
26
28
  const BuilderEditMode = {
27
29
  BUILD: "build",
28
30
  CONTENT: "content",
@@ -116,6 +118,122 @@ function copyStyleData(value, context) {
116
118
  }
117
119
  return __spreadProps(__spreadValues({}, value), { border: copyResponsiveBorder(value.border) });
118
120
  }
121
+ if (void 0) {
122
+ const { describe, test, expect } = void 0;
123
+ describe.concurrent("style copy", () => {
124
+ test("colors are replaced", () => {
125
+ const value = {
126
+ width: [
127
+ {
128
+ value: {
129
+ unit: "px",
130
+ value: 100
131
+ },
132
+ deviceId: "desktop"
133
+ }
134
+ ],
135
+ border: [
136
+ {
137
+ value: {
138
+ borderTop: {
139
+ color: {
140
+ alpha: 1,
141
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
142
+ },
143
+ style: "solid",
144
+ width: 9
145
+ },
146
+ borderLeft: {
147
+ color: {
148
+ alpha: 1,
149
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
150
+ },
151
+ style: "solid",
152
+ width: 9
153
+ },
154
+ borderRight: {
155
+ color: {
156
+ alpha: 1,
157
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
158
+ },
159
+ style: "solid",
160
+ width: 9
161
+ },
162
+ borderBottom: {
163
+ color: {
164
+ alpha: 1,
165
+ swatchId: "U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA=="
166
+ },
167
+ style: "solid",
168
+ width: 9
169
+ }
170
+ },
171
+ deviceId: "desktop"
172
+ }
173
+ ],
174
+ textStyle: [
175
+ {
176
+ value: {
177
+ fontSize: {
178
+ unit: "px",
179
+ value: 46
180
+ },
181
+ fontStyle: [],
182
+ fontFamily: "Oswald",
183
+ fontWeight: 400,
184
+ letterSpacing: 5.2,
185
+ textTransform: []
186
+ },
187
+ deviceId: "desktop"
188
+ }
189
+ ],
190
+ borderRadius: [
191
+ {
192
+ value: {
193
+ borderTopLeftRadius: {
194
+ unit: "px",
195
+ value: 4
196
+ },
197
+ borderTopRightRadius: {
198
+ unit: "px",
199
+ value: 4
200
+ },
201
+ borderBottomLeftRadius: {
202
+ unit: "px",
203
+ value: 4
204
+ },
205
+ borderBottomRightRadius: {
206
+ unit: "px",
207
+ value: 4
208
+ }
209
+ },
210
+ deviceId: "desktop"
211
+ }
212
+ ]
213
+ };
214
+ const expected = JSON.parse(JSON.stringify(value).replaceAll("U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"));
215
+ const replacementContext = {
216
+ elementHtmlIds: /* @__PURE__ */ new Set(),
217
+ elementKeys: /* @__PURE__ */ new Map(),
218
+ swatchIds: /* @__PURE__ */ new Map([
219
+ ["U3dhdGNoOmJjMDkwZWJjLTZkZDUtNDY1NS1hMDY0LTg3ZDAxM2U4YTFhNA==", "testing"]
220
+ ]),
221
+ fileIds: /* @__PURE__ */ new Map(),
222
+ typographyIds: /* @__PURE__ */ new Map(),
223
+ tableIds: /* @__PURE__ */ new Map(),
224
+ tableColumnIds: /* @__PURE__ */ new Map(),
225
+ pageIds: /* @__PURE__ */ new Map(),
226
+ globalElementIds: /* @__PURE__ */ new Map(),
227
+ globalElementData: /* @__PURE__ */ new Map()
228
+ };
229
+ const result = copyStyleData(value, {
230
+ replacementContext,
231
+ copyElement: (node) => node
232
+ });
233
+ expect(result).toMatchObject(expected);
234
+ });
235
+ });
236
+ }
119
237
  const Types = {
120
238
  Backgrounds: "Backgrounds",
121
239
  Border: "Border",
@@ -354,6 +472,32 @@ function copyImageData(value, context) {
354
472
  return value;
355
473
  return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
356
474
  }
475
+ if (void 0) {
476
+ const { describe, test, expect } = void 0;
477
+ describe.concurrent("image copy", () => {
478
+ test("image is replaced by a one in replacement context", () => {
479
+ const data = "file-id";
480
+ const expected = "testing";
481
+ const replacementContext = {
482
+ elementHtmlIds: /* @__PURE__ */ new Set(),
483
+ elementKeys: /* @__PURE__ */ new Map(),
484
+ swatchIds: /* @__PURE__ */ new Map(),
485
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
486
+ typographyIds: /* @__PURE__ */ new Map(),
487
+ tableIds: /* @__PURE__ */ new Map(),
488
+ tableColumnIds: /* @__PURE__ */ new Map(),
489
+ pageIds: /* @__PURE__ */ new Map(),
490
+ globalElementIds: /* @__PURE__ */ new Map(),
491
+ globalElementData: /* @__PURE__ */ new Map()
492
+ };
493
+ const result = copyImageData(data, {
494
+ replacementContext,
495
+ copyElement: (node) => node
496
+ });
497
+ expect(result).toMatchObject(expected);
498
+ });
499
+ });
500
+ }
357
501
  const LinkControlType = "makeswift::controls::link";
358
502
  function Link(config = {}) {
359
503
  return { type: LinkControlType, config };
@@ -374,6 +518,38 @@ function copyLinkData(value, context) {
374
518
  }
375
519
  return value;
376
520
  }
521
+ if (void 0) {
522
+ const { describe, test, expect } = void 0;
523
+ describe.concurrent("link", () => {
524
+ test("page id is replaced by one in replacement context", () => {
525
+ const data = {
526
+ type: "OPEN_PAGE",
527
+ payload: {
528
+ pageId: "UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=",
529
+ openInNewTab: false
530
+ }
531
+ };
532
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"));
533
+ const replacementContext = {
534
+ elementHtmlIds: /* @__PURE__ */ new Set(),
535
+ elementKeys: /* @__PURE__ */ new Map(),
536
+ swatchIds: /* @__PURE__ */ new Map(),
537
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTpmNTdmMjQ2MS0wMGY3LTQzZWUtYmIwOS03ODdiNTUyYzUyYWQ=", "testing"]]),
538
+ typographyIds: /* @__PURE__ */ new Map(),
539
+ tableIds: /* @__PURE__ */ new Map(),
540
+ tableColumnIds: /* @__PURE__ */ new Map(),
541
+ fileIds: /* @__PURE__ */ new Map(),
542
+ globalElementIds: /* @__PURE__ */ new Map(),
543
+ globalElementData: /* @__PURE__ */ new Map()
544
+ };
545
+ const result = copyLinkData(data, {
546
+ replacementContext,
547
+ copyElement: (node) => node
548
+ });
549
+ expect(result).toMatchObject(expected);
550
+ });
551
+ });
552
+ }
377
553
  const RichTextPropControllerMessageType = {
378
554
  CHANGE_BUILDER_EDIT_MODE: "CHANGE_BUILDER_EDIT_MODE",
379
555
  INITIALIZE_EDITOR: "INITIALIZE_EDITOR",
@@ -400,19 +576,24 @@ class RichTextPropController extends PropController {
400
576
  __publicField(this, "editor", null);
401
577
  }
402
578
  recv(message) {
403
- var _a, _b;
579
+ if (!this.editor)
580
+ return;
404
581
  switch (message.type) {
405
582
  case RichTextPropControllerMessageType.CHANGE_BUILDER_EDIT_MODE: {
406
583
  switch (message.editMode) {
407
584
  case BuilderEditMode.BUILD:
408
585
  case BuilderEditMode.INTERACT:
409
- (_a = this.editor) == null ? void 0 : _a.deselect().blur();
410
- break;
586
+ slateReact.ReactEditor.deselect(this.editor);
587
+ slateReact.ReactEditor.blur(this.editor);
411
588
  }
412
589
  break;
413
590
  }
414
591
  case RichTextPropControllerMessageType.FOCUS: {
415
- (_b = this.editor) == null ? void 0 : _b.focus().moveToRangeOfDocument();
592
+ slateReact.ReactEditor.focus(this.editor);
593
+ slate.Transforms.select(this.editor, {
594
+ anchor: slate.Editor.start(this.editor, []),
595
+ focus: slate.Editor.end(this.editor, [])
596
+ });
416
597
  break;
417
598
  }
418
599
  }
@@ -421,14 +602,18 @@ class RichTextPropController extends PropController {
421
602
  this.editor = editor;
422
603
  this.send({
423
604
  type: RichTextPropControllerMessageType.INITIALIZE_EDITOR,
424
- value: editor.value.toJSON({ preserveSelection: false })
425
- });
426
- }
427
- onChange(change) {
428
- this.send({
429
- type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,
430
- value: change.value.toJSON({ preserveSelection: true })
605
+ value: richTextDAOToDTO(editor.children, editor.selection)
431
606
  });
607
+ const _onChange = editor.onChange;
608
+ this.editor.onChange = (options) => {
609
+ _onChange(options);
610
+ if ((options == null ? void 0 : options.operation) != null) {
611
+ this.send({
612
+ type: RichTextPropControllerMessageType.CHANGE_EDITOR_VALUE,
613
+ value: richTextDAOToDTO(editor.children, editor.selection)
614
+ });
615
+ }
616
+ };
432
617
  }
433
618
  focus() {
434
619
  this.send({ type: RichTextPropControllerMessageType.FOCUS });
@@ -701,6 +886,47 @@ function copy$b(value, context) {
701
886
  }
702
887
  }
703
888
  }
889
+ if (void 0) {
890
+ const { describe, test, expect } = void 0;
891
+ describe.concurrent("navigation-links copy", () => {
892
+ test("replace page id from replacement context", () => {
893
+ const data = [
894
+ {
895
+ id: "e1cf2d04-012a-4481-832a-7b4dda62195e",
896
+ type: "button",
897
+ payload: {
898
+ link: {
899
+ type: "OPEN_PAGE",
900
+ payload: {
901
+ pageId: "UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=",
902
+ openInNewTab: true
903
+ }
904
+ },
905
+ label: "Fellow Page"
906
+ }
907
+ }
908
+ ];
909
+ const expected = JSON.parse(JSON.stringify(data).replace("UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"));
910
+ const replacementContext = {
911
+ elementHtmlIds: /* @__PURE__ */ new Set(),
912
+ elementKeys: /* @__PURE__ */ new Map(),
913
+ swatchIds: /* @__PURE__ */ new Map(),
914
+ fileIds: /* @__PURE__ */ new Map(),
915
+ typographyIds: /* @__PURE__ */ new Map(),
916
+ tableIds: /* @__PURE__ */ new Map(),
917
+ tableColumnIds: /* @__PURE__ */ new Map(),
918
+ pageIds: /* @__PURE__ */ new Map([["UGFnZTo2OGMzODZhNC1jYzRkLTQzMzUtYWZiMi05MDdhZGRkYzQ3YTM=", "testing"]]),
919
+ globalElementIds: /* @__PURE__ */ new Map(),
920
+ globalElementData: /* @__PURE__ */ new Map()
921
+ };
922
+ const result = copy$b(data, {
923
+ replacementContext,
924
+ copyElement: (node) => node
925
+ });
926
+ expect(result).toMatchObject(expected);
927
+ });
928
+ });
929
+ }
704
930
  function copy$a(value, context) {
705
931
  if (value == null)
706
932
  return value;
@@ -719,12 +945,85 @@ function copy$a(value, context) {
719
945
  });
720
946
  }
721
947
  }
948
+ if (void 0) {
949
+ const { describe, test, expect } = void 0;
950
+ describe.concurrent("shadow copy", () => {
951
+ test("replaces the swatch id", () => {
952
+ const data = [
953
+ {
954
+ value: [
955
+ {
956
+ id: "8575efe6-4d04-4361-b593-e559537c4c3c",
957
+ payload: {
958
+ color: {
959
+ alpha: 1,
960
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
961
+ },
962
+ offsetX: -5,
963
+ offsetY: 8.7,
964
+ blurRadius: 17,
965
+ spreadRadius: 16
966
+ }
967
+ }
968
+ ],
969
+ deviceId: "desktop"
970
+ }
971
+ ];
972
+ const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"));
973
+ const replacementContext = {
974
+ elementHtmlIds: /* @__PURE__ */ new Set(),
975
+ elementKeys: /* @__PURE__ */ new Map(),
976
+ swatchIds: /* @__PURE__ */ new Map([
977
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
978
+ ]),
979
+ fileIds: /* @__PURE__ */ new Map(),
980
+ typographyIds: /* @__PURE__ */ new Map(),
981
+ tableIds: /* @__PURE__ */ new Map(),
982
+ tableColumnIds: /* @__PURE__ */ new Map(),
983
+ pageIds: /* @__PURE__ */ new Map(),
984
+ globalElementIds: /* @__PURE__ */ new Map(),
985
+ globalElementData: /* @__PURE__ */ new Map()
986
+ };
987
+ const result = copy$a(data, {
988
+ replacementContext,
989
+ copyElement: (node) => node
990
+ });
991
+ expect(result).toMatchObject(expected);
992
+ });
993
+ });
994
+ }
722
995
  function copy$9(value, context) {
723
996
  var _a;
724
997
  if (value == null)
725
998
  return value;
726
999
  return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
727
1000
  }
1001
+ if (void 0) {
1002
+ const { describe, test, expect } = void 0;
1003
+ describe.concurrent("image copy", () => {
1004
+ test("image is replaced by a one in replacement context", () => {
1005
+ const data = "file-id";
1006
+ const expected = JSON.parse(JSON.stringify(data).replace("file-id", "testing"));
1007
+ const replacementContext = {
1008
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1009
+ elementKeys: /* @__PURE__ */ new Map(),
1010
+ swatchIds: /* @__PURE__ */ new Map(),
1011
+ fileIds: /* @__PURE__ */ new Map([["file-id", "testing"]]),
1012
+ typographyIds: /* @__PURE__ */ new Map(),
1013
+ tableIds: /* @__PURE__ */ new Map(),
1014
+ tableColumnIds: /* @__PURE__ */ new Map(),
1015
+ pageIds: /* @__PURE__ */ new Map(),
1016
+ globalElementIds: /* @__PURE__ */ new Map(),
1017
+ globalElementData: /* @__PURE__ */ new Map()
1018
+ };
1019
+ const result = copy$9(data, {
1020
+ replacementContext,
1021
+ copyElement: (node) => node
1022
+ });
1023
+ expect(result).toMatchObject(expected);
1024
+ });
1025
+ });
1026
+ }
728
1027
  function copy$8(value, context) {
729
1028
  if (value == null)
730
1029
  return value;
@@ -741,6 +1040,45 @@ function copy$8(value, context) {
741
1040
  });
742
1041
  }
743
1042
  }
1043
+ if (void 0) {
1044
+ const { describe, test, expect } = void 0;
1045
+ describe.concurrent("images copy", () => {
1046
+ test("images are replaced by ones in replacement context", () => {
1047
+ const data = [
1048
+ {
1049
+ key: "0ae80f8f-9d4a-43bc-ae7c-007164a19d22",
1050
+ props: {
1051
+ file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
1052
+ }
1053
+ },
1054
+ {
1055
+ key: "161674c3-8710-4fd6-90e6-6096c4e9bb88",
1056
+ props: {
1057
+ file: "RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM="
1058
+ }
1059
+ }
1060
+ ];
1061
+ const expected = JSON.parse(JSON.stringify(data).replaceAll("RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"));
1062
+ const replacementContext = {
1063
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1064
+ elementKeys: /* @__PURE__ */ new Map(),
1065
+ swatchIds: /* @__PURE__ */ new Map(),
1066
+ fileIds: /* @__PURE__ */ new Map([["RmlsZTo5ZmU3ZGUzMi1jY2E0LTRkMjktOWVlMC1jNTI2NDYxY2I1YjM=", "testing"]]),
1067
+ typographyIds: /* @__PURE__ */ new Map(),
1068
+ tableIds: /* @__PURE__ */ new Map(),
1069
+ tableColumnIds: /* @__PURE__ */ new Map(),
1070
+ pageIds: /* @__PURE__ */ new Map(),
1071
+ globalElementIds: /* @__PURE__ */ new Map(),
1072
+ globalElementData: /* @__PURE__ */ new Map()
1073
+ };
1074
+ const result = copy$8(data, {
1075
+ replacementContext,
1076
+ copyElement: (node) => node
1077
+ });
1078
+ expect(result).toMatchObject(expected);
1079
+ });
1080
+ });
1081
+ }
744
1082
  function copy$7(value, context) {
745
1083
  if (value == null)
746
1084
  return value;
@@ -763,12 +1101,88 @@ function copy$6(value, context) {
763
1101
  });
764
1102
  }
765
1103
  }
1104
+ if (void 0) {
1105
+ const { describe, test, expect } = void 0;
1106
+ describe.concurrent("table form fields copy", () => {
1107
+ test("replaces the table column id", () => {
1108
+ const data = {
1109
+ grid: [
1110
+ {
1111
+ value: {
1112
+ count: 12,
1113
+ spans: [[12], [12]]
1114
+ },
1115
+ deviceId: "desktop"
1116
+ }
1117
+ ],
1118
+ fields: [
1119
+ {
1120
+ id: "8c4b3dcb-d9d2-4199-9a66-c35aa39248f0",
1121
+ label: "hello",
1122
+ required: true,
1123
+ tableColumnId: "U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI="
1124
+ }
1125
+ ]
1126
+ };
1127
+ const expected = JSON.parse(JSON.stringify(data).replace("U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=", "testing"));
1128
+ const replacementContext = {
1129
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1130
+ elementKeys: /* @__PURE__ */ new Map(),
1131
+ swatchIds: /* @__PURE__ */ new Map(),
1132
+ fileIds: /* @__PURE__ */ new Map(),
1133
+ typographyIds: /* @__PURE__ */ new Map(),
1134
+ tableIds: /* @__PURE__ */ new Map(),
1135
+ tableColumnIds: /* @__PURE__ */ new Map([
1136
+ [
1137
+ "U2luZ2xlTGluZVRleHRUYWJsZUNvbHVtbjphMzQ0Yzk3ZC04MTQ0LTRmMzctYjU2My1hODE5OTQ5OGMyYWI=",
1138
+ "testing"
1139
+ ]
1140
+ ]),
1141
+ pageIds: /* @__PURE__ */ new Map(),
1142
+ globalElementIds: /* @__PURE__ */ new Map(),
1143
+ globalElementData: /* @__PURE__ */ new Map()
1144
+ };
1145
+ const result = copy$6(data, {
1146
+ replacementContext,
1147
+ copyElement: (node) => node
1148
+ });
1149
+ expect(result).toMatchObject(expected);
1150
+ });
1151
+ });
1152
+ }
766
1153
  function copy$5(value, context) {
767
1154
  var _a;
768
1155
  if (value == null)
769
1156
  return value;
770
1157
  return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
771
1158
  }
1159
+ if (void 0) {
1160
+ const { describe, test, expect } = void 0;
1161
+ describe.concurrent("table copy", () => {
1162
+ test("replaces the table id", () => {
1163
+ const data = "VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy";
1164
+ const replacementContext = {
1165
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1166
+ elementKeys: /* @__PURE__ */ new Map(),
1167
+ swatchIds: /* @__PURE__ */ new Map(),
1168
+ fileIds: /* @__PURE__ */ new Map(),
1169
+ typographyIds: /* @__PURE__ */ new Map(),
1170
+ tableIds: /* @__PURE__ */ new Map([
1171
+ ["VGFibGU6MTM5NDhlYzMtMjgwNS00Nzk0LTliNzctNDJkN2RhNmQxZWEy", "testing"]
1172
+ ]),
1173
+ tableColumnIds: /* @__PURE__ */ new Map(),
1174
+ pageIds: /* @__PURE__ */ new Map(),
1175
+ globalElementIds: /* @__PURE__ */ new Map(),
1176
+ globalElementData: /* @__PURE__ */ new Map()
1177
+ };
1178
+ const result = copy$5(data, {
1179
+ replacementContext,
1180
+ copyElement: (node) => node
1181
+ });
1182
+ expect(result).toMatch("testing");
1183
+ });
1184
+ });
1185
+ }
772
1186
  function copy$4(value, context) {
773
1187
  if (value == null)
774
1188
  return value;
@@ -793,6 +1207,110 @@ function copy$4(value, context) {
793
1207
  });
794
1208
  }
795
1209
  }
1210
+ if (void 0) {
1211
+ const { describe, test, expect } = void 0;
1212
+ describe.concurrent("border copy", () => {
1213
+ test("replaces the swatch id", () => {
1214
+ const data = [
1215
+ {
1216
+ value: {
1217
+ borderTop: {
1218
+ color: {
1219
+ alpha: 1,
1220
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1221
+ },
1222
+ style: "solid",
1223
+ width: 5
1224
+ },
1225
+ borderLeft: {
1226
+ color: {
1227
+ alpha: 1,
1228
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1229
+ },
1230
+ style: "solid",
1231
+ width: 5
1232
+ },
1233
+ borderRight: {
1234
+ color: {
1235
+ alpha: 1,
1236
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1237
+ },
1238
+ style: "solid",
1239
+ width: 5
1240
+ },
1241
+ borderBottom: {
1242
+ color: {
1243
+ alpha: 1,
1244
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1245
+ },
1246
+ style: "solid",
1247
+ width: 5
1248
+ }
1249
+ },
1250
+ deviceId: "desktop"
1251
+ }
1252
+ ];
1253
+ const expected = [
1254
+ {
1255
+ value: {
1256
+ borderTop: {
1257
+ color: {
1258
+ alpha: 1,
1259
+ swatchId: "testing"
1260
+ },
1261
+ style: "solid",
1262
+ width: 5
1263
+ },
1264
+ borderLeft: {
1265
+ color: {
1266
+ alpha: 1,
1267
+ swatchId: "testing"
1268
+ },
1269
+ style: "solid",
1270
+ width: 5
1271
+ },
1272
+ borderRight: {
1273
+ color: {
1274
+ alpha: 1,
1275
+ swatchId: "testing"
1276
+ },
1277
+ style: "solid",
1278
+ width: 5
1279
+ },
1280
+ borderBottom: {
1281
+ color: {
1282
+ alpha: 1,
1283
+ swatchId: "testing"
1284
+ },
1285
+ style: "solid",
1286
+ width: 5
1287
+ }
1288
+ },
1289
+ deviceId: "desktop"
1290
+ }
1291
+ ];
1292
+ const replacementContext = {
1293
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1294
+ elementKeys: /* @__PURE__ */ new Map(),
1295
+ swatchIds: /* @__PURE__ */ new Map([
1296
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "testing"]
1297
+ ]),
1298
+ fileIds: /* @__PURE__ */ new Map(),
1299
+ typographyIds: /* @__PURE__ */ new Map(),
1300
+ tableIds: /* @__PURE__ */ new Map(),
1301
+ tableColumnIds: /* @__PURE__ */ new Map(),
1302
+ pageIds: /* @__PURE__ */ new Map(),
1303
+ globalElementIds: /* @__PURE__ */ new Map(),
1304
+ globalElementData: /* @__PURE__ */ new Map()
1305
+ };
1306
+ const result = copy$4(data, {
1307
+ replacementContext,
1308
+ copyElement: (node) => node
1309
+ });
1310
+ expect(result).toMatchObject(expected);
1311
+ });
1312
+ });
1313
+ }
796
1314
  function copy$3(value, context) {
797
1315
  if (value == null)
798
1316
  return value;
@@ -879,6 +1397,100 @@ function copy$3(value, context) {
879
1397
  }
880
1398
  }
881
1399
  }
1400
+ if (void 0) {
1401
+ const { describe, test, expect } = void 0;
1402
+ describe.concurrent("rich text copy", () => {
1403
+ test("replaces the swatch id", () => {
1404
+ const data = {
1405
+ object: "value",
1406
+ document: {
1407
+ data: {},
1408
+ nodes: [
1409
+ {
1410
+ data: {},
1411
+ type: "paragraph",
1412
+ nodes: [
1413
+ {
1414
+ text: "Hello world",
1415
+ marks: [
1416
+ {
1417
+ data: {
1418
+ value: {
1419
+ id: "VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
1420
+ style: [
1421
+ {
1422
+ value: {
1423
+ color: {
1424
+ alpha: 1,
1425
+ swatchId: "U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg=="
1426
+ },
1427
+ fontSize: {
1428
+ unit: "px",
1429
+ value: 23
1430
+ },
1431
+ lineHeight: 2.5,
1432
+ strikethrough: true
1433
+ },
1434
+ deviceId: "desktop"
1435
+ }
1436
+ ]
1437
+ }
1438
+ },
1439
+ type: "typography",
1440
+ object: "mark"
1441
+ }
1442
+ ],
1443
+ object: "text"
1444
+ }
1445
+ ],
1446
+ object: "block"
1447
+ }
1448
+ ],
1449
+ object: "document"
1450
+ },
1451
+ selection: {
1452
+ focus: {
1453
+ path: [0, 0],
1454
+ object: "point",
1455
+ offset: 0
1456
+ },
1457
+ anchor: {
1458
+ path: [0, 0],
1459
+ object: "point",
1460
+ offset: 0
1461
+ },
1462
+ object: "selection",
1463
+ isFocused: false
1464
+ }
1465
+ };
1466
+ const expected = JSON.parse(JSON.stringify(data).replace("U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing").replace("VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=", "typography-testing"));
1467
+ const replacementContext = {
1468
+ elementHtmlIds: /* @__PURE__ */ new Set(),
1469
+ elementKeys: /* @__PURE__ */ new Map(),
1470
+ swatchIds: /* @__PURE__ */ new Map([
1471
+ ["U3dhdGNoOjgwMmNmZGMyLTc5ZDgtNDkyNy1hMDUwLWE1NmM1M2EzYzE0Mg==", "swatch-testing"]
1472
+ ]),
1473
+ fileIds: /* @__PURE__ */ new Map(),
1474
+ typographyIds: /* @__PURE__ */ new Map([
1475
+ [
1476
+ "VHlwb2dyYXBoeTo5ODE1NWY0Ni1mNmQzLTQ1M2YtODk5OC02ZWY5NzJhNTBlY2U=",
1477
+ "typography-testing"
1478
+ ]
1479
+ ]),
1480
+ tableIds: /* @__PURE__ */ new Map(),
1481
+ tableColumnIds: /* @__PURE__ */ new Map(),
1482
+ pageIds: /* @__PURE__ */ new Map(),
1483
+ globalElementIds: /* @__PURE__ */ new Map(),
1484
+ globalElementData: /* @__PURE__ */ new Map()
1485
+ };
1486
+ const result = copy$3(data, {
1487
+ replacementContext,
1488
+ copyElement: (node) => node
1489
+ });
1490
+ expect(result).toMatchObject(expected);
1491
+ });
1492
+ });
1493
+ }
882
1494
  function copy$2(value, context) {
883
1495
  if (value == null)
884
1496
  return value;
@@ -956,6 +1568,248 @@ function copy(definition, value, context) {
956
1568
  return value;
957
1569
  }
958
1570
  }
1571
+ const ObjectType = {
1572
+ Value: "value",
1573
+ Text: "text",
1574
+ Inline: "inline",
1575
+ Block: "block",
1576
+ Document: "document",
1577
+ Leaf: "leaf",
1578
+ Selection: "selection",
1579
+ Mark: "mark",
1580
+ Range: "range",
1581
+ Decoration: "decoration",
1582
+ Annotation: "annotation",
1583
+ Point: "point",
1584
+ Operation: "operation"
1585
+ };
1586
+ const TextType = {
1587
+ Typography: "typography",
1588
+ Text: "text"
1589
+ };
1590
+ const BlockType = {
1591
+ Paragraph: "paragraph",
1592
+ Heading1: "heading-one",
1593
+ Heading2: "heading-two",
1594
+ Heading3: "heading-three",
1595
+ Heading4: "heading-four",
1596
+ Heading5: "heading-five",
1597
+ Heading6: "heading-six",
1598
+ BlockQuote: "blockquote",
1599
+ UnorderedList: "unordered-list",
1600
+ OrderedList: "ordered-list",
1601
+ ListItem: "list-item",
1602
+ ListItemChild: "list-item-child"
1603
+ };
1604
+ const InlineType = {
1605
+ Code: "code",
1606
+ SuperScript: "superscript",
1607
+ SubScript: "subscript",
1608
+ Link: "link"
1609
+ };
1610
+ function toTextDAO(node) {
1611
+ var _a, _b, _c, _d;
1612
+ const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === TextType.Typography);
1613
+ if (typographyMark) {
1614
+ return [
1615
+ {
1616
+ text: (_b = node.text) != null ? _b : "",
1617
+ type: TextType.Typography,
1618
+ typography: (_c = typographyMark.data) == null ? void 0 : _c.value
1619
+ }
1620
+ ];
1621
+ }
1622
+ return [
1623
+ {
1624
+ type: TextType.Text,
1625
+ text: (_d = node.text) != null ? _d : ""
1626
+ }
1627
+ ];
1628
+ }
1629
+ function toInlineDAO(node) {
1630
+ var _a, _b, _c, _d;
1631
+ switch (node.type) {
1632
+ case InlineType.Link:
1633
+ return [
1634
+ {
1635
+ children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
1636
+ [node.type]: node.data,
1637
+ type: node.type
1638
+ }
1639
+ ];
1640
+ case InlineType.Code:
1641
+ case InlineType.SubScript:
1642
+ case InlineType.SuperScript:
1643
+ return [
1644
+ {
1645
+ children: (_d = (_c = node.nodes) == null ? void 0 : _c.flatMap(toInlineOrTextDAO)) != null ? _d : [],
1646
+ type: node.type
1647
+ }
1648
+ ];
1649
+ default:
1650
+ return [];
1651
+ }
1652
+ }
1653
+ function toInlineOrTextDAO(node) {
1654
+ switch (node.object) {
1655
+ case ObjectType.Inline:
1656
+ return toInlineDAO(node);
1657
+ case ObjectType.Text:
1658
+ return toTextDAO(node);
1659
+ default:
1660
+ return [];
1661
+ }
1662
+ }
1663
+ function toNodeDAO(node) {
1664
+ var _a, _b;
1665
+ switch (node.object) {
1666
+ case ObjectType.Inline:
1667
+ case ObjectType.Text:
1668
+ return toInlineOrTextDAO(node);
1669
+ case ObjectType.Block:
1670
+ return [
1671
+ {
1672
+ type: node.type,
1673
+ textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
1674
+ children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toNodeDAO)) != null ? _b : []
1675
+ }
1676
+ ];
1677
+ default:
1678
+ return [];
1679
+ }
1680
+ }
1681
+ function richTextDTOtoSelection(data) {
1682
+ var _a, _b, _c, _d;
1683
+ if (((_b = (_a = data.selection) == null ? void 0 : _a.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
1684
+ return {
1685
+ anchor: {
1686
+ offset: data.selection.anchor.offset,
1687
+ path: data.selection.anchor.path
1688
+ },
1689
+ focus: {
1690
+ offset: data.selection.focus.offset,
1691
+ path: data.selection.focus.path
1692
+ }
1693
+ };
1694
+ return null;
1695
+ }
1696
+ function richTextDTOtoDAO(data) {
1697
+ var _a, _b, _c;
1698
+ return (_c = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
1699
+ }
1700
+ function toInlineOrTextDTO(node) {
1701
+ switch (node.type) {
1702
+ case TextType.Typography:
1703
+ return [
1704
+ {
1705
+ object: "text",
1706
+ text: node.text,
1707
+ marks: [
1708
+ {
1709
+ data: {
1710
+ value: node.typography
1711
+ },
1712
+ type: "typography",
1713
+ object: "mark"
1714
+ }
1715
+ ]
1716
+ }
1717
+ ];
1718
+ case TextType.Text:
1719
+ return [
1720
+ {
1721
+ text: node.text,
1722
+ object: "text",
1723
+ marks: []
1724
+ }
1725
+ ];
1726
+ case InlineType.Link:
1727
+ return [
1728
+ {
1729
+ object: ObjectType.Inline,
1730
+ nodes: node.children.flatMap(toInlineOrTextDTO),
1731
+ type: node.type,
1732
+ data: node.link
1733
+ }
1734
+ ];
1735
+ case InlineType.Code:
1736
+ case InlineType.SubScript:
1737
+ case InlineType.SuperScript:
1738
+ return [
1739
+ {
1740
+ object: "inline",
1741
+ nodes: node.children.flatMap(toInlineOrTextDTO),
1742
+ type: node.type,
1743
+ data: {}
1744
+ }
1745
+ ];
1746
+ }
1747
+ }
1748
+ function toNodeDTO(node) {
1749
+ var _a, _b;
1750
+ switch (node.type) {
1751
+ case TextType.Typography:
1752
+ case TextType.Text:
1753
+ case InlineType.Link:
1754
+ case InlineType.Code:
1755
+ case InlineType.SubScript:
1756
+ case InlineType.SuperScript:
1757
+ return toInlineOrTextDTO(node);
1758
+ case BlockType.Heading1:
1759
+ case BlockType.Heading2:
1760
+ case BlockType.Heading3:
1761
+ case BlockType.BlockQuote:
1762
+ case BlockType.Paragraph:
1763
+ case BlockType.OrderedList:
1764
+ case BlockType.UnorderedList:
1765
+ case BlockType.ListItem:
1766
+ case BlockType.ListItemChild:
1767
+ return [
1768
+ {
1769
+ type: node.type,
1770
+ data: node.textAlign ? {
1771
+ textAlign: node.textAlign
1772
+ } : {},
1773
+ object: "block",
1774
+ nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
1775
+ }
1776
+ ];
1777
+ default:
1778
+ return [];
1779
+ }
1780
+ }
1781
+ function toSelectionDTO(selection) {
1782
+ if (selection == null)
1783
+ return void 0;
1784
+ return {
1785
+ isFocused: false,
1786
+ marks: void 0,
1787
+ object: "selection",
1788
+ anchor: {
1789
+ offset: selection.anchor.offset,
1790
+ path: selection.anchor.path,
1791
+ object: "point"
1792
+ },
1793
+ focus: {
1794
+ offset: selection.focus.offset,
1795
+ path: selection.focus.path,
1796
+ object: "point"
1797
+ }
1798
+ };
1799
+ }
1800
+ function richTextDAOToDTO(children, selection) {
1801
+ return {
1802
+ document: {
1803
+ data: void 0,
1804
+ nodes: children.flatMap(toNodeDTO),
1805
+ object: "document"
1806
+ },
1807
+ object: "value",
1808
+ selection: toSelectionDTO(selection),
1809
+ annotations: void 0,
1810
+ data: void 0
1811
+ };
1812
+ }
959
1813
  const RichTextControlType = "makeswift::controls::rich-text";
960
1814
  function RichText() {
961
1815
  return { type: RichTextControlType };
@@ -976,18 +1830,24 @@ class RichTextControl extends PropController {
976
1830
  __publicField(this, "editor", null);
977
1831
  }
978
1832
  recv(message) {
979
- var _a, _b;
1833
+ if (!this.editor)
1834
+ return;
980
1835
  switch (message.type) {
981
1836
  case RichTextControlMessageType.CHANGE_BUILDER_EDIT_MODE: {
982
1837
  switch (message.editMode) {
983
1838
  case BuilderEditMode.BUILD:
984
- (_a = this.editor) == null ? void 0 : _a.deselect().blur();
985
- break;
1839
+ case BuilderEditMode.INTERACT:
1840
+ slateReact.ReactEditor.deselect(this.editor);
1841
+ slateReact.ReactEditor.blur(this.editor);
986
1842
  }
987
1843
  break;
988
1844
  }
989
1845
  case RichTextControlMessageType.FOCUS: {
990
- (_b = this.editor) == null ? void 0 : _b.focus().moveToRangeOfDocument();
1846
+ slateReact.ReactEditor.focus(this.editor);
1847
+ slate.Transforms.select(this.editor, {
1848
+ anchor: slate.Editor.start(this.editor, []),
1849
+ focus: slate.Editor.end(this.editor, [])
1850
+ });
991
1851
  break;
992
1852
  }
993
1853
  }
@@ -996,14 +1856,18 @@ class RichTextControl extends PropController {
996
1856
  this.editor = editor;
997
1857
  this.send({
998
1858
  type: RichTextControlMessageType.INITIALIZE_EDITOR,
999
- value: editor.value.toJSON({ preserveSelection: false })
1000
- });
1001
- }
1002
- onChange(change) {
1003
- this.send({
1004
- type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
1005
- value: change.value.toJSON({ preserveSelection: true })
1859
+ value: richTextDAOToDTO(editor.children, editor.selection)
1006
1860
  });
1861
+ const _onChange = editor.onChange;
1862
+ this.editor.onChange = (options) => {
1863
+ _onChange(options);
1864
+ if ((options == null ? void 0 : options.operation) != null) {
1865
+ this.send({
1866
+ type: RichTextControlMessageType.CHANGE_EDITOR_VALUE,
1867
+ value: richTextDAOToDTO(editor.children, editor.selection)
1868
+ });
1869
+ }
1870
+ };
1007
1871
  }
1008
1872
  focus() {
1009
1873
  this.send({ type: RichTextControlMessageType.FOCUS });
@@ -1022,6 +1886,7 @@ class RichTextControl extends PropController {
1022
1886
  }
1023
1887
  }
1024
1888
  exports.Backgrounds = Backgrounds;
1889
+ exports.BlockType = BlockType;
1025
1890
  exports.Border = Border;
1026
1891
  exports.BorderPropControllerFormat = BorderPropControllerFormat;
1027
1892
  exports.BorderRadius = BorderRadius;
@@ -1041,6 +1906,7 @@ exports.Image$1 = Image;
1041
1906
  exports.ImageControlType = ImageControlType;
1042
1907
  exports.ImageControlValueFormat = ImageControlValueFormat;
1043
1908
  exports.Images = Images;
1909
+ exports.InlineType = InlineType;
1044
1910
  exports.Link = Link$1;
1045
1911
  exports.Link$1 = Link;
1046
1912
  exports.LinkControlType = LinkControlType;
@@ -1052,6 +1918,7 @@ exports.Margin = Margin;
1052
1918
  exports.MarginPropControllerFormat = MarginPropControllerFormat;
1053
1919
  exports.NavigationLinks = NavigationLinks;
1054
1920
  exports.Number = Number;
1921
+ exports.ObjectType = ObjectType;
1055
1922
  exports.Padding = Padding;
1056
1923
  exports.PaddingPropControllerFormat = PaddingPropControllerFormat;
1057
1924
  exports.ResponsiveColor = ResponsiveColor;
@@ -1086,6 +1953,7 @@ exports.TableFormFieldsMessageType = TableFormFieldsMessageType;
1086
1953
  exports.TextArea = TextArea;
1087
1954
  exports.TextInput = TextInput;
1088
1955
  exports.TextStyle = TextStyle;
1956
+ exports.TextType = TextType;
1089
1957
  exports.Types = Types;
1090
1958
  exports.Video = Video;
1091
1959
  exports.Width = Width;
@@ -1102,4 +1970,8 @@ exports.copyStyleData = copyStyleData;
1102
1970
  exports.createPropController = createPropController;
1103
1971
  exports.descriptors = descriptors;
1104
1972
  exports.reducer = reducer;
1973
+ exports.richTextDAOToDTO = richTextDAOToDTO;
1974
+ exports.richTextDTOtoDAO = richTextDTOtoDAO;
1975
+ exports.richTextDTOtoSelection = richTextDTOtoSelection;
1976
+ exports.toSelectionDTO = toSelectionDTO;
1105
1977
  //# sourceMappingURL=rich-text.cjs.js.map