@builder.io/sdk-react 0.4.5 → 0.5.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 (436) hide show
  1. package/dist/{sdk/blocks → blocks}/BaseText.d.ts +0 -1
  2. package/dist/{sdk/blocks → blocks}/BaseText.js +2 -2
  3. package/dist/{sdk/blocks → blocks}/button/button.d.ts +3 -2
  4. package/dist/{sdk/blocks → blocks}/button/button.js +3 -5
  5. package/dist/blocks/button/component-info.d.ts +2 -0
  6. package/dist/{sdk/blocks → blocks}/button/component-info.js +9 -13
  7. package/dist/blocks/columns/columns.d.ts +16 -0
  8. package/dist/{sdk/blocks → blocks}/columns/columns.js +13 -19
  9. package/dist/blocks/columns/component-info.d.ts +2 -0
  10. package/dist/{sdk/blocks → blocks}/columns/component-info.js +62 -83
  11. package/dist/blocks/custom-code/component-info.d.ts +2 -0
  12. package/dist/{sdk/blocks → blocks}/custom-code/component-info.js +7 -11
  13. package/dist/{sdk/blocks → blocks}/custom-code/custom-code.d.ts +0 -1
  14. package/dist/{sdk/blocks → blocks}/custom-code/custom-code.js +1 -1
  15. package/dist/blocks/embed/component-info.d.ts +2 -0
  16. package/dist/{sdk/blocks → blocks}/embed/component-info.js +8 -15
  17. package/dist/{sdk/blocks → blocks}/embed/embed.d.ts +0 -1
  18. package/dist/{sdk/blocks → blocks}/embed/embed.js +1 -1
  19. package/dist/blocks/embed/helpers.js +2 -0
  20. package/dist/blocks/form/component-info.d.ts +2 -0
  21. package/dist/{sdk/blocks → blocks}/form/component-info.js +94 -129
  22. package/dist/blocks/form/form.d.ts +2 -0
  23. package/dist/blocks/form/form.js +6 -0
  24. package/dist/blocks/fragment/component-info.d.ts +2 -0
  25. package/dist/{sdk/blocks → blocks}/fragment/component-info.js +1 -1
  26. package/dist/{sdk/blocks → blocks}/fragment/fragment.d.ts +0 -1
  27. package/dist/{sdk/blocks → blocks}/fragment/fragment.js +1 -1
  28. package/dist/blocks/helpers.d.ts +13 -0
  29. package/dist/blocks/helpers.js +40 -0
  30. package/dist/blocks/image/component-info.d.ts +2 -0
  31. package/dist/{sdk/blocks → blocks}/image/component-info.js +33 -63
  32. package/dist/{sdk/blocks → blocks}/image/image.d.ts +0 -1
  33. package/dist/{sdk/blocks → blocks}/image/image.helpers.js +2 -11
  34. package/dist/{sdk/blocks → blocks}/image/image.js +7 -7
  35. package/dist/blocks/img/component-info.d.ts +2 -0
  36. package/dist/{sdk/blocks → blocks}/img/component-info.js +4 -6
  37. package/dist/{sdk/blocks → blocks}/img/img.d.ts +3 -2
  38. package/dist/{sdk/blocks → blocks}/img/img.js +1 -1
  39. package/dist/blocks/input/component-info.d.ts +2 -0
  40. package/dist/{sdk/blocks → blocks}/input/component-info.js +15 -40
  41. package/dist/{sdk/blocks → blocks}/input/input.d.ts +3 -2
  42. package/dist/{sdk/blocks → blocks}/input/input.js +1 -1
  43. package/dist/blocks/raw-text/component-info.d.ts +2 -0
  44. package/dist/{sdk/blocks → blocks}/raw-text/component-info.js +3 -5
  45. package/dist/{sdk/blocks → blocks}/raw-text/raw-text.d.ts +0 -1
  46. package/dist/blocks/raw-text/raw-text.js +6 -0
  47. package/dist/blocks/section/component-info.d.ts +2 -0
  48. package/dist/{sdk/blocks → blocks}/section/component-info.js +13 -18
  49. package/dist/{sdk/blocks → blocks}/section/section.d.ts +3 -2
  50. package/dist/{sdk/blocks → blocks}/section/section.js +1 -1
  51. package/dist/blocks/select/component-info.d.ts +2 -0
  52. package/dist/{sdk/blocks → blocks}/select/component-info.js +22 -34
  53. package/dist/{sdk/blocks → blocks}/select/select.d.ts +3 -2
  54. package/dist/{sdk/blocks → blocks}/select/select.js +1 -1
  55. package/dist/blocks/submit-button/component-info.d.ts +2 -0
  56. package/dist/{sdk/blocks → blocks}/submit-button/component-info.js +5 -7
  57. package/dist/{sdk/blocks → blocks}/submit-button/submit-button.d.ts +3 -2
  58. package/dist/{sdk/blocks → blocks}/submit-button/submit-button.js +1 -1
  59. package/dist/blocks/symbol/component-info.d.ts +2 -0
  60. package/dist/{sdk/blocks → blocks}/symbol/component-info.js +12 -17
  61. package/dist/blocks/symbol/symbol.d.ts +23 -0
  62. package/dist/blocks/symbol/symbol.helpers.d.ts +14 -0
  63. package/dist/blocks/symbol/symbol.helpers.js +31 -0
  64. package/dist/blocks/symbol/symbol.js +45 -0
  65. package/dist/blocks/text/component-info.d.ts +2 -0
  66. package/dist/{sdk/blocks → blocks}/text/component-info.js +6 -7
  67. package/dist/{sdk/blocks → blocks}/text/text.d.ts +0 -1
  68. package/dist/{sdk/blocks → blocks}/text/text.js +2 -2
  69. package/dist/blocks/textarea/component-info.d.ts +2 -0
  70. package/dist/{sdk/blocks → blocks}/textarea/component-info.js +13 -19
  71. package/dist/{sdk/blocks → blocks}/textarea/textarea.d.ts +3 -2
  72. package/dist/{sdk/blocks → blocks}/textarea/textarea.js +1 -1
  73. package/dist/blocks/video/component-info.d.ts +2 -0
  74. package/dist/{sdk/blocks → blocks}/video/component-info.js +35 -55
  75. package/dist/{sdk/blocks → blocks}/video/video.d.ts +1 -1
  76. package/dist/{sdk/blocks → blocks}/video/video.js +2 -2
  77. package/dist/{sdk/components → components}/block/block.d.ts +2 -4
  78. package/dist/components/block/block.helpers.d.ts +13 -0
  79. package/dist/{sdk/components → components}/block/block.helpers.js +12 -29
  80. package/dist/components/block/block.js +94 -0
  81. package/dist/{sdk/components → components}/block/components/block-styles.d.ts +0 -1
  82. package/dist/{sdk/components → components}/block/components/block-styles.js +1 -1
  83. package/dist/components/block/components/block-wrapper.d.ts +16 -0
  84. package/dist/components/block/components/block-wrapper.js +36 -0
  85. package/dist/components/block/components/component-ref/component-ref.d.ts +3 -0
  86. package/dist/components/block/components/component-ref/component-ref.helpers.d.ts +28 -0
  87. package/dist/components/block/components/component-ref/component-ref.helpers.js +22 -0
  88. package/dist/components/block/components/component-ref/component-ref.js +23 -0
  89. package/dist/components/block/components/interactive-element.d.ts +11 -0
  90. package/dist/components/block/components/interactive-element.js +20 -0
  91. package/dist/components/block/components/repeated-block.d.ts +9 -0
  92. package/dist/{sdk/components → components}/block/components/repeated-block.js +3 -3
  93. package/dist/{sdk/components → components}/blocks/blocks-wrapper.d.ts +2 -5
  94. package/dist/{sdk/components → components}/blocks/blocks-wrapper.js +3 -3
  95. package/dist/{sdk/components → components}/blocks/blocks.d.ts +2 -4
  96. package/dist/{sdk/components → components}/blocks/blocks.js +2 -2
  97. package/dist/components/content/components/enable-editor.d.ts +9 -0
  98. package/dist/{sdk/components → components}/content/components/enable-editor.js +31 -39
  99. package/dist/{sdk/components/content/components/content-styles.d.ts → components/content/components/styles.d.ts} +1 -2
  100. package/dist/{sdk/components/content/components/content-styles.helpers.d.ts → components/content/components/styles.helpers.d.ts} +1 -1
  101. package/dist/{sdk/components/content/components/content-styles.helpers.js → components/content/components/styles.helpers.js} +3 -4
  102. package/dist/{sdk/components/content/components/content-styles.js → components/content/components/styles.js} +3 -3
  103. package/dist/components/content/content.d.ts +3 -0
  104. package/dist/components/content/content.helpers.d.ts +7 -0
  105. package/dist/components/content/content.helpers.js +30 -0
  106. package/dist/components/content/content.js +79 -0
  107. package/dist/{sdk/components/render-content/render-content.types.d.ts → components/content/content.types.d.ts} +4 -4
  108. package/dist/components/content-variants/content-variants.d.ts +9 -0
  109. package/dist/{sdk/components/render-content-variants/render-content-variants.js → components/content-variants/content-variants.js} +23 -22
  110. package/dist/{sdk/components/render-content-variants/render-content-variants.types.d.ts → components/content-variants/content-variants.types.d.ts} +5 -5
  111. package/dist/{sdk/components/render-content-variants → components/content-variants}/helpers.d.ts +7 -7
  112. package/dist/{sdk/components/render-content-variants → components/content-variants}/helpers.js +13 -22
  113. package/dist/{sdk/components → components}/inlined-script.d.ts +0 -1
  114. package/dist/{sdk/components → components}/inlined-script.js +1 -1
  115. package/dist/{sdk/components → components}/inlined-styles.d.ts +0 -1
  116. package/dist/{sdk/components → components}/inlined-styles.js +1 -1
  117. package/dist/{sdk/constants → constants}/builder-registered-components.js +34 -13
  118. package/dist/{sdk/constants → constants}/device-sizes.js +9 -8
  119. package/dist/constants/sdk-version.d.ts +1 -0
  120. package/dist/constants/sdk-version.js +1 -0
  121. package/dist/{sdk/context → context}/builder.context.js +1 -1
  122. package/dist/{sdk/context → context}/types.d.ts +1 -1
  123. package/dist/functions/acorn_interpreter.d.ts +1 -0
  124. package/dist/functions/acorn_interpreter.js +3027 -0
  125. package/dist/functions/apply-patch-with-mutation.d.ts +10 -0
  126. package/dist/functions/apply-patch-with-mutation.js +54 -0
  127. package/dist/functions/apply-patch-with-mutation.test.js +53 -0
  128. package/dist/functions/evaluate/acorn.d.ts +0 -0
  129. package/dist/functions/evaluate/acorn.js +2432 -0
  130. package/dist/{sdk/functions → functions/evaluate}/evaluate.d.ts +5 -2
  131. package/dist/functions/evaluate/evaluate.js +70 -0
  132. package/dist/functions/evaluate/evaluate.test.js +23 -0
  133. package/dist/functions/evaluate/index.d.ts +1 -0
  134. package/dist/functions/evaluate/index.js +1 -0
  135. package/dist/functions/evaluate/interpreter.d.ts +2 -0
  136. package/dist/functions/evaluate/interpreter.js +3853 -0
  137. package/dist/functions/evaluate/non-node-runtime.d.ts +2 -0
  138. package/dist/functions/evaluate/non-node-runtime.js +84 -0
  139. package/dist/functions/evaluate/types.d.ts +10 -0
  140. package/dist/functions/evaluate.d.ts +23 -0
  141. package/dist/{sdk/functions → functions}/evaluate.js +28 -9
  142. package/dist/{sdk/functions → functions}/evaluate.test.js +11 -5
  143. package/dist/{sdk/functions → functions}/extract-text-styles.js +2 -14
  144. package/dist/{sdk/functions → functions}/get-block-actions-handler.js +3 -3
  145. package/dist/{sdk/functions → functions}/get-block-actions.d.ts +1 -0
  146. package/dist/functions/get-block-actions.js +28 -0
  147. package/dist/{sdk/functions → functions}/get-block-component-options.js +1 -1
  148. package/dist/functions/get-block-properties.d.ts +6 -0
  149. package/dist/{sdk/functions → functions}/get-block-properties.js +15 -9
  150. package/dist/{sdk/functions → functions}/get-builder-search-params/fn.test.js +1 -1
  151. package/dist/{sdk/functions → functions}/get-builder-search-params/index.js +3 -7
  152. package/dist/{sdk/functions → functions}/get-content/generate-content-url.js +7 -5
  153. package/dist/{sdk/functions → functions}/get-content/generate-content-url.test.js +31 -17
  154. package/dist/{sdk/functions → functions}/get-content/index.d.ts +2 -6
  155. package/dist/{sdk/functions → functions}/get-content/index.js +26 -6
  156. package/dist/functions/get-content/processCookies.d.ts +2 -0
  157. package/dist/functions/get-content/processCookies.js +3 -0
  158. package/dist/{sdk/functions → functions}/get-processed-block.d.ts +1 -1
  159. package/dist/{sdk/functions → functions}/get-processed-block.js +11 -7
  160. package/dist/{sdk/functions → functions}/get-processed-block.test.js +8 -6
  161. package/dist/{sdk/functions → functions}/get-react-native-block-styles.d.ts +1 -1
  162. package/dist/{sdk/functions → functions}/get-react-native-block-styles.js +2 -2
  163. package/dist/{sdk/functions → functions}/if-target.d.ts +1 -1
  164. package/dist/{sdk/functions → functions}/if-target.js +1 -1
  165. package/dist/functions/is-editing.js +5 -0
  166. package/dist/functions/is-non-node-server.d.ts +4 -0
  167. package/dist/functions/is-non-node-server.js +8 -0
  168. package/dist/{sdk/functions → functions}/on-change.js +1 -1
  169. package/dist/{sdk/functions → functions}/on-change.test.js +13 -3
  170. package/dist/{sdk/functions → functions}/register-component.d.ts +2 -1
  171. package/dist/functions/register-component.js +38 -0
  172. package/dist/{sdk/functions → functions}/register.js +2 -2
  173. package/dist/{sdk/functions → functions}/sanitize-react-native-block-styles.js +13 -5
  174. package/dist/{sdk/functions → functions}/set-editor-settings.js +1 -1
  175. package/dist/functions/set.js +14 -0
  176. package/dist/{sdk/functions → functions}/set.test.js +9 -3
  177. package/dist/{sdk/functions → functions}/track/helpers.js +6 -11
  178. package/dist/{sdk/functions → functions}/track/index.js +26 -14
  179. package/dist/{sdk/functions → functions}/track/interaction.js +15 -16
  180. package/dist/functions/transform-block-properties.d.ts +1 -0
  181. package/dist/{sdk/functions → functions}/transform-block-properties.js +2 -0
  182. package/dist/{sdk/helpers → helpers}/ab-tests.d.ts +2 -2
  183. package/dist/{sdk/helpers → helpers}/ab-tests.js +42 -30
  184. package/dist/{sdk/helpers → helpers}/canTrack.js +1 -1
  185. package/dist/{sdk/helpers → helpers}/cookie.d.ts +2 -2
  186. package/dist/{sdk/helpers → helpers}/cookie.js +13 -26
  187. package/dist/{sdk/helpers → helpers}/css.d.ts +1 -1
  188. package/dist/{sdk/helpers → helpers}/css.js +1 -1
  189. package/dist/{sdk/helpers → helpers}/flatten.js +8 -8
  190. package/dist/{sdk/helpers → helpers}/localStorage.d.ts +2 -2
  191. package/dist/{sdk/helpers → helpers}/localStorage.js +2 -2
  192. package/dist/{sdk/helpers → helpers}/logger.js +1 -1
  193. package/dist/helpers/preview-lru-cache/get.d.ts +1 -0
  194. package/dist/helpers/preview-lru-cache/get.js +7 -0
  195. package/dist/helpers/preview-lru-cache/helpers.d.ts +1 -0
  196. package/dist/helpers/preview-lru-cache/helpers.js +9 -0
  197. package/dist/helpers/preview-lru-cache/init.d.ts +6 -0
  198. package/dist/helpers/preview-lru-cache/init.js +15 -0
  199. package/dist/helpers/preview-lru-cache/set.d.ts +7 -0
  200. package/dist/helpers/preview-lru-cache/set.js +9 -0
  201. package/dist/helpers/preview-lru-cache/types.d.ts +12 -0
  202. package/dist/helpers/preview-lru-cache/types.js +6 -0
  203. package/dist/{sdk/helpers → helpers}/sessionId.d.ts +2 -2
  204. package/dist/{sdk/helpers → helpers}/sessionId.js +11 -4
  205. package/dist/{sdk/helpers → helpers}/uuid.js +1 -1
  206. package/dist/{sdk/helpers → helpers}/visitorId.d.ts +1 -1
  207. package/dist/{sdk/helpers → helpers}/visitorId.js +7 -4
  208. package/dist/{sdk/index-helpers → index-helpers}/blocks-exports.d.ts +2 -2
  209. package/dist/{sdk/index-helpers → index-helpers}/blocks-exports.js +2 -2
  210. package/dist/{sdk/index.d.ts → index.d.ts} +2 -2
  211. package/dist/{sdk/index.js → index.js} +1 -1
  212. package/dist/scripts/init-editing.js +110 -0
  213. package/dist/types/builder-props.d.ts +9 -0
  214. package/dist/{sdk/types → types}/components.d.ts +8 -2
  215. package/dist/{sdk/types → types}/enforced-partials.d.ts +1 -1
  216. package/dist/types/targets.d.ts +1 -0
  217. package/dist/{sdk/types → types}/typescript.d.ts +3 -0
  218. package/package.json +6 -13
  219. package/dist/sdk/blocks/button/component-info.d.ts +0 -2
  220. package/dist/sdk/blocks/columns/columns.d.ts +0 -16
  221. package/dist/sdk/blocks/columns/component-info.d.ts +0 -2
  222. package/dist/sdk/blocks/custom-code/component-info.d.ts +0 -2
  223. package/dist/sdk/blocks/embed/component-info.d.ts +0 -2
  224. package/dist/sdk/blocks/embed/helpers.js +0 -6
  225. package/dist/sdk/blocks/form/component-info.d.ts +0 -2
  226. package/dist/sdk/blocks/form/form.d.ts +0 -40
  227. package/dist/sdk/blocks/form/form.js +0 -203
  228. package/dist/sdk/blocks/fragment/component-info.d.ts +0 -2
  229. package/dist/sdk/blocks/image/component-info.d.ts +0 -2
  230. package/dist/sdk/blocks/img/component-info.d.ts +0 -2
  231. package/dist/sdk/blocks/input/component-info.d.ts +0 -2
  232. package/dist/sdk/blocks/raw-text/component-info.d.ts +0 -2
  233. package/dist/sdk/blocks/raw-text/raw-text.js +0 -6
  234. package/dist/sdk/blocks/section/component-info.d.ts +0 -2
  235. package/dist/sdk/blocks/select/component-info.d.ts +0 -2
  236. package/dist/sdk/blocks/submit-button/component-info.d.ts +0 -2
  237. package/dist/sdk/blocks/symbol/component-info.d.ts +0 -2
  238. package/dist/sdk/blocks/symbol/symbol.d.ts +0 -21
  239. package/dist/sdk/blocks/symbol/symbol.js +0 -71
  240. package/dist/sdk/blocks/text/component-info.d.ts +0 -2
  241. package/dist/sdk/blocks/textarea/component-info.d.ts +0 -2
  242. package/dist/sdk/blocks/util.d.ts +0 -4
  243. package/dist/sdk/blocks/util.js +0 -13
  244. package/dist/sdk/blocks/video/component-info.d.ts +0 -2
  245. package/dist/sdk/components/block/block.helpers.d.ts +0 -12
  246. package/dist/sdk/components/block/block.js +0 -124
  247. package/dist/sdk/components/block/components/component.d.ts +0 -20
  248. package/dist/sdk/components/block/components/component.js +0 -11
  249. package/dist/sdk/components/block/components/repeated-block.d.ts +0 -11
  250. package/dist/sdk/components/content/components/enable-editor.d.ts +0 -13
  251. package/dist/sdk/components/content/content.d.ts +0 -4
  252. package/dist/sdk/components/content/content.helpers.d.ts +0 -7
  253. package/dist/sdk/components/content/content.helpers.js +0 -30
  254. package/dist/sdk/components/content/content.js +0 -97
  255. package/dist/sdk/components/content/content.types.d.ts +0 -38
  256. package/dist/sdk/components/content-variants/content-variants.d.ts +0 -5
  257. package/dist/sdk/components/content-variants/content-variants.js +0 -37
  258. package/dist/sdk/components/content-variants/helpers.d.ts +0 -17
  259. package/dist/sdk/components/content-variants/helpers.js +0 -184
  260. package/dist/sdk/components/render-block/block-styles.d.ts +0 -9
  261. package/dist/sdk/components/render-block/block-styles.js +0 -66
  262. package/dist/sdk/components/render-block/render-block.d.ts +0 -9
  263. package/dist/sdk/components/render-block/render-block.helpers.d.ts +0 -12
  264. package/dist/sdk/components/render-block/render-block.helpers.js +0 -86
  265. package/dist/sdk/components/render-block/render-block.js +0 -115
  266. package/dist/sdk/components/render-block/render-component.d.ts +0 -17
  267. package/dist/sdk/components/render-block/render-component.js +0 -11
  268. package/dist/sdk/components/render-block/render-repeated-block.d.ts +0 -9
  269. package/dist/sdk/components/render-block/render-repeated-block.js +0 -11
  270. package/dist/sdk/components/render-block/types.d.ts +0 -6
  271. package/dist/sdk/components/render-blocks.d.ts +0 -10
  272. package/dist/sdk/components/render-blocks.js +0 -45
  273. package/dist/sdk/components/render-content/builder-editing.d.ts +0 -3
  274. package/dist/sdk/components/render-content/builder-editing.js +0 -6
  275. package/dist/sdk/components/render-content/components/render-styles.d.ts +0 -9
  276. package/dist/sdk/components/render-content/components/render-styles.helpers.d.ts +0 -15
  277. package/dist/sdk/components/render-content/components/render-styles.helpers.js +0 -59
  278. package/dist/sdk/components/render-content/components/render-styles.js +0 -32
  279. package/dist/sdk/components/render-content/index.d.ts +0 -1
  280. package/dist/sdk/components/render-content/index.js +0 -1
  281. package/dist/sdk/components/render-content/render-content.d.ts +0 -4
  282. package/dist/sdk/components/render-content/render-content.helpers.d.ts +0 -7
  283. package/dist/sdk/components/render-content/render-content.helpers.js +0 -30
  284. package/dist/sdk/components/render-content/render-content.js +0 -343
  285. package/dist/sdk/components/render-content/wrap-component-ref.d.ts +0 -6
  286. package/dist/sdk/components/render-content/wrap-component-ref.js +0 -6
  287. package/dist/sdk/components/render-content-variants/render-content-variants.d.ts +0 -10
  288. package/dist/sdk/components/render-inlined-styles.d.ts +0 -7
  289. package/dist/sdk/components/render-inlined-styles.js +0 -6
  290. package/dist/sdk/constants/sdk-version.d.ts +0 -1
  291. package/dist/sdk/constants/sdk-version.js +0 -1
  292. package/dist/sdk/functions/get-block-actions.js +0 -15
  293. package/dist/sdk/functions/get-block-properties.d.ts +0 -7
  294. package/dist/sdk/functions/get-content/ab-testing.d.ts +0 -5
  295. package/dist/sdk/functions/get-content/ab-testing.js +0 -78
  296. package/dist/sdk/functions/is-editing.js +0 -7
  297. package/dist/sdk/functions/register-component.js +0 -26
  298. package/dist/sdk/functions/set.js +0 -21
  299. package/dist/sdk/functions/transform-block-properties.d.ts +0 -1
  300. package/dist/sdk/scripts/init-editing.js +0 -102
  301. package/dist/sdk/types/builder-props.d.ts +0 -10
  302. package/dist/sdk/types/targets.d.ts +0 -3
  303. package/dist/server/functions/get-builder-search-params/index.d.ts +0 -6
  304. package/dist/server/functions/get-builder-search-params/index.js +0 -36
  305. package/dist/server/functions/get-content/ab-testing.d.ts +0 -5
  306. package/dist/server/functions/get-content/ab-testing.js +0 -78
  307. package/dist/server/functions/get-content/generate-content-url.d.ts +0 -2
  308. package/dist/server/functions/get-content/generate-content-url.js +0 -31
  309. package/dist/server/functions/get-content/generate-content-url.test.d.ts +0 -1
  310. package/dist/server/functions/get-content/generate-content-url.test.js +0 -82
  311. package/dist/server/functions/get-content/index.d.ts +0 -11
  312. package/dist/server/functions/get-content/index.js +0 -40
  313. package/dist/server/functions/get-content/types.d.ts +0 -45
  314. package/dist/server/functions/get-fetch.d.ts +0 -1
  315. package/dist/server/functions/get-fetch.js +0 -11
  316. package/dist/server/functions/get-global-this.d.ts +0 -4
  317. package/dist/server/functions/get-global-this.js +0 -15
  318. package/dist/server/functions/is-browser.d.ts +0 -1
  319. package/dist/server/functions/is-browser.js +0 -3
  320. package/dist/server/helpers/ab-tests.d.ts +0 -8
  321. package/dist/server/helpers/ab-tests.js +0 -5
  322. package/dist/server/helpers/cookie.d.ts +0 -15
  323. package/dist/server/helpers/cookie.js +0 -65
  324. package/dist/server/helpers/flatten.d.ts +0 -6
  325. package/dist/server/helpers/flatten.js +0 -19
  326. package/dist/server/helpers/logger.d.ts +0 -5
  327. package/dist/server/helpers/logger.js +0 -6
  328. package/dist/server/helpers/nullable.d.ts +0 -2
  329. package/dist/server/helpers/nullable.js +0 -1
  330. package/dist/server/helpers/url.d.ts +0 -6
  331. package/dist/server/helpers/url.js +0 -15
  332. package/dist/server/types/api-version.d.ts +0 -2
  333. package/dist/server/types/api-version.js +0 -1
  334. package/dist/server/types/builder-block.d.ts +0 -66
  335. package/dist/server/types/builder-block.js +0 -1
  336. package/dist/server/types/builder-content.d.ts +0 -46
  337. package/dist/server/types/builder-content.js +0 -1
  338. package/dist/server/types/can-track.d.ts +0 -3
  339. package/dist/server/types/can-track.js +0 -1
  340. package/dist/server/types/input.d.ts +0 -121
  341. package/dist/server/types/input.js +0 -1
  342. package/dist/server/types/typescript.d.ts +0 -5
  343. package/dist/server/types/typescript.js +0 -1
  344. /package/dist/{sdk/blocks → blocks}/embed/helpers.d.ts +0 -0
  345. /package/dist/{sdk/blocks → blocks}/image/image.helpers.d.ts +0 -0
  346. /package/dist/{sdk/components → components}/block/types.d.ts +0 -0
  347. /package/dist/{sdk/components → components}/block/types.js +0 -0
  348. /package/dist/{sdk/components/render-block/types.js → components/content/content.types.js} +0 -0
  349. /package/dist/{sdk/components → components}/content/index.d.ts +0 -0
  350. /package/dist/{sdk/components → components}/content/index.js +0 -0
  351. /package/dist/{sdk/components → components}/content/wrap-component-ref.d.ts +0 -0
  352. /package/dist/{sdk/components → components}/content/wrap-component-ref.js +0 -0
  353. /package/dist/{sdk/components/content/content.types.js → components/content-variants/content-variants.types.js} +0 -0
  354. /package/dist/{sdk/constants → constants}/builder-registered-components.d.ts +0 -0
  355. /package/dist/{sdk/constants → constants}/device-sizes.d.ts +0 -0
  356. /package/dist/{sdk/constants → constants}/target.d.ts +0 -0
  357. /package/dist/{sdk/constants → constants}/target.js +0 -0
  358. /package/dist/{sdk/context → context}/builder.context.d.ts +0 -0
  359. /package/dist/{sdk/context → context}/types.js +0 -0
  360. /package/dist/{sdk/components/render-content-variants/render-content-variants.types.js → functions/apply-patch-with-mutation.test.d.ts} +0 -0
  361. /package/dist/{sdk/functions → functions}/camel-to-kebab-case.d.ts +0 -0
  362. /package/dist/{sdk/functions → functions}/camel-to-kebab-case.js +0 -0
  363. /package/dist/{sdk/components/render-content/render-content.types.js → functions/evaluate/evaluate.test.d.ts} +0 -0
  364. /package/dist/{sdk/functions/get-content → functions/evaluate}/types.js +0 -0
  365. /package/dist/{sdk/functions → functions}/evaluate.test.d.ts +0 -0
  366. /package/dist/{sdk/functions → functions}/event-handler-name.d.ts +0 -0
  367. /package/dist/{sdk/functions → functions}/event-handler-name.js +0 -0
  368. /package/dist/{sdk/functions → functions}/extract-text-styles.d.ts +0 -0
  369. /package/dist/{sdk/functions → functions}/fast-clone.d.ts +0 -0
  370. /package/dist/{sdk/functions → functions}/fast-clone.js +0 -0
  371. /package/dist/{sdk/functions → functions}/get-block-actions-handler.d.ts +0 -0
  372. /package/dist/{sdk/functions → functions}/get-block-component-options.d.ts +0 -0
  373. /package/dist/{sdk/functions → functions}/get-builder-search-params/fn.test.d.ts +0 -0
  374. /package/dist/{sdk/functions → functions}/get-builder-search-params/index.d.ts +0 -0
  375. /package/dist/{sdk/functions → functions}/get-content/generate-content-url.d.ts +0 -0
  376. /package/dist/{sdk/functions → functions}/get-content/generate-content-url.test.d.ts +0 -0
  377. /package/dist/{sdk/functions → functions}/get-content/types.d.ts +0 -0
  378. /package/dist/{server/functions → functions}/get-content/types.js +0 -0
  379. /package/dist/{sdk/functions → functions}/get-fetch.d.ts +0 -0
  380. /package/dist/{sdk/functions → functions}/get-fetch.js +0 -0
  381. /package/dist/{sdk/functions → functions}/get-global-this.d.ts +0 -0
  382. /package/dist/{sdk/functions → functions}/get-global-this.js +0 -0
  383. /package/dist/{sdk/functions → functions}/get-processed-block.test.d.ts +0 -0
  384. /package/dist/{sdk/functions → functions}/is-browser.d.ts +0 -0
  385. /package/dist/{sdk/functions → functions}/is-browser.js +0 -0
  386. /package/dist/{sdk/functions → functions}/is-editing.d.ts +0 -0
  387. /package/dist/{sdk/functions → functions}/is-iframe.d.ts +0 -0
  388. /package/dist/{sdk/functions → functions}/is-iframe.js +0 -0
  389. /package/dist/{sdk/functions → functions}/is-previewing.d.ts +0 -0
  390. /package/dist/{sdk/functions → functions}/is-previewing.js +0 -0
  391. /package/dist/{sdk/functions → functions}/on-change.d.ts +0 -0
  392. /package/dist/{sdk/functions → functions}/on-change.test.d.ts +0 -0
  393. /package/dist/{sdk/functions → functions}/register.d.ts +0 -0
  394. /package/dist/{sdk/functions → functions}/sanitize-react-native-block-styles.d.ts +0 -0
  395. /package/dist/{sdk/functions → functions}/set-editor-settings.d.ts +0 -0
  396. /package/dist/{sdk/functions → functions}/set.d.ts +0 -0
  397. /package/dist/{sdk/functions → functions}/set.test.d.ts +0 -0
  398. /package/dist/{sdk/functions → functions}/track/helpers.d.ts +0 -0
  399. /package/dist/{sdk/functions → functions}/track/index.d.ts +0 -0
  400. /package/dist/{sdk/functions → functions}/track/interaction.d.ts +0 -0
  401. /package/dist/{sdk/functions → functions}/transform-block.d.ts +0 -0
  402. /package/dist/{sdk/functions → functions}/transform-block.js +0 -0
  403. /package/dist/{sdk/helpers → helpers}/canTrack.d.ts +0 -0
  404. /package/dist/{sdk/helpers → helpers}/flatten.d.ts +0 -0
  405. /package/dist/{sdk/helpers → helpers}/logger.d.ts +0 -0
  406. /package/dist/{sdk/helpers → helpers}/nullable.d.ts +0 -0
  407. /package/dist/{sdk/helpers → helpers}/nullable.js +0 -0
  408. /package/dist/{sdk/helpers → helpers}/time.d.ts +0 -0
  409. /package/dist/{sdk/helpers → helpers}/time.js +0 -0
  410. /package/dist/{sdk/helpers → helpers}/url.d.ts +0 -0
  411. /package/dist/{sdk/helpers → helpers}/url.js +0 -0
  412. /package/dist/{sdk/helpers → helpers}/url.test.d.ts +0 -0
  413. /package/dist/{sdk/helpers → helpers}/url.test.js +0 -0
  414. /package/dist/{sdk/helpers → helpers}/uuid.d.ts +0 -0
  415. /package/dist/{sdk/index-helpers → index-helpers}/top-of-file.d.ts +0 -0
  416. /package/dist/{sdk/index-helpers → index-helpers}/top-of-file.js +0 -0
  417. /package/dist/{sdk/scripts → scripts}/init-editing.d.ts +0 -0
  418. /package/dist/{sdk/types → types}/api-version.d.ts +0 -0
  419. /package/dist/{sdk/types → types}/api-version.js +0 -0
  420. /package/dist/{sdk/types → types}/builder-block.d.ts +0 -0
  421. /package/dist/{sdk/types → types}/builder-block.js +0 -0
  422. /package/dist/{sdk/types → types}/builder-content.d.ts +0 -0
  423. /package/dist/{sdk/types → types}/builder-content.js +0 -0
  424. /package/dist/{sdk/types → types}/builder-props.js +0 -0
  425. /package/dist/{sdk/types → types}/can-track.d.ts +0 -0
  426. /package/dist/{sdk/types → types}/can-track.js +0 -0
  427. /package/dist/{sdk/types → types}/components.js +0 -0
  428. /package/dist/{sdk/types → types}/deep-partial.d.ts +0 -0
  429. /package/dist/{sdk/types → types}/deep-partial.js +0 -0
  430. /package/dist/{sdk/types → types}/element.d.ts +0 -0
  431. /package/dist/{sdk/types → types}/element.js +0 -0
  432. /package/dist/{sdk/types → types}/enforced-partials.js +0 -0
  433. /package/dist/{sdk/types → types}/input.d.ts +0 -0
  434. /package/dist/{sdk/types → types}/input.js +0 -0
  435. /package/dist/{sdk/types → types}/targets.js +0 -0
  436. /package/dist/{sdk/types → types}/typescript.js +0 -0
@@ -1,66 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import { getMaxWidthQueryForSize, getSizesForBreakpoints, } from "../../constants/device-sizes.js";
4
- import { TARGET } from "../../constants/target.js";
5
- import { getProcessedBlock } from "../../functions/get-processed-block.js";
6
- import { createCssClass } from "../../helpers/css.js";
7
- import { checkIsDefined } from "../../helpers/nullable.js";
8
- import InlinedStyles from "../inlined-styles";
9
- function BlockStyles(props) {
10
- function useBlock() {
11
- return getProcessedBlock({
12
- block: props.block,
13
- localState: props.context.localState,
14
- rootState: props.context.rootState,
15
- rootSetState: props.context.rootSetState,
16
- context: props.context.context,
17
- shouldEvaluateBindings: true,
18
- });
19
- }
20
- function canShowBlock() {
21
- // only render styles for blocks that are visible
22
- if (checkIsDefined(useBlock().hide)) {
23
- return !useBlock().hide;
24
- }
25
- if (checkIsDefined(useBlock().show)) {
26
- return useBlock().show;
27
- }
28
- return true;
29
- }
30
- function css() {
31
- const styles = useBlock().responsiveStyles;
32
- const content = props.context.content;
33
- const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
34
- const largeStyles = styles?.large;
35
- const mediumStyles = styles?.medium;
36
- const smallStyles = styles?.small;
37
- const className = useBlock().id;
38
- if (!className) {
39
- return "";
40
- }
41
- const largeStylesClass = largeStyles
42
- ? createCssClass({
43
- className,
44
- styles: largeStyles,
45
- })
46
- : "";
47
- const mediumStylesClass = mediumStyles
48
- ? createCssClass({
49
- className,
50
- styles: mediumStyles,
51
- mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints),
52
- })
53
- : "";
54
- const smallStylesClass = smallStyles
55
- ? createCssClass({
56
- className,
57
- styles: smallStyles,
58
- mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints),
59
- })
60
- : "";
61
- return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
62
- }
63
- return (React.createElement(React.Fragment, null, TARGET !== "reactNative" && css() && canShowBlock() ? (React.createElement(React.Fragment, null,
64
- React.createElement(InlinedStyles, { styles: css() }))) : null));
65
- }
66
- export default BlockStyles;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- export type RenderBlockProps = {
3
- block: BuilderBlock;
4
- context: BuilderContextInterface;
5
- };
6
- import type { BuilderContextInterface } from "../../context/types.js";
7
- import type { BuilderBlock } from "../../types/builder-block.js";
8
- declare function RenderBlock(props: RenderBlockProps): JSX.Element;
9
- export default RenderBlock;
@@ -1,12 +0,0 @@
1
- import type { BuilderContextInterface } from '../../context/types';
2
- import type { BuilderBlock } from '../../types/builder-block';
3
- import type { RepeatData } from './types';
4
- export declare const isEmptyHtmlElement: (tagName: unknown) => boolean;
5
- export declare const getComponent: ({ block, context, }: {
6
- block: BuilderBlock;
7
- context: BuilderContextInterface;
8
- }) => import("../../context/types").RegisteredComponent;
9
- export declare const getRepeatItemData: ({ block, context, }: {
10
- block: BuilderBlock;
11
- context: BuilderContextInterface;
12
- }) => RepeatData[] | undefined;
@@ -1,86 +0,0 @@
1
- import { evaluate } from '../../functions/evaluate';
2
- import { getProcessedBlock } from '../../functions/get-processed-block';
3
- /**
4
- * https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
5
- */
6
- const EMPTY_HTML_ELEMENTS = [
7
- 'area',
8
- 'base',
9
- 'br',
10
- 'col',
11
- 'embed',
12
- 'hr',
13
- 'img',
14
- 'input',
15
- 'keygen',
16
- 'link',
17
- 'meta',
18
- 'param',
19
- 'source',
20
- 'track',
21
- 'wbr',
22
- ];
23
- export const isEmptyHtmlElement = (tagName) => {
24
- return (typeof tagName === 'string' &&
25
- EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase()));
26
- };
27
- export const getComponent = ({ block, context, }) => {
28
- const componentName = getProcessedBlock({
29
- block,
30
- localState: context.localState,
31
- rootState: context.rootState,
32
- rootSetState: context.rootSetState,
33
- context: context.context,
34
- shouldEvaluateBindings: false,
35
- }).component?.name;
36
- if (!componentName) {
37
- return null;
38
- }
39
- const ref = context.registeredComponents[componentName];
40
- if (!ref) {
41
- // TODO: Public doc page with more info about this message
42
- console.warn(`
43
- Could not find a registered component named "${componentName}".
44
- If you registered it, is the file that registered it imported by the file that needs to render it?`);
45
- return undefined;
46
- }
47
- else {
48
- return ref;
49
- }
50
- };
51
- export const getRepeatItemData = ({ block, context, }) => {
52
- /**
53
- * we don't use `state.useBlock` here because the processing done within its logic includes evaluating the block's bindings,
54
- * which will not work if there is a repeat.
55
- */
56
- const { repeat, ...blockWithoutRepeat } = block;
57
- if (!repeat?.collection) {
58
- return undefined;
59
- }
60
- const itemsArray = evaluate({
61
- code: repeat.collection,
62
- localState: context.localState,
63
- rootState: context.rootState,
64
- rootSetState: context.rootSetState,
65
- context: context.context,
66
- });
67
- if (!Array.isArray(itemsArray)) {
68
- return undefined;
69
- }
70
- const collectionName = repeat.collection.split('.').pop();
71
- const itemNameToUse = repeat.itemName || (collectionName ? collectionName + 'Item' : 'item');
72
- const repeatArray = itemsArray.map((item, index) => ({
73
- context: {
74
- ...context,
75
- localState: {
76
- ...context.localState,
77
- $index: index,
78
- $item: item,
79
- [itemNameToUse]: item,
80
- [`$${itemNameToUse}Index`]: index,
81
- },
82
- },
83
- block: blockWithoutRepeat,
84
- }));
85
- return repeatArray;
86
- };
@@ -1,115 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import { useState } from "react";
4
- import { getBlockActions } from "../../functions/get-block-actions.js";
5
- import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
6
- import { getBlockProperties } from "../../functions/get-block-properties.js";
7
- import { getProcessedBlock } from "../../functions/get-processed-block.js";
8
- import BlockStyles from "./block-styles";
9
- import { getComponent, getRepeatItemData, isEmptyHtmlElement, } from "./render-block.helpers.js";
10
- import RenderRepeatedBlock from "./render-repeated-block";
11
- import { TARGET } from "../../constants/target.js";
12
- import RenderComponent from "./render-component";
13
- import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
14
- function RenderBlock(props) {
15
- const [component, setComponent] = useState(() => getComponent({
16
- block: props.block,
17
- context: props.context,
18
- }));
19
- function repeatItem() {
20
- return getRepeatItemData({
21
- block: props.block,
22
- context: props.context,
23
- });
24
- }
25
- function useBlock() {
26
- return repeatItem()
27
- ? props.block
28
- : getProcessedBlock({
29
- block: props.block,
30
- localState: props.context.localState,
31
- rootState: props.context.rootState,
32
- rootSetState: props.context.rootSetState,
33
- context: props.context.context,
34
- shouldEvaluateBindings: true,
35
- });
36
- }
37
- const [Tag, setTag] = useState(() => props.block.tagName || "div");
38
- function canShowBlock() {
39
- if ("hide" in useBlock()) {
40
- return !useBlock().hide;
41
- }
42
- if ("show" in useBlock()) {
43
- return useBlock().show;
44
- }
45
- return true;
46
- }
47
- function actions() {
48
- return getBlockActions({
49
- block: useBlock(),
50
- rootState: props.context.rootState,
51
- rootSetState: props.context.rootSetState,
52
- localState: props.context.localState,
53
- context: props.context.context,
54
- });
55
- }
56
- function attributes() {
57
- const blockProperties = getBlockProperties(useBlock());
58
- return {
59
- ...blockProperties,
60
- ...(TARGET === "reactNative"
61
- ? {
62
- style: getReactNativeBlockStyles({
63
- block: useBlock(),
64
- context: props.context,
65
- blockStyles: blockProperties.style,
66
- }),
67
- }
68
- : {}),
69
- };
70
- }
71
- function childrenWithoutParentComponent() {
72
- /**
73
- * When there is no `componentRef`, there might still be children that need to be rendered. In this case,
74
- * we render them outside of `componentRef`.
75
- * NOTE: We make sure not to render this if `repeatItemData` is non-null, because that means we are rendering an array of
76
- * blocks, and the children will be repeated within those blocks.
77
- */
78
- const shouldRenderChildrenOutsideRef = !component?.component && !repeatItem();
79
- return shouldRenderChildrenOutsideRef ? useBlock().children ?? [] : [];
80
- }
81
- function renderComponentProps() {
82
- return {
83
- blockChildren: useBlock().children ?? [],
84
- componentRef: component?.component,
85
- componentOptions: {
86
- ...getBlockComponentOptions(useBlock()),
87
- /**
88
- * These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
89
- * they are provided to the component itself directly.
90
- */
91
- ...(!component?.noWrap
92
- ? {}
93
- : {
94
- attributes: {
95
- ...attributes(),
96
- ...actions(),
97
- },
98
- }),
99
- },
100
- context: childrenContext,
101
- };
102
- }
103
- const [childrenContext, setChildrenContext] = useState(() => props.context);
104
- return (React.createElement(React.Fragment, null, canShowBlock() ? (React.createElement(React.Fragment, null, !component?.noWrap ? (React.createElement(React.Fragment, null,
105
- isEmptyHtmlElement(Tag) ? (React.createElement(React.Fragment, null,
106
- React.createElement(Tag, { ...attributes(), ...actions() }))) : null,
107
- !isEmptyHtmlElement(Tag) && repeatItem() ? (React.createElement(React.Fragment, null, repeatItem()?.map((data, index) => (React.createElement(RenderRepeatedBlock, { key: index, repeatContext: data.context, block: data.block }))))) : null,
108
- !isEmptyHtmlElement(Tag) && !repeatItem() ? (React.createElement(React.Fragment, null,
109
- React.createElement(Tag, { ...attributes(), ...actions() },
110
- React.createElement(RenderComponent, { ...renderComponentProps() }),
111
- childrenWithoutParentComponent()?.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: childrenContext }))),
112
- childrenWithoutParentComponent()?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: childrenContext })))))) : null)) : (React.createElement(React.Fragment, null,
113
- React.createElement(RenderComponent, { ...renderComponentProps() }))))) : null));
114
- }
115
- export default RenderBlock;
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- type ComponentOptions = {
3
- [index: string]: any;
4
- attributes?: {
5
- [index: string]: any;
6
- };
7
- };
8
- export interface RenderComponentProps {
9
- componentRef: any;
10
- componentOptions: ComponentOptions;
11
- blockChildren: BuilderBlock[];
12
- context: BuilderContextInterface;
13
- }
14
- import type { BuilderBlock } from "../../types/builder-block.js";
15
- import type { BuilderContextInterface } from "../../context/types.js";
16
- declare function RenderComponent(props: RenderComponentProps): JSX.Element;
17
- export default RenderComponent;
@@ -1,11 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import BlockStyles from "./block-styles";
4
- import RenderBlock from "./render-block";
5
- function RenderComponent(props) {
6
- return (React.createElement(React.Fragment, null, props.componentRef ? (React.createElement(React.Fragment, null,
7
- React.createElement(props.componentRef, { ...props.componentOptions },
8
- props.blockChildren?.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: props.context }))),
9
- props.blockChildren?.map((child) => (React.createElement(BlockStyles, { key: "block-style-" + child.id, block: child, context: props.context })))))) : null));
10
- }
11
- export default RenderComponent;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- type Props = {
3
- block: BuilderBlock;
4
- repeatContext: BuilderContextInterface;
5
- };
6
- import type { BuilderContextInterface } from "../../context/types.js";
7
- import type { BuilderBlock } from "../../types/builder-block";
8
- declare function RenderRepeatedBlock(props: Props): JSX.Element;
9
- export default RenderRepeatedBlock;
@@ -1,11 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import { useState } from "react";
4
- import BuilderContext from "../../context/builder.context.js";
5
- import RenderBlock from "./render-block";
6
- function RenderRepeatedBlock(props) {
7
- const [store, setStore] = useState(() => props.repeatContext);
8
- return (React.createElement(BuilderContext.Provider, { value: store },
9
- React.createElement(RenderBlock, { block: props.block, context: store })));
10
- }
11
- export default RenderRepeatedBlock;
@@ -1,6 +0,0 @@
1
- import type { BuilderContextInterface } from '../../context/types.js';
2
- import type { BuilderBlock } from '../../types/builder-block.js';
3
- export interface RepeatData {
4
- block: BuilderBlock;
5
- context: BuilderContextInterface;
6
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- export type RenderBlockProps = {
3
- blocks?: BuilderBlock[];
4
- parent?: string;
5
- path?: string;
6
- styleProp?: Record<string, any>;
7
- };
8
- import type { BuilderBlock } from "../types/builder-block.js";
9
- declare function RenderBlocks(props: RenderBlockProps): JSX.Element;
10
- export default RenderBlocks;
@@ -1,45 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import { useContext } from "react";
4
- import BuilderContext from "../context/builder.context.js";
5
- import { isEditing } from "../functions/is-editing.js";
6
- import BlockStyles from "./render-block/block-styles";
7
- import RenderBlock from "./render-block/render-block";
8
- function RenderBlocks(props) {
9
- function className() {
10
- return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
11
- }
12
- function onClick() {
13
- if (isEditing() && !props.blocks?.length) {
14
- window.parent?.postMessage({
15
- type: "builder.clickEmptyBlocks",
16
- data: {
17
- parentElementId: props.parent,
18
- dataPath: props.path,
19
- },
20
- }, "*");
21
- }
22
- }
23
- function onMouseEnter() {
24
- if (isEditing() && !props.blocks?.length) {
25
- window.parent?.postMessage({
26
- type: "builder.hoverEmptyBlocks",
27
- data: {
28
- parentElementId: props.parent,
29
- dataPath: props.path,
30
- },
31
- }, "*");
32
- }
33
- }
34
- const builderContext = useContext(BuilderContext);
35
- return (React.createElement(React.Fragment, null,
36
- React.createElement("div", { className: className() + " div-6dd9939e", "builder-path": props.path, "builder-parent-id": props.parent, style: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter(), onKeyPress: (event) => onClick() },
37
- props.blocks ? (React.createElement(React.Fragment, null, props.blocks?.map((block) => (React.createElement(RenderBlock, { key: "render-block-" + block.id, block: block, context: builderContext }))))) : null,
38
- props.blocks ? (React.createElement(React.Fragment, null, props.blocks?.map((block) => (React.createElement(BlockStyles, { key: "block-style-" + block.id, block: block, context: builderContext }))))) : null),
39
- React.createElement("style", null, `.div-6dd9939e {
40
- display: flex;
41
- flex-direction: column;
42
- align-items: stretch;
43
- }`)));
44
- }
45
- export default RenderBlocks;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare function BuilderEditing(props: any): JSX.Element;
3
- export default BuilderEditing;
@@ -1,6 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- function BuilderEditing(props) {
4
- return React.createElement("div", null);
5
- }
6
- export default BuilderEditing;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- interface Props {
3
- cssCode?: string;
4
- customFonts?: CustomFont[];
5
- contentId?: string;
6
- }
7
- import type { CustomFont } from "./render-styles.helpers";
8
- declare function RenderContentStyles(props: Props): JSX.Element;
9
- export default RenderContentStyles;
@@ -1,15 +0,0 @@
1
- export interface CustomFont {
2
- family?: string;
3
- kind?: string;
4
- fileUrl?: string;
5
- files?: {
6
- [key: string]: string;
7
- };
8
- }
9
- export declare const getFontCss: ({ customFonts }: {
10
- customFonts?: CustomFont[];
11
- }) => string;
12
- export declare const getCss: ({ cssCode, contentId, }: {
13
- cssCode?: string;
14
- contentId?: string;
15
- }) => string;
@@ -1,59 +0,0 @@
1
- const getCssFromFont = (font) => {
2
- // TODO: compute what font sizes are used and only load those.......
3
- const family = font.family +
4
- (font.kind && !font.kind.includes('#') ? ', ' + font.kind : '');
5
- const name = family.split(',')[0];
6
- const url = font.fileUrl ?? font?.files?.regular;
7
- let str = '';
8
- if (url && family && name) {
9
- str += `
10
- @font-face {
11
- font-family: "${family}";
12
- src: local("${name}"), url('${url}') format('woff2');
13
- font-display: fallback;
14
- font-weight: 400;
15
- }
16
- `.trim();
17
- }
18
- if (font.files) {
19
- for (const weight in font.files) {
20
- const isNumber = String(Number(weight)) === weight;
21
- if (!isNumber) {
22
- continue;
23
- }
24
- // TODO: maybe limit number loaded
25
- const weightUrl = font.files[weight];
26
- if (weightUrl && weightUrl !== url) {
27
- str += `
28
- @font-face {
29
- font-family: "${family}";
30
- src: url('${weightUrl}') format('woff2');
31
- font-display: fallback;
32
- font-weight: ${weight};
33
- }
34
- `.trim();
35
- }
36
- }
37
- }
38
- return str;
39
- };
40
- export const getFontCss = ({ customFonts }) => {
41
- // TODO: flag for this
42
- // if (!this.builder.allowCustomFonts) {
43
- // return '';
44
- // }
45
- // TODO: separate internal data from external
46
- return customFonts?.map((font) => getCssFromFont(font))?.join(' ') || '';
47
- };
48
- export const getCss = ({ cssCode, contentId, }) => {
49
- if (!cssCode) {
50
- return '';
51
- }
52
- if (!contentId) {
53
- return cssCode;
54
- }
55
- // Allow using `&` in custom CSS code like @emotion
56
- // E.g. `& .foobar { ... }` to scope CSS
57
- // TODO: handle if '&' is within a string like `content: "&"`
58
- return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || '';
59
- };
@@ -1,32 +0,0 @@
1
- 'use client';
2
- import * as React from "react";
3
- import { useState } from "react";
4
- import InlinedStyles from "../../inlined-styles";
5
- import { getCss } from "./render-styles.helpers";
6
- import { getFontCss } from "./render-styles.helpers";
7
- function RenderContentStyles(props) {
8
- const [injectedStyles, setInjectedStyles] = useState(() => `
9
- ${getCss({
10
- cssCode: props.cssCode,
11
- contentId: props.contentId,
12
- })}
13
- ${getFontCss({
14
- customFonts: props.customFonts,
15
- })}
16
-
17
- .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
18
- margin: 0;
19
- }
20
- .builder-text > p, .builder-text > .builder-paragraph {
21
- color: inherit;
22
- line-height: inherit;
23
- letter-spacing: inherit;
24
- font-weight: inherit;
25
- font-size: inherit;
26
- text-align: inherit;
27
- font-family: inherit;
28
- }
29
- `.trim());
30
- return React.createElement(InlinedStyles, { styles: injectedStyles });
31
- }
32
- export default RenderContentStyles;
@@ -1 +0,0 @@
1
- export { default } from './render-content';
@@ -1 +0,0 @@
1
- export { default } from './render-content';
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import type { RenderContentProps } from "./render-content.types.js";
3
- declare function RenderContent(props: RenderContentProps): JSX.Element;
4
- export default RenderContent;
@@ -1,7 +0,0 @@
1
- import type { BuilderContent } from '../../types/builder-content';
2
- import type { Nullable } from '../../types/typescript';
3
- import type { RenderContentProps } from './render-content.types';
4
- export declare const getContextStateInitialValue: ({ content, data, locale, }: Pick<RenderContentProps, 'content' | 'data' | 'locale'>) => {
5
- [x: string]: unknown;
6
- };
7
- export declare const getContentInitialValue: ({ content, data, }: Pick<RenderContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
@@ -1,30 +0,0 @@
1
- export const getContextStateInitialValue = ({ content, data, locale, }) => {
2
- const defaultValues = {};
3
- // set default values for content state inputs
4
- content?.data?.inputs?.forEach((input) => {
5
- if (input.name &&
6
- input.defaultValue !== undefined &&
7
- content?.data?.state &&
8
- content.data.state[input.name] === undefined) {
9
- defaultValues[input.name] = input.defaultValue;
10
- }
11
- });
12
- const stateToUse = {
13
- ...content?.data?.state,
14
- ...data,
15
- ...(locale ? { locale } : {}),
16
- };
17
- return { ...defaultValues, ...stateToUse };
18
- };
19
- export const getContentInitialValue = ({ content, data, }) => {
20
- return !content
21
- ? undefined
22
- : {
23
- ...content,
24
- data: {
25
- ...content?.data,
26
- ...data,
27
- },
28
- meta: content?.meta,
29
- };
30
- };