@makeswift/runtime 0.0.21 → 0.1.0

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 (196) hide show
  1. package/dist/Box.cjs.js +502 -0
  2. package/dist/Box.cjs.js.map +1 -0
  3. package/dist/Box.es.js +496 -0
  4. package/dist/Box.es.js.map +1 -0
  5. package/dist/Button.cjs.js +308 -0
  6. package/dist/Button.cjs.js.map +1 -0
  7. package/dist/Button.es.js +301 -0
  8. package/dist/Button.es.js.map +1 -0
  9. package/dist/Carousel.cjs.js +487 -0
  10. package/dist/Carousel.cjs.js.map +1 -0
  11. package/dist/Carousel.es.js +481 -0
  12. package/dist/Carousel.es.js.map +1 -0
  13. package/dist/Countdown.cjs.js +340 -0
  14. package/dist/Countdown.cjs.js.map +1 -0
  15. package/dist/Countdown.es.js +334 -0
  16. package/dist/Countdown.es.js.map +1 -0
  17. package/dist/Divider.cjs.js +115 -0
  18. package/dist/Divider.cjs.js.map +1 -0
  19. package/dist/Divider.es.js +109 -0
  20. package/dist/Divider.es.js.map +1 -0
  21. package/dist/Embed.cjs.js +129 -0
  22. package/dist/Embed.cjs.js.map +1 -0
  23. package/dist/Embed.es.js +123 -0
  24. package/dist/Embed.es.js.map +1 -0
  25. package/dist/Form.cjs.js +1705 -0
  26. package/dist/Form.cjs.js.map +1 -0
  27. package/dist/Form.es.js +1677 -0
  28. package/dist/Form.es.js.map +1 -0
  29. package/dist/Image.cjs2.js +148 -0
  30. package/dist/Image.cjs2.js.map +1 -0
  31. package/dist/Image.es2.js +141 -0
  32. package/dist/Image.es2.js.map +1 -0
  33. package/dist/Navigation.cjs.js +736 -0
  34. package/dist/Navigation.cjs.js.map +1 -0
  35. package/dist/Navigation.es.js +710 -0
  36. package/dist/Navigation.es.js.map +1 -0
  37. package/dist/Root.cjs.js +143 -0
  38. package/dist/Root.cjs.js.map +1 -0
  39. package/dist/Root.es.js +137 -0
  40. package/dist/Root.es.js.map +1 -0
  41. package/dist/SocialLinks.cjs.js +900 -0
  42. package/dist/SocialLinks.cjs.js.map +1 -0
  43. package/dist/SocialLinks.es.js +874 -0
  44. package/dist/SocialLinks.es.js.map +1 -0
  45. package/dist/Text.cjs.js +475 -0
  46. package/dist/Text.cjs.js.map +1 -0
  47. package/dist/Text.es.js +467 -0
  48. package/dist/Text.es.js.map +1 -0
  49. package/dist/Video.cjs.js +121 -0
  50. package/dist/Video.cjs.js.map +1 -0
  51. package/dist/Video.es.js +114 -0
  52. package/dist/Video.es.js.map +1 -0
  53. package/dist/components.cjs.js +80 -58
  54. package/dist/components.cjs.js.map +1 -1
  55. package/dist/components.es.js +41 -18
  56. package/dist/components.es.js.map +1 -1
  57. package/dist/cssMediaRules.cjs.js +222 -0
  58. package/dist/cssMediaRules.cjs.js.map +1 -0
  59. package/dist/cssMediaRules.es.js +213 -0
  60. package/dist/cssMediaRules.es.js.map +1 -0
  61. package/dist/descriptors.es.js +1 -1
  62. package/dist/index.cjs.js +1411 -7742
  63. package/dist/index.cjs.js.map +1 -1
  64. package/dist/index.cjs2.js +522 -0
  65. package/dist/index.cjs2.js.map +1 -0
  66. package/dist/index.cjs3.js +141 -0
  67. package/dist/index.cjs3.js.map +1 -0
  68. package/dist/index.cjs4.js +18 -0
  69. package/dist/index.cjs4.js.map +1 -0
  70. package/dist/index.es.js +1342 -7698
  71. package/dist/index.es.js.map +1 -1
  72. package/dist/index.es2.js +514 -0
  73. package/dist/index.es2.js.map +1 -0
  74. package/dist/index.es3.js +134 -0
  75. package/dist/index.es3.js.map +1 -0
  76. package/dist/index.es4.js +13 -0
  77. package/dist/index.es4.js.map +1 -0
  78. package/dist/next.cjs.js +19 -201
  79. package/dist/next.cjs.js.map +1 -1
  80. package/dist/next.es.js +12 -192
  81. package/dist/next.es.js.map +1 -1
  82. package/dist/placeholders.cjs.js +13 -0
  83. package/dist/placeholders.cjs.js.map +1 -0
  84. package/dist/placeholders.es.js +12 -0
  85. package/dist/placeholders.es.js.map +1 -0
  86. package/dist/react-builder-preview.cjs.js +23 -33
  87. package/dist/react-builder-preview.cjs.js.map +1 -1
  88. package/dist/react-builder-preview.es.js +13 -23
  89. package/dist/react-builder-preview.es.js.map +1 -1
  90. package/dist/react-page.es.js +1 -1
  91. package/dist/react.cjs.js +16 -28
  92. package/dist/react.cjs.js.map +1 -1
  93. package/dist/react.es.js +8 -20
  94. package/dist/react.es.js.map +1 -1
  95. package/dist/types/components/builtin/Box/Box.d.ts +1 -4
  96. package/dist/types/components/builtin/Box/Box.d.ts.map +1 -1
  97. package/dist/types/components/builtin/Box/animations.d.ts +1 -8
  98. package/dist/types/components/builtin/Box/animations.d.ts.map +1 -1
  99. package/dist/types/components/builtin/Box/constants.d.ts +9 -0
  100. package/dist/types/components/builtin/Box/constants.d.ts.map +1 -0
  101. package/dist/types/components/builtin/Box/index.d.ts +2 -2
  102. package/dist/types/components/builtin/Box/index.d.ts.map +1 -1
  103. package/dist/types/components/builtin/Box/register.d.ts +3 -0
  104. package/dist/types/components/builtin/Box/register.d.ts.map +1 -0
  105. package/dist/types/components/builtin/Button/Button.d.ts +1 -4
  106. package/dist/types/components/builtin/Button/Button.d.ts.map +1 -1
  107. package/dist/types/components/builtin/Button/contants.d.ts +2 -0
  108. package/dist/types/components/builtin/Button/contants.d.ts.map +1 -0
  109. package/dist/types/components/builtin/Button/index.d.ts +1 -1
  110. package/dist/types/components/builtin/Button/index.d.ts.map +1 -1
  111. package/dist/types/components/builtin/Button/register.d.ts +3 -0
  112. package/dist/types/components/builtin/Button/register.d.ts.map +1 -0
  113. package/dist/types/components/builtin/Carousel/Carousel.d.ts +0 -3
  114. package/dist/types/components/builtin/Carousel/Carousel.d.ts.map +1 -1
  115. package/dist/types/components/builtin/Carousel/index.d.ts +1 -1
  116. package/dist/types/components/builtin/Carousel/index.d.ts.map +1 -1
  117. package/dist/types/components/builtin/Carousel/register.d.ts +3 -0
  118. package/dist/types/components/builtin/Carousel/register.d.ts.map +1 -0
  119. package/dist/types/components/builtin/Countdown/Countdown.d.ts +0 -3
  120. package/dist/types/components/builtin/Countdown/Countdown.d.ts.map +1 -1
  121. package/dist/types/components/builtin/Countdown/index.d.ts +1 -1
  122. package/dist/types/components/builtin/Countdown/index.d.ts.map +1 -1
  123. package/dist/types/components/builtin/Countdown/register.d.ts +3 -0
  124. package/dist/types/components/builtin/Countdown/register.d.ts.map +1 -0
  125. package/dist/types/components/builtin/Divider/Divider.d.ts +0 -3
  126. package/dist/types/components/builtin/Divider/Divider.d.ts.map +1 -1
  127. package/dist/types/components/builtin/Divider/index.d.ts +1 -1
  128. package/dist/types/components/builtin/Divider/index.d.ts.map +1 -1
  129. package/dist/types/components/builtin/Divider/register.d.ts +3 -0
  130. package/dist/types/components/builtin/Divider/register.d.ts.map +1 -0
  131. package/dist/types/components/builtin/Embed/Embed.d.ts +0 -3
  132. package/dist/types/components/builtin/Embed/Embed.d.ts.map +1 -1
  133. package/dist/types/components/builtin/Embed/index.d.ts +1 -1
  134. package/dist/types/components/builtin/Embed/index.d.ts.map +1 -1
  135. package/dist/types/components/builtin/Embed/register.d.ts +3 -0
  136. package/dist/types/components/builtin/Embed/register.d.ts.map +1 -0
  137. package/dist/types/components/builtin/Form/Form.d.ts +1 -10
  138. package/dist/types/components/builtin/Form/Form.d.ts.map +1 -1
  139. package/dist/types/components/builtin/Form/context/FormContext.d.ts +6 -0
  140. package/dist/types/components/builtin/Form/context/FormContext.d.ts.map +1 -1
  141. package/dist/types/components/builtin/Form/index.d.ts +1 -1
  142. package/dist/types/components/builtin/Form/index.d.ts.map +1 -1
  143. package/dist/types/components/builtin/Form/register.d.ts +3 -0
  144. package/dist/types/components/builtin/Form/register.d.ts.map +1 -0
  145. package/dist/types/components/builtin/Image/Image.d.ts +0 -3
  146. package/dist/types/components/builtin/Image/Image.d.ts.map +1 -1
  147. package/dist/types/components/builtin/Image/index.d.ts +1 -1
  148. package/dist/types/components/builtin/Image/index.d.ts.map +1 -1
  149. package/dist/types/components/builtin/Image/register.d.ts +3 -0
  150. package/dist/types/components/builtin/Image/register.d.ts.map +1 -0
  151. package/dist/types/components/builtin/Navigation/Navigation.d.ts +0 -3
  152. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  153. package/dist/types/components/builtin/Navigation/index.d.ts +1 -1
  154. package/dist/types/components/builtin/Navigation/index.d.ts.map +1 -1
  155. package/dist/types/components/builtin/Navigation/register.d.ts +3 -0
  156. package/dist/types/components/builtin/Navigation/register.d.ts.map +1 -0
  157. package/dist/types/components/builtin/Root/Root.d.ts +0 -2
  158. package/dist/types/components/builtin/Root/Root.d.ts.map +1 -1
  159. package/dist/types/components/builtin/Root/index.d.ts +1 -1
  160. package/dist/types/components/builtin/Root/index.d.ts.map +1 -1
  161. package/dist/types/components/builtin/Root/register.d.ts +3 -0
  162. package/dist/types/components/builtin/Root/register.d.ts.map +1 -0
  163. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts +0 -3
  164. package/dist/types/components/builtin/SocialLinks/SocialLinks.d.ts.map +1 -1
  165. package/dist/types/components/builtin/SocialLinks/index.d.ts +1 -1
  166. package/dist/types/components/builtin/SocialLinks/index.d.ts.map +1 -1
  167. package/dist/types/components/builtin/SocialLinks/register.d.ts +3 -0
  168. package/dist/types/components/builtin/SocialLinks/register.d.ts.map +1 -0
  169. package/dist/types/components/builtin/Text/Text.d.ts +0 -3
  170. package/dist/types/components/builtin/Text/Text.d.ts.map +1 -1
  171. package/dist/types/components/builtin/Text/index.d.ts +1 -1
  172. package/dist/types/components/builtin/Text/index.d.ts.map +1 -1
  173. package/dist/types/components/builtin/Text/register.d.ts +3 -0
  174. package/dist/types/components/builtin/Text/register.d.ts.map +1 -0
  175. package/dist/types/components/builtin/Video/Video.d.ts +0 -3
  176. package/dist/types/components/builtin/Video/Video.d.ts.map +1 -1
  177. package/dist/types/components/builtin/Video/index.d.ts +1 -1
  178. package/dist/types/components/builtin/Video/index.d.ts.map +1 -1
  179. package/dist/types/components/builtin/Video/register.d.ts +3 -0
  180. package/dist/types/components/builtin/Video/register.d.ts.map +1 -0
  181. package/dist/types/components/builtin/index.d.ts +1 -2
  182. package/dist/types/components/builtin/index.d.ts.map +1 -1
  183. package/dist/types/components/builtin/register.d.ts +3 -0
  184. package/dist/types/components/builtin/register.d.ts.map +1 -0
  185. package/dist/types/next.d.ts +12 -2
  186. package/dist/types/next.d.ts.map +1 -1
  187. package/dist/useBoxShadow.cjs.js +78 -0
  188. package/dist/useBoxShadow.cjs.js.map +1 -0
  189. package/dist/useBoxShadow.es.js +77 -0
  190. package/dist/useBoxShadow.es.js.map +1 -0
  191. package/dist/useMediaQuery.cjs.js +26 -0
  192. package/dist/useMediaQuery.cjs.js.map +1 -0
  193. package/dist/useMediaQuery.es.js +25 -0
  194. package/dist/useMediaQuery.es.js.map +1 -0
  195. package/next/plugin.js +1 -0
  196. package/package.json +4 -1
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ const placeholders = {
3
+ image: {
4
+ src: "data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A",
5
+ dimensions: { width: 360, height: 240 }
6
+ },
7
+ video: {
8
+ src: "data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A",
9
+ dimensions: { width: 712, height: 400 }
10
+ }
11
+ };
12
+ exports.placeholders = placeholders;
13
+ //# sourceMappingURL=placeholders.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholders.cjs.js","sources":["../src/components/utils/placeholders.ts"],"sourcesContent":["export const placeholders = {\n image: {\n src: \"data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A\",\n dimensions: { width: 360, height: 240 },\n },\n video: {\n src: \"data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A\",\n dimensions: { width: 712, height: 400 },\n },\n}\n"],"names":[],"mappings":";AAAO,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,IACL,KAAK;AAAA,IACL,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EACxC;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,IACL,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EACxC;AACF;;"}
@@ -0,0 +1,12 @@
1
+ const placeholders = {
2
+ image: {
3
+ src: "data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A",
4
+ dimensions: { width: 360, height: 240 }
5
+ },
6
+ video: {
7
+ src: "data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A",
8
+ dimensions: { width: 712, height: 400 }
9
+ }
10
+ };
11
+ export { placeholders as p };
12
+ //# sourceMappingURL=placeholders.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholders.es.js","sources":["../src/components/utils/placeholders.ts"],"sourcesContent":["export const placeholders = {\n image: {\n src: \"data:image/svg+xml,%3Csvg width='360' height='240' viewBox='0 0 360 240' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M260 59C260 78.33 244.33 94 225 94C205.67 94 190 78.33 190 59C190 39.67 205.67 24 225 24C244.33 24 260 39.67 260 59Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M319 250H417L291.485 124.485C286.799 119.799 279.201 119.799 274.515 124.485L234 165L319 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3Cpath d='M311 250L-89 250L102.515 58.4853C107.201 53.799 114.799 53.799 119.485 58.4853L311 250Z' fill='%23A1A8C2' fill-opacity='0.25'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath d='M0 0H360V240H0V0Z' fill='white'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E%0A\",\n dimensions: { width: 360, height: 240 },\n },\n video: {\n src: \"data:image/svg+xml,%3Csvg width='712' height='400' viewBox='0 0 712 400' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M712 0H0V400H712V0ZM356 240C378.091 240 396 222.091 396 200C396 177.909 378.091 160 356 160C333.909 160 316 177.909 316 200C316 222.091 333.909 240 356 240Z' fill='%23A1A8C2' fill-opacity='0.18'/%3E%3Cpath d='M344 216.503V183.497C344 181.95 345.681 180.989 347.014 181.773L375.069 198.276C376.384 199.049 376.384 200.951 375.069 201.724L347.014 218.227C345.681 219.011 344 218.05 344 216.503Z' fill='%23A1A8C2' fill-opacity='0.4'/%3E%3C/svg%3E%0A\",\n dimensions: { width: 712, height: 400 },\n },\n}\n"],"names":[],"mappings":"AAAO,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,IACL,KAAK;AAAA,IACL,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EACxC;AAAA,EACA,OAAO;AAAA,IACL,KAAK;AAAA,IACL,YAAY,EAAE,OAAO,KAAK,QAAQ,IAAI;AAAA,EACxC;AACF;;"}
@@ -21,7 +21,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
21
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
22
22
  var redux = require("redux");
23
23
  var thunk = require("redux-thunk");
24
- var index = require("./index.cjs.js");
24
+ var next = require("./index.cjs.js");
25
25
  var immutable = require("immutable");
26
26
  var reactPage = require("./react-page.cjs.js");
27
27
  var actions = require("./actions.cjs.js");
@@ -31,38 +31,28 @@ var constants = require("./constants.cjs.js");
31
31
  var controlSerialization = require("./control-serialization.cjs.js");
32
32
  require("react");
33
33
  require("use-sync-external-store/shim/with-selector");
34
+ require("next/dynamic");
35
+ require("next/document");
34
36
  require("styled-components");
35
- require("framer-motion");
37
+ require("slate");
38
+ require("@emotion/server/create-instance");
36
39
  require("@emotion/css");
37
40
  require("@apollo/client");
38
41
  require("@apollo/client/link/batch-http");
39
- require("slate");
40
42
  require("./graphql.cjs.js");
41
- require("./image.cjs.js");
42
- require("./shape.cjs.js");
43
- require("./style.cjs.js");
44
- require("./descriptors.cjs.js");
45
43
  require("react/jsx-runtime");
44
+ require("./descriptors.cjs.js");
45
+ require("./style.cjs.js");
46
+ require("./text-input.cjs.js");
47
+ require("./color.cjs.js");
48
+ require("./shape.cjs.js");
49
+ require("./image.cjs.js");
50
+ require("color");
51
+ require("react-dom");
46
52
  require("html-react-parser");
47
53
  require("next/head");
48
- require("color");
49
- require("scroll-into-view-if-needed");
50
- require("next/link");
51
- require("react-use-gesture");
52
- require("@popmotion/popcorn");
53
54
  require("uuid/v4");
54
- require("next/image");
55
- require("formik");
56
- require("polished");
57
- require("react-player");
58
- require("slate-hotkeys");
59
55
  require("corporate-ipsum");
60
- require("is-hotkey");
61
- require("slate-react");
62
- require("@convertkit/slate-lists");
63
- require("./text-input.cjs.js");
64
- require("./color.cjs.js");
65
- require("react-dom");
66
56
  require("css-box-model");
67
57
  function _interopDefaultLegacy(e) {
68
58
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
@@ -225,7 +215,7 @@ function measureElements() {
225
215
  const changedDocumentBoxModels = /* @__PURE__ */ new Map();
226
216
  measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {
227
217
  const currentBoxModel = getBoxModel(getState(), documentKey, elementKey);
228
- if (currentBoxModel == null || !index.deepEqual(currentBoxModel, measuredBoxModel)) {
218
+ if (currentBoxModel == null || !next.deepEqual(currentBoxModel, measuredBoxModel)) {
229
219
  changedDocumentBoxModels.set(elementKey, measuredBoxModel);
230
220
  }
231
221
  });
@@ -302,7 +292,7 @@ function startMeasuringDocumentElement() {
302
292
  };
303
293
  function handleAnimationFrameRequest() {
304
294
  const nextSize = getElementSize(window.document.documentElement);
305
- if (!index.deepEqual(lastSize, nextSize)) {
295
+ if (!next.deepEqual(lastSize, nextSize)) {
306
296
  lastSize = nextSize;
307
297
  dispatch(actions.changeDocumentElementSize(nextSize));
308
298
  }
@@ -327,7 +317,7 @@ function initialize() {
327
317
  };
328
318
  }
329
319
  function measureBoxModelsMiddleware() {
330
- return ({ dispatch }) => (next) => {
320
+ return ({ dispatch }) => (next2) => {
331
321
  return (action) => {
332
322
  switch (action.type) {
333
323
  case actions.ActionTypes.REGISTER_COMPONENT_HANDLE: {
@@ -340,12 +330,12 @@ function measureBoxModelsMiddleware() {
340
330
  dispatch(actions.unregisterMeasurable(action.payload.documentKey, action.payload.elementKey));
341
331
  break;
342
332
  }
343
- return next(action);
333
+ return next2(action);
344
334
  };
345
335
  };
346
336
  }
347
337
  function messageChannelMiddleware() {
348
- return ({ dispatch, getState }) => (next) => {
338
+ return ({ dispatch, getState }) => (next2) => {
349
339
  const messageChannel = new MessageChannel();
350
340
  let cleanUp = () => {
351
341
  };
@@ -392,7 +382,7 @@ function messageChannelMiddleware() {
392
382
  cleanUp();
393
383
  break;
394
384
  }
395
- return next(action);
385
+ return next2(action);
396
386
  };
397
387
  };
398
388
  }
@@ -424,7 +414,7 @@ function unregisterAndUnsetPropControllersHandle(documentKey, elementKey) {
424
414
  };
425
415
  }
426
416
  function propControllerHandlesMiddleware() {
427
- return ({ dispatch, getState }) => (next) => {
417
+ return ({ dispatch, getState }) => (next2) => {
428
418
  return (action) => {
429
419
  switch (action.type) {
430
420
  case actions.ActionTypes.REGISTER_COMPONENT_HANDLE: {
@@ -443,12 +433,12 @@ function propControllerHandlesMiddleware() {
443
433
  propController.recv(action.payload.message);
444
434
  }
445
435
  }
446
- return next(action);
436
+ return next2(action);
447
437
  };
448
438
  };
449
439
  }
450
440
  function apolloClientCacheSyncMiddleware(client) {
451
- return () => (next) => {
441
+ return () => (next2) => {
452
442
  return (action) => {
453
443
  switch (action.type) {
454
444
  case actions.ActionTypes.CHANGE_API_RESOURCE: {
@@ -464,7 +454,7 @@ function apolloClientCacheSyncMiddleware(client) {
464
454
  client.cache.evict({ id: action.payload.id });
465
455
  break;
466
456
  }
467
- return next(action);
457
+ return next2(action);
468
458
  };
469
459
  };
470
460
  }
@@ -1 +1 @@
1
- {"version":3,"file":"react-builder-preview.cjs.js","sources":["../src/state/modules/read-write-documents.ts","../src/state/modules/prop-controller-handles.ts","../src/state/react-builder-preview.ts"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\nimport type { DescriptorsPropControllers, PropController } from '../../prop-controllers/instances'\nimport type { Descriptor } from '../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, PropController>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): PropController | null {\n return state.instances.get(documentKey)?.get(elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController, PropController } from '../prop-controllers/instances'\nimport { ApolloClient, NormalizedCacheObject } from '@apollo/client'\nimport { Fragments } from '../api'\nimport { serializeControls } from '../builder'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): () => void {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.addEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = startHandlingFocusEvents()\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n const messageChannel = new MessageChannel()\n let cleanUp = () => {}\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction registerAndSetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllerHandles.PropControllersHandle,\n): ThunkAction<void, State, unknown, Action> {\n return dispatch => {\n dispatch(registerPropControllersHandle(documentKey, elementKey, handle))\n\n const propControllers = dispatch(createAndRegisterPropControllers(documentKey, elementKey))\n\n handle.setPropControllers(propControllers)\n }\n}\n\nfunction unregisterAndUnsetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const element = ReactPage.getElement(\n getState(),\n action.payload.documentKey,\n action.payload.elementKey,\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(action.payload.componentHandle)\n ) {\n dispatch(\n registerAndSetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(\n unregisterAndUnsetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n ),\n )\n break\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction apolloClientCacheSyncMiddleware(\n client: ApolloClient<NormalizedCacheObject>,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE: {\n const { resource } = action.payload\n\n client.cache.writeFragment({\n id: client.cache.identify(resource),\n fragment: Fragments[resource.__typename],\n data: resource,\n })\n\n break\n }\n\n case ActionTypes.EVICT_API_RESOURCE:\n client.cache.evict({ id: action.payload.id })\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n preloadedState,\n client,\n}: {\n preloadedState?: PreloadedState<State>\n client: ApolloClient<NormalizedCacheObject>\n}): Store {\n return createStore(\n reducer,\n preloadedState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(),\n propControllerHandlesMiddleware(),\n apolloClientCacheSyncMiddleware(client),\n ),\n )\n}\n"],"names":["removeIn","setIn","ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ActionTypes","ReadOnlyDocuments.createDocument","combineReducers","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","BoxModels.measure","deepEqual","changeElementBoxModels","handleWheel","changeDocumentElementSize","setIsInBuilder","BoxModels.isMeasurable","registerMeasurable","unregisterMeasurable","serializeControls","registerBuilderComponent","unregisterBuilderComponent","ReactPage.getElementPropControllerDescriptors","createPropController","messageBuilderPropController","registerPropControllers","registerPropControllersHandle","PropControllerHandles.getPropControllersHandle","unregisterPropControllers","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","PropControllerHandles.getPropController","Fragments","createStore","applyMiddleware","thunk"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU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ources":["../src/state/modules/read-write-documents.ts","../src/state/modules/prop-controller-handles.ts","../src/state/react-builder-preview.ts"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\nimport type { DescriptorsPropControllers, PropController } from '../../prop-controllers/instances'\nimport type { Descriptor } from '../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, PropController>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): PropController | null {\n return state.instances.get(documentKey)?.get(elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController, PropController } from '../prop-controllers/instances'\nimport { ApolloClient, NormalizedCacheObject } from '@apollo/client'\nimport { Fragments } from '../api'\nimport { serializeControls } from '../builder'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): () => void {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.addEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = startHandlingFocusEvents()\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n const messageChannel = new MessageChannel()\n let cleanUp = () => {}\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction registerAndSetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllerHandles.PropControllersHandle,\n): ThunkAction<void, State, unknown, Action> {\n return dispatch => {\n dispatch(registerPropControllersHandle(documentKey, elementKey, handle))\n\n const propControllers = dispatch(createAndRegisterPropControllers(documentKey, elementKey))\n\n handle.setPropControllers(propControllers)\n }\n}\n\nfunction unregisterAndUnsetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const element = ReactPage.getElement(\n getState(),\n action.payload.documentKey,\n action.payload.elementKey,\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(action.payload.componentHandle)\n ) {\n dispatch(\n registerAndSetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(\n unregisterAndUnsetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n ),\n )\n break\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction apolloClientCacheSyncMiddleware(\n client: ApolloClient<NormalizedCacheObject>,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE: {\n const { resource } = action.payload\n\n client.cache.writeFragment({\n id: client.cache.identify(resource),\n fragment: Fragments[resource.__typename],\n data: resource,\n })\n\n break\n }\n\n case ActionTypes.EVICT_API_RESOURCE:\n client.cache.evict({ id: action.payload.id })\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n preloadedState,\n client,\n}: {\n preloadedState?: PreloadedState<State>\n client: ApolloClient<NormalizedCacheObject>\n}): Store {\n return createStore(\n reducer,\n preloadedState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(),\n propControllerHandlesMiddleware(),\n apolloClientCacheSyncMiddleware(client),\n ),\n )\n}\n"],"names":["removeIn","setIn","ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ActionTypes","ReadOnlyDocuments.createDocument","combineReducers","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","BoxModels.measure","deepEqual","changeElementBoxModels","handleWheel","changeDocumentElementSize","setIsInBuilder","BoxModels.isMeasurable","registerMeasurable","unregisterMeasurable","serializeControls","registerBuilderComponent","unregisterBuilderComponent","ReactPage.getElementPropControllerDescriptors","createPropController","messageBuilderPropController","registerPropControllers","registerPropControllersHandle","PropControllerHandles.getPropControllersHandle","unregisterPropControllers","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","PropControllerHandles.getPropController","Fragments","createStore","applyMiddleware","thunk"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAM,gBAAUC,UAAM,MAAA,SAAS,UAAU,GAAG,UAAU,EAAE;AAG5E,QAAI,UAAU,MAAM;AAAM,gBAAUA,UAAM,MAAA,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EAAA,CAC7E;AAEM,SAAA;AACT;AAIgC,2BAAA;AAAA,EAC9B;AAAA,IAGE,IAAW;AACb,SAAOC,UAAkB,gBAAgB,EAAE,aAAA,CAAc;AAC3D;AAEA,wCAAwC,OAAuC;AACtE,SAAA;AACT;AAEO,qBAAqB,OAAc,aAAwD;AAChG,SAAOC,UAAkB,cAAY,+BAA+B,KAAK,GAAG,WAAW;AACzF;AAEwB,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MAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEN;AAwCA,yCACE,QACuC;AAChC,SAAA,MAAM,CAAC,UAAgC;AAC5C,WAAO,CAAC,WAA2B;AACjC,cAAQ,OAAO;AAAA,aACRrC,QAAAA,YAAY,qBAAqB;AAC9B,gBAAA,EAAE,aAAa,OAAO;AAE5B,iBAAO,MAAM,cAAc;AAAA,YACzB,IAAI,OAAO,MAAM,SAAS,QAAQ;AAAA,YAClC,UAAUsC,UAAAA,UAAU,SAAS;AAAA,YAC7B,MAAM;AAAA,UAAA,CACP;AAED;AAAA,QACF;AAAA,aAEKtC,QAAY,YAAA;AACf,iBAAO,MAAM,MAAM,EAAE,IAAI,OAAO,QAAQ,IAAI;AAC5C;AAAA;AAGJ,aAAO,MAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEJ;AAI+B,wBAAA;AAAA,EAC7B;AAAA,EACA;AAAA,GAIQ;AACR,SAAOuC,MACL,YAAA,SACA,gBACAC,MAAA,gBACEC,2BACA,2BAA2B,GAC3B,yBAAyB,GACzB,gCAAgC,GAChC,gCAAgC,MAAM,CACxC,CACF;AACF;;;;;;;;"}
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { combineReducers, createStore, applyMiddleware } from "redux";
21
21
  import thunk from "redux-thunk";
22
- import { X as deepEqual } from "./index.es.js";
22
+ import { O as deepEqual } from "./index.es.js";
23
23
  import { removeIn, setIn } from "immutable";
24
24
  import { q as getInitialState$2, r as reducer$3, s as getDocument$1, c as createDocument, t as reducer$4, u as reducer$6, v as reducer$7, w as reducer$8, x as getComponentsMeta$1, y as getComponentPropControllerDescriptors$1, z as getElement, i as isElementReference, A as getElementPropControllerDescriptors } from "./react-page.es.js";
25
25
  import { A as ActionTypes, l as changeElementBoxModels, n as changeDocumentElementSize, o as handleWheel, p as setIsInBuilder, q as registerBuilderComponent, t as unregisterBuilderComponent, v as unregisterMeasurable, w as registerMeasurable, x as unregisterPropControllers, y as registerPropControllersHandle, z as registerPropControllers, B as messageBuilderPropController } from "./actions.es.js";
@@ -30,38 +30,28 @@ import { F as Fragments } from "./constants.es.js";
30
30
  import { a as serializeControls } from "./control-serialization.es.js";
31
31
  import "react";
32
32
  import "use-sync-external-store/shim/with-selector";
33
+ import "next/dynamic";
34
+ import "next/document";
33
35
  import "styled-components";
34
- import "framer-motion";
36
+ import "slate";
37
+ import "@emotion/server/create-instance";
35
38
  import "@emotion/css";
36
39
  import "@apollo/client";
37
40
  import "@apollo/client/link/batch-http";
38
- import "slate";
39
41
  import "./graphql.es.js";
40
- import "./image.es.js";
41
- import "./shape.es.js";
42
- import "./style.es.js";
43
- import "./descriptors.es.js";
44
42
  import "react/jsx-runtime";
43
+ import "./descriptors.es.js";
44
+ import "./style.es.js";
45
+ import "./text-input.es.js";
46
+ import "./color.es.js";
47
+ import "./shape.es.js";
48
+ import "./image.es.js";
49
+ import "color";
50
+ import "react-dom";
45
51
  import "html-react-parser";
46
52
  import "next/head";
47
- import "color";
48
- import "scroll-into-view-if-needed";
49
- import "next/link";
50
- import "react-use-gesture";
51
- import "@popmotion/popcorn";
52
53
  import "uuid/v4";
53
- import "next/image";
54
- import "formik";
55
- import "polished";
56
- import "react-player";
57
- import "slate-hotkeys";
58
54
  import "corporate-ipsum";
59
- import "is-hotkey";
60
- import "slate-react";
61
- import "@convertkit/slate-lists";
62
- import "./text-input.es.js";
63
- import "./color.es.js";
64
- import "react-dom";
65
55
  import "css-box-model";
66
56
  function apply(data, operation) {
67
57
  let applied = data;
@@ -1 +1 @@
1
- {"version":3,"file":"react-builder-preview.es.js","sources":["../src/state/modules/read-write-documents.ts","../src/state/modules/prop-controller-handles.ts","../src/state/react-builder-preview.ts"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\nimport type { DescriptorsPropControllers, PropController } from '../../prop-controllers/instances'\nimport type { Descriptor } from '../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, PropController>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): PropController | null {\n return state.instances.get(documentKey)?.get(elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController, PropController } from '../prop-controllers/instances'\nimport { ApolloClient, NormalizedCacheObject } from '@apollo/client'\nimport { Fragments } from '../api'\nimport { serializeControls } from '../builder'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): () => void {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.addEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = startHandlingFocusEvents()\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n const messageChannel = new MessageChannel()\n let cleanUp = () => {}\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction registerAndSetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllerHandles.PropControllersHandle,\n): ThunkAction<void, State, unknown, Action> {\n return dispatch => {\n dispatch(registerPropControllersHandle(documentKey, elementKey, handle))\n\n const propControllers = dispatch(createAndRegisterPropControllers(documentKey, elementKey))\n\n handle.setPropControllers(propControllers)\n }\n}\n\nfunction unregisterAndUnsetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const element = ReactPage.getElement(\n getState(),\n action.payload.documentKey,\n action.payload.elementKey,\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(action.payload.componentHandle)\n ) {\n dispatch(\n registerAndSetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(\n unregisterAndUnsetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n ),\n )\n break\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction apolloClientCacheSyncMiddleware(\n client: ApolloClient<NormalizedCacheObject>,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE: {\n const { resource } = action.payload\n\n client.cache.writeFragment({\n id: client.cache.identify(resource),\n fragment: Fragments[resource.__typename],\n data: resource,\n })\n\n break\n }\n\n case ActionTypes.EVICT_API_RESOURCE:\n client.cache.evict({ id: action.payload.id })\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n preloadedState,\n client,\n}: {\n preloadedState?: PreloadedState<State>\n client: ApolloClient<NormalizedCacheObject>\n}): Store {\n return createStore(\n reducer,\n preloadedState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(),\n propControllerHandlesMiddleware(),\n apolloClientCacheSyncMiddleware(client),\n ),\n )\n}\n"],"names":["ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ReadOnlyDocuments.createDocument","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","BoxModels.measure","BoxModels.isMeasurable","ReactPage.getElementPropControllerDescriptors","PropControllerHandles.getPropControllersHandle","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","PropControllerHandles.getPropController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAgB,gBAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAM,gBAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAG5E,QAAI,UAAU,MAAM;AAAM,gBAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EAAA,CAC7E;AAEM,SAAA;AACT;AAIgC,2BAAA;AAAA,EAC9B;AAAA,IAGE,IAAW;AACb,SAAOA,kBAAkC,EAAE,aAAA,CAAc;AAC3D;AAEA,wCAAwC,OAAuC;AACtE,SAAA;AACT;AAEO,qBAAqB,OAAc,aAAwD;AAChG,SAAOC,cAA8B,+BAA+B,KAAK,GAAG,WAAW;AACzF;AAEwB,mBAAA,QAAeC,kBAAgB,GAAG,QAAuB;;AAC/E,QAAM,YAAYC,UAA0B,OAAO,MAAM;AAEzD,UAAQ,OAAO;AAAA,SACR,YAAY,iBAAiB;AAChC,YAAM,qBAAqB,kBAAY,WAAW,OAAO,QAAQ,WAAW,MAAjD,mBAAoD;AAE/E,UAAI,sBAAsB;AAAa,eAAA;AAEvC,YAAM,kBAAkB,MAAM,oBAAoB,OAAO,QAAQ,SAAS;AAE1E,aAAO,uBAAuB,kBAC1B,YACA,IAAI,IAAI,SAAS,EAAE,IACjB,OAAO,QAAQ,aACfC,eAAiC,OAAO,QAAQ,aAAa,eAAe,CAC9E;AAAA,IACN;AAAA;AAGS,aAAA;AAAA;AAEb;AC5DO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,QAAQ,YACf,OAAO,QAAQ,eACjB,CACF;AAAA,UACF;AAEA;AAAA,QACF;AAAA,aAEK,YAAY;AACf,mBACE,wCACE,OAAO,QAAQ,aACf,OAAO,QAAQ,UACjB,CACF;AACA;AAAA,aAEG,YAAY,8BAA8B;AAC7C,gBAAM,iBAAiBC,kBACrB,mCAAmC,SAAU,CAAA,GAC7C,OAAO,QAAQ,aACf,OAAO,QAAQ,YACf,OAAO,QAAQ,QACjB;AAEI,cAAA;AAA+B,2BAAA,KAAK,OAAO,QAAQ,OAAO;AAAA,QAChE;AAAA;AAGF,aAAO,KAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEN;AAwCA,yCACE,QACuC;AAChC,SAAA,MAAM,CAAC,SAAgC;AAC5C,WAAO,CAAC,WAA2B;AACjC,cAAQ,OAAO;AAAA,aACR,YAAY,qBAAqB;AAC9B,gBAAA,EAAE,aAAa,OAAO;AAE5B,iBAAO,MAAM,cAAc;AAAA,YACzB,IAAI,OAAO,MAAM,SAAS,QAAQ;AAAA,YAClC,UAAU,UAAU,SAAS;AAAA,YAC7B,MAAM;AAAA,UAAA,CACP;AAED;AAAA,QACF;AAAA,aAEK,YAAY;AACf,iBAAO,MAAM,MAAM,EAAE,IAAI,OAAO,QAAQ,IAAI;AAC5C;AAAA;AAGJ,aAAO,KAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEJ;AAI+B,wBAAA;AAAA,EAC7B;AAAA,EACA;AAAA,GAIQ;AACR,SAAO,YACL,SACA,gBACA,gBACE,OACA,2BAA2B,GAC3B,yBAAyB,GACzB,gCAAgC,GAChC,gCAAgC,MAAM,CACxC,CACF;AACF;;"}
1
+ {"version":3,"file":"react-builder-preview.es.js","sources":["../src/state/modules/read-write-documents.ts","../src/state/modules/prop-controller-handles.ts","../src/state/react-builder-preview.ts"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\nimport type { DescriptorsPropControllers, PropController } from '../../prop-controllers/instances'\nimport type { Descriptor } from '../../prop-controllers/descriptors'\n\nexport interface PropControllersHandle<\n T extends Record<string, Descriptor> = Record<string, Descriptor>,\n> {\n setPropControllers(propControllers: DescriptorsPropControllers<T> | null): void\n}\n\nexport function isPropControllersHandle(value: unknown): value is PropControllersHandle {\n if (\n typeof value === 'object' &&\n value !== null &&\n 'setPropControllers' in value &&\n typeof (value as { setPropControllers: unknown }).setPropControllers === 'function'\n ) {\n return true\n }\n\n return false\n}\n\nexport type State = {\n handles: Map<string, Map<string, PropControllersHandle>>\n instances: Map<string, Map<string, Record<string, PropController>>>\n}\n\nexport function getInitialState(): State {\n return { handles: new Map(), instances: new Map() }\n}\n\nexport function getPropControllersHandle(\n state: State,\n documentKey: string,\n elementKey: string,\n): PropControllersHandle | null {\n return state.handles.get(documentKey)?.get(elementKey) ?? null\n}\n\nexport function getPropController(\n state: State,\n documentKey: string,\n elementKey: string,\n propName: string,\n): PropController | null {\n return state.instances.get(documentKey)?.get(elementKey)?.[propName] ?? null\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey, handle } = action.payload\n\n return {\n ...state,\n handles: new Map(state.handles).set(\n documentKey,\n new Map(state.handles.get(documentKey) ?? []).set(elementKey, handle),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const nextHandles = new Map(state.handles.get(documentKey) ?? [])\n\n const deleted = nextHandles.delete(elementKey)\n\n return deleted\n ? { ...state, handles: new Map(state.handles).set(documentKey, nextHandles) }\n : state\n }\n\n case ActionTypes.REGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey, propControllers } = action.payload\n\n return {\n ...state,\n instances: new Map(state.instances).set(\n documentKey,\n new Map(state.instances.get(documentKey) ?? []).set(elementKey, propControllers),\n ),\n }\n }\n\n case ActionTypes.UNREGISTER_PROP_CONTROLLERS: {\n const { documentKey, elementKey } = action.payload\n const nextInstances = new Map(state.instances.get(documentKey) ?? [])\n\n const deleted = nextInstances.delete(elementKey)\n\n return deleted\n ? { ...state, instances: new Map(state.instances).set(documentKey, nextInstances) }\n : state\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController, PropController } from '../prop-controllers/instances'\nimport { ApolloClient, NormalizedCacheObject } from '@apollo/client'\nimport { Fragments } from '../api'\nimport { serializeControls } from '../builder'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): () => void {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.addEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = startHandlingFocusEvents()\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n const messageChannel = new MessageChannel()\n let cleanUp = () => {}\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction registerAndSetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n handle: PropControllerHandles.PropControllersHandle,\n): ThunkAction<void, State, unknown, Action> {\n return dispatch => {\n dispatch(registerPropControllersHandle(documentKey, elementKey, handle))\n\n const propControllers = dispatch(createAndRegisterPropControllers(documentKey, elementKey))\n\n handle.setPropControllers(propControllers)\n }\n}\n\nfunction unregisterAndUnsetPropControllersHandle(\n documentKey: string,\n elementKey: string,\n): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const element = ReactPage.getElement(\n getState(),\n action.payload.documentKey,\n action.payload.elementKey,\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(action.payload.componentHandle)\n ) {\n dispatch(\n registerAndSetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(\n unregisterAndUnsetPropControllersHandle(\n action.payload.documentKey,\n action.payload.elementKey,\n ),\n )\n break\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const handle = { setPropControllers: fn() }\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(handle.setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction apolloClientCacheSyncMiddleware(\n client: ApolloClient<NormalizedCacheObject>,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_API_RESOURCE: {\n const { resource } = action.payload\n\n client.cache.writeFragment({\n id: client.cache.identify(resource),\n fragment: Fragments[resource.__typename],\n data: resource,\n })\n\n break\n }\n\n case ActionTypes.EVICT_API_RESOURCE:\n client.cache.evict({ id: action.payload.id })\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n preloadedState,\n client,\n}: {\n preloadedState?: PreloadedState<State>\n client: ApolloClient<NormalizedCacheObject>\n}): Store {\n return createStore(\n reducer,\n preloadedState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(),\n propControllerHandlesMiddleware(),\n apolloClientCacheSyncMiddleware(client),\n ),\n )\n}\n"],"names":["ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ReadOnlyDocuments.createDocument","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","BoxModels.measure","BoxModels.isMeasurable","ReactPage.getElementPropControllerDescriptors","PropControllerHandles.getPropControllersHandle","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","PropControllerHandles.getPropController"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAgB,gBAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAM,gBAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAG5E,QAAI,UAAU,MAAM;AAAM,gBAAU,MAAM,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EAAA,CAC7E;AAEM,SAAA;AACT;AAIgC,2BAAA;AAAA,EAC9B;AAAA,IAGE,IAAW;AACb,SAAOA,kBAAkC,EAAE,aAAA,CAAc;AAC3D;AAEA,wCAAwC,OAAuC;AACtE,SAAA;AACT;AAEO,qBAAqB,OAAc,aAAwD;AAChG,SAAOC,cAA8B,+BAA+B,KAAK,GAAG,WAAW;AACzF;AAEwB,mBAAA,QAAeC,kBAAgB,GAAG,QAAuB;;AAC/E,QAAM,YAAYC,UAA0B,OAAO,MAAM;AAEzD,UAAQ,OAAO;AAAA,SACR,YAAY,iBAAiB;AAChC,YAAM,qBAAqB,kBAAY,WAAW,OAAO,QAAQ,WAAW,MAAjD,mBAAoD;AAE/E,UAAI,sBAAsB;AAAa,eAAA;AAEvC,YAAM,kBAAkB,MAAM,oBAAoB,OAAO,QAAQ,SAAS;AAE1E,aAAO,uBAAuB,kBAC1B,YACA,IAAI,IAAI,SAAS,EAAE,IACjB,OAAO,QAAQ,aACfC,eAAiC,OAAO,QAAQ,aAAa,eAAe,CAC9E;AAAA,IACN;AAAA;AAGS,aAAA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O,QAAQ,aACf,OAAO,QAAQ,YACf,OAAO,QAAQ,eACjB,CACF;AAAA,UACF;AAEA;AAAA,QACF;AAAA,aAEK,YAAY;AACf,mBACE,wCACE,OAAO,QAAQ,aACf,OAAO,QAAQ,UACjB,CACF;AACA;AAAA,aAEG,YAAY,8BAA8B;AAC7C,gBAAM,iBAAiBC,kBACrB,mCAAmC,SAAU,CAAA,GAC7C,OAAO,QAAQ,aACf,OAAO,QAAQ,YACf,OAAO,QAAQ,QACjB;AAEI,cAAA;AAA+B,2BAAA,KAAK,OAAO,QAAQ,OAAO;AAAA,QAChE;AAAA;AAGF,aAAO,KAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEN;AAwCA,yCACE,QACuC;AAChC,SAAA,MAAM,CAAC,SAAgC;AAC5C,WAAO,CAAC,WAA2B;AACjC,cAAQ,OAAO;AAAA,aACR,YAAY,qBAAqB;AAC9B,gBAAA,EAAE,aAAa,OAAO;AAE5B,iBAAO,MAAM,cAAc;AAAA,YACzB,IAAI,OAAO,MAAM,SAAS,QAAQ;AAAA,YAClC,UAAU,UAAU,SAAS;AAAA,YAC7B,MAAM;AAAA,UAAA,CACP;AAED;AAAA,QACF;AAAA,aAEK,YAAY;AACf,iBAAO,MAAM,MAAM,EAAE,IAAI,OAAO,QAAQ,IAAI;AAC5C;AAAA;AAGJ,aAAO,KAAK,MAAM;AAAA,IAAA;AAAA,EACpB;AAEJ;AAI+B,wBAAA;AAAA,EAC7B;AAAA,EACA;AAAA,GAIQ;AACR,SAAO,YACL,SACA,gBACA,gBACE,OACA,2BAA2B,GAC3B,yBAAyB,GACzB,gCAAgC,GAChC,gCAAgC,MAAM,CACxC,CACF;AACF;;"}
@@ -502,5 +502,5 @@ function configureStore({
502
502
  } = {}) {
503
503
  return createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), { documents: getInitialState$4({ rootElements }) }), applyMiddleware(thunk));
504
504
  }
505
- export { getElementPropControllerDescriptors as A, getElementSwatchIds as a, getFileIds as b, createDocument as c, getTypographyIds as d, getTableIds as e, getPageIds as f, getPropControllerDescriptors as g, getElementChildren as h, isElementReference as i, createDocumentReference as j, getComponentPropControllerDescriptors as k, getIsInBuilder as l, configureStore as m, getElementId as n, getReactComponent as o, getDocument as p, getInitialState$4 as q, reducer$5 as r, getDocument$1 as s, reducer$4 as t, reducer$3 as u, reducer$2 as v, reducer$1 as w, getComponentsMeta as x, getComponentPropControllerDescriptors$1 as y, getElement as z };
505
+ export { getElementPropControllerDescriptors as A, getElementSwatchIds as a, getFileIds as b, createDocument as c, getTypographyIds as d, getTableIds as e, getPageIds as f, getPropControllerDescriptors as g, getElementChildren as h, isElementReference as i, createDocumentReference as j, getComponentPropControllerDescriptors as k, configureStore as l, getDocument as m, getElementId as n, getIsInBuilder as o, getReactComponent as p, getInitialState$4 as q, reducer$5 as r, getDocument$1 as s, reducer$4 as t, reducer$3 as u, reducer$2 as v, reducer$1 as w, getComponentsMeta as x, getComponentPropControllerDescriptors$1 as y, getElement as z };
506
506
  //# sourceMappingURL=react-page.es.js.map