@builder.io/sdk-react-native 1.0.31-2 → 1.0.32

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 (426) hide show
  1. package/lib/browser/commonjs/blocks/image/component-info.js +5 -0
  2. package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
  3. package/lib/browser/commonjs/components/block/block.helpers.js +27 -7
  4. package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
  5. package/lib/browser/commonjs/components/block/block.js +9 -13
  6. package/lib/browser/commonjs/components/block/block.js.map +1 -1
  7. package/lib/browser/commonjs/components/block/components/block-wrapper.js.map +1 -1
  8. package/lib/browser/commonjs/components/content/components/enable-editor.js +9 -9
  9. package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
  10. package/lib/browser/commonjs/components/content/components/styles.helpers.js +2 -2
  11. package/lib/browser/commonjs/components/content/components/styles.helpers.js.map +1 -1
  12. package/lib/browser/commonjs/components/content/content.js +0 -1
  13. package/lib/browser/commonjs/components/content/content.js.map +1 -1
  14. package/lib/browser/commonjs/constants/sdk-version.js +1 -1
  15. package/lib/browser/commonjs/constants/sdk-version.js.map +1 -1
  16. package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  17. package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  18. package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  19. package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  20. package/lib/browser/commonjs/functions/get-block-actions.js +1 -2
  21. package/lib/browser/commonjs/functions/get-block-actions.js.map +1 -1
  22. package/lib/browser/commonjs/functions/get-block-component-options.js +1 -5
  23. package/lib/browser/commonjs/functions/get-block-component-options.js.map +1 -1
  24. package/lib/browser/commonjs/functions/get-content/index.js +1 -2
  25. package/lib/browser/commonjs/functions/get-content/index.js.map +1 -1
  26. package/lib/browser/commonjs/helpers/cookie.js +2 -12
  27. package/lib/browser/commonjs/helpers/cookie.js.map +1 -1
  28. package/lib/browser/module/blocks/image/component-info.js +5 -0
  29. package/lib/browser/module/blocks/image/component-info.js.map +1 -1
  30. package/lib/browser/module/components/block/block.helpers.js +22 -4
  31. package/lib/browser/module/components/block/block.helpers.js.map +1 -1
  32. package/lib/browser/module/components/block/block.js +10 -14
  33. package/lib/browser/module/components/block/block.js.map +1 -1
  34. package/lib/browser/module/components/block/components/block-wrapper.js.map +1 -1
  35. package/lib/browser/module/components/content/components/enable-editor.js +9 -9
  36. package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
  37. package/lib/browser/module/components/content/components/styles.helpers.js +2 -2
  38. package/lib/browser/module/components/content/components/styles.helpers.js.map +1 -1
  39. package/lib/browser/module/components/content/content.js +0 -1
  40. package/lib/browser/module/components/content/content.js.map +1 -1
  41. package/lib/browser/module/constants/sdk-version.js +1 -1
  42. package/lib/browser/module/constants/sdk-version.js.map +1 -1
  43. package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  44. package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  45. package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  46. package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  47. package/lib/browser/module/functions/get-block-actions.js +1 -2
  48. package/lib/browser/module/functions/get-block-actions.js.map +1 -1
  49. package/lib/browser/module/functions/get-block-component-options.js +1 -5
  50. package/lib/browser/module/functions/get-block-component-options.js.map +1 -1
  51. package/lib/browser/module/functions/get-content/index.js +1 -2
  52. package/lib/browser/module/functions/get-content/index.js.map +1 -1
  53. package/lib/browser/module/helpers/cookie.js +2 -11
  54. package/lib/browser/module/helpers/cookie.js.map +1 -1
  55. package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
  56. package/lib/browser/typescript/blocks/image/image.types.d.ts +1 -0
  57. package/lib/browser/typescript/blocks/image/image.types.d.ts.map +1 -1
  58. package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
  59. package/lib/browser/typescript/components/block/block.helpers.d.ts +20 -2
  60. package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
  61. package/lib/browser/typescript/components/block/components/block-wrapper.d.ts +0 -1
  62. package/lib/browser/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  63. package/lib/browser/typescript/components/content/components/enable-editor.d.ts +1 -1
  64. package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  65. package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
  66. package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
  67. package/lib/browser/typescript/constants/sdk-version.d.ts.map +1 -1
  68. package/lib/browser/typescript/functions/get-block-component-options.d.ts.map +1 -1
  69. package/lib/browser/typescript/helpers/cookie.d.ts +0 -1
  70. package/lib/browser/typescript/helpers/cookie.d.ts.map +1 -1
  71. package/lib/edge/commonjs/blocks/image/component-info.js +5 -0
  72. package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
  73. package/lib/edge/commonjs/components/block/block.helpers.js +27 -7
  74. package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
  75. package/lib/edge/commonjs/components/block/block.js +9 -13
  76. package/lib/edge/commonjs/components/block/block.js.map +1 -1
  77. package/lib/edge/commonjs/components/block/components/block-wrapper.js.map +1 -1
  78. package/lib/edge/commonjs/components/content/components/enable-editor.js +9 -9
  79. package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
  80. package/lib/edge/commonjs/components/content/components/styles.helpers.js +2 -2
  81. package/lib/edge/commonjs/components/content/components/styles.helpers.js.map +1 -1
  82. package/lib/edge/commonjs/components/content/content.js +0 -1
  83. package/lib/edge/commonjs/components/content/content.js.map +1 -1
  84. package/lib/edge/commonjs/constants/sdk-version.js +1 -1
  85. package/lib/edge/commonjs/constants/sdk-version.js.map +1 -1
  86. package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  87. package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  88. package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  89. package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  90. package/lib/edge/commonjs/functions/get-block-actions.js +1 -2
  91. package/lib/edge/commonjs/functions/get-block-actions.js.map +1 -1
  92. package/lib/edge/commonjs/functions/get-block-component-options.js +1 -5
  93. package/lib/edge/commonjs/functions/get-block-component-options.js.map +1 -1
  94. package/lib/edge/commonjs/functions/get-content/index.js +1 -2
  95. package/lib/edge/commonjs/functions/get-content/index.js.map +1 -1
  96. package/lib/edge/commonjs/helpers/cookie.js +2 -12
  97. package/lib/edge/commonjs/helpers/cookie.js.map +1 -1
  98. package/lib/edge/module/blocks/image/component-info.js +5 -0
  99. package/lib/edge/module/blocks/image/component-info.js.map +1 -1
  100. package/lib/edge/module/components/block/block.helpers.js +22 -4
  101. package/lib/edge/module/components/block/block.helpers.js.map +1 -1
  102. package/lib/edge/module/components/block/block.js +10 -14
  103. package/lib/edge/module/components/block/block.js.map +1 -1
  104. package/lib/edge/module/components/block/components/block-wrapper.js.map +1 -1
  105. package/lib/edge/module/components/content/components/enable-editor.js +9 -9
  106. package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
  107. package/lib/edge/module/components/content/components/styles.helpers.js +2 -2
  108. package/lib/edge/module/components/content/components/styles.helpers.js.map +1 -1
  109. package/lib/edge/module/components/content/content.js +0 -1
  110. package/lib/edge/module/components/content/content.js.map +1 -1
  111. package/lib/edge/module/constants/sdk-version.js +1 -1
  112. package/lib/edge/module/constants/sdk-version.js.map +1 -1
  113. package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  114. package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  115. package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  116. package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  117. package/lib/edge/module/functions/get-block-actions.js +1 -2
  118. package/lib/edge/module/functions/get-block-actions.js.map +1 -1
  119. package/lib/edge/module/functions/get-block-component-options.js +1 -5
  120. package/lib/edge/module/functions/get-block-component-options.js.map +1 -1
  121. package/lib/edge/module/functions/get-content/index.js +1 -2
  122. package/lib/edge/module/functions/get-content/index.js.map +1 -1
  123. package/lib/edge/module/helpers/cookie.js +2 -11
  124. package/lib/edge/module/helpers/cookie.js.map +1 -1
  125. package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
  126. package/lib/edge/typescript/blocks/image/image.types.d.ts +1 -0
  127. package/lib/edge/typescript/blocks/image/image.types.d.ts.map +1 -1
  128. package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
  129. package/lib/edge/typescript/components/block/block.helpers.d.ts +20 -2
  130. package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
  131. package/lib/edge/typescript/components/block/components/block-wrapper.d.ts +0 -1
  132. package/lib/edge/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  133. package/lib/edge/typescript/components/content/components/enable-editor.d.ts +1 -1
  134. package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  135. package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
  136. package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
  137. package/lib/edge/typescript/constants/sdk-version.d.ts.map +1 -1
  138. package/lib/edge/typescript/functions/get-block-component-options.d.ts.map +1 -1
  139. package/lib/edge/typescript/helpers/cookie.d.ts +0 -1
  140. package/lib/edge/typescript/helpers/cookie.d.ts.map +1 -1
  141. package/lib/node/commonjs/blocks/image/component-info.js +5 -0
  142. package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
  143. package/lib/node/commonjs/components/block/block.helpers.js +27 -7
  144. package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
  145. package/lib/node/commonjs/components/block/block.js +9 -13
  146. package/lib/node/commonjs/components/block/block.js.map +1 -1
  147. package/lib/node/commonjs/components/block/components/block-wrapper.js.map +1 -1
  148. package/lib/node/commonjs/components/content/components/enable-editor.js +9 -9
  149. package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
  150. package/lib/node/commonjs/components/content/components/styles.helpers.js +2 -2
  151. package/lib/node/commonjs/components/content/components/styles.helpers.js.map +1 -1
  152. package/lib/node/commonjs/components/content/content.js +0 -1
  153. package/lib/node/commonjs/components/content/content.js.map +1 -1
  154. package/lib/node/commonjs/constants/sdk-version.js +1 -1
  155. package/lib/node/commonjs/constants/sdk-version.js.map +1 -1
  156. package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  157. package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  158. package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
  159. package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  160. package/lib/node/commonjs/functions/get-block-actions.js +1 -2
  161. package/lib/node/commonjs/functions/get-block-actions.js.map +1 -1
  162. package/lib/node/commonjs/functions/get-block-component-options.js +1 -5
  163. package/lib/node/commonjs/functions/get-block-component-options.js.map +1 -1
  164. package/lib/node/commonjs/functions/get-content/index.js +1 -2
  165. package/lib/node/commonjs/functions/get-content/index.js.map +1 -1
  166. package/lib/node/commonjs/helpers/cookie.js +2 -12
  167. package/lib/node/commonjs/helpers/cookie.js.map +1 -1
  168. package/lib/node/module/blocks/image/component-info.js +5 -0
  169. package/lib/node/module/blocks/image/component-info.js.map +1 -1
  170. package/lib/node/module/components/block/block.helpers.js +22 -4
  171. package/lib/node/module/components/block/block.helpers.js.map +1 -1
  172. package/lib/node/module/components/block/block.js +10 -14
  173. package/lib/node/module/components/block/block.js.map +1 -1
  174. package/lib/node/module/components/block/components/block-wrapper.js.map +1 -1
  175. package/lib/node/module/components/content/components/enable-editor.js +9 -9
  176. package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
  177. package/lib/node/module/components/content/components/styles.helpers.js +2 -2
  178. package/lib/node/module/components/content/components/styles.helpers.js.map +1 -1
  179. package/lib/node/module/components/content/content.js +0 -1
  180. package/lib/node/module/components/content/content.js.map +1 -1
  181. package/lib/node/module/constants/sdk-version.js +1 -1
  182. package/lib/node/module/constants/sdk-version.js.map +1 -1
  183. package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
  184. package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
  185. package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
  186. package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
  187. package/lib/node/module/functions/get-block-actions.js +1 -2
  188. package/lib/node/module/functions/get-block-actions.js.map +1 -1
  189. package/lib/node/module/functions/get-block-component-options.js +1 -5
  190. package/lib/node/module/functions/get-block-component-options.js.map +1 -1
  191. package/lib/node/module/functions/get-content/index.js +1 -2
  192. package/lib/node/module/functions/get-content/index.js.map +1 -1
  193. package/lib/node/module/helpers/cookie.js +2 -11
  194. package/lib/node/module/helpers/cookie.js.map +1 -1
  195. package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
  196. package/lib/node/typescript/blocks/image/image.types.d.ts +1 -0
  197. package/lib/node/typescript/blocks/image/image.types.d.ts.map +1 -1
  198. package/lib/node/typescript/components/block/block.d.ts.map +1 -1
  199. package/lib/node/typescript/components/block/block.helpers.d.ts +20 -2
  200. package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
  201. package/lib/node/typescript/components/block/components/block-wrapper.d.ts +0 -1
  202. package/lib/node/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
  203. package/lib/node/typescript/components/content/components/enable-editor.d.ts +1 -1
  204. package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  205. package/lib/node/typescript/components/content/content.d.ts.map +1 -1
  206. package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
  207. package/lib/node/typescript/constants/sdk-version.d.ts.map +1 -1
  208. package/lib/node/typescript/functions/get-block-component-options.d.ts.map +1 -1
  209. package/lib/node/typescript/helpers/cookie.d.ts +0 -1
  210. package/lib/node/typescript/helpers/cookie.d.ts.map +1 -1
  211. package/package.json +5 -8
  212. package/lib/node/index.cjs +0 -6910
  213. package/lib/node/index.mjs +0 -7477
  214. package/src/blocks/BaseText.tsx +0 -17
  215. package/src/blocks/accordion/accordion.tsx +0 -181
  216. package/src/blocks/accordion/accordion.types.ts +0 -12
  217. package/src/blocks/accordion/component-info.ts +0 -124
  218. package/src/blocks/accordion/helpers.ts +0 -3
  219. package/src/blocks/accordion/index.ts +0 -1
  220. package/src/blocks/button/button.tsx +0 -56
  221. package/src/blocks/button/button.types.ts +0 -7
  222. package/src/blocks/button/component-info.ts +0 -35
  223. package/src/blocks/button/index.ts +0 -1
  224. package/src/blocks/columns/columns.tsx +0 -199
  225. package/src/blocks/columns/columns.types.ts +0 -14
  226. package/src/blocks/columns/component-info.ts +0 -219
  227. package/src/blocks/columns/helpers.ts +0 -3
  228. package/src/blocks/columns/index.ts +0 -1
  229. package/src/blocks/custom-code/component-info.ts +0 -24
  230. package/src/blocks/custom-code/custom-code.tsx +0 -71
  231. package/src/blocks/custom-code/index.ts +0 -1
  232. package/src/blocks/embed/component-info.ts +0 -38
  233. package/src/blocks/embed/embed.tsx +0 -62
  234. package/src/blocks/embed/helpers.ts +0 -2
  235. package/src/blocks/embed/index.ts +0 -1
  236. package/src/blocks/form/form/component-info.ts +0 -233
  237. package/src/blocks/form/form/form.tsx +0 -324
  238. package/src/blocks/form/form/index.ts +0 -1
  239. package/src/blocks/form/input/component-info.ts +0 -47
  240. package/src/blocks/form/input/index.ts +0 -1
  241. package/src/blocks/form/input/input.tsx +0 -49
  242. package/src/blocks/form/select/component-info.ts +0 -44
  243. package/src/blocks/form/select/index.ts +0 -1
  244. package/src/blocks/form/select/select.tsx +0 -54
  245. package/src/blocks/form/submit-button/component-info.ts +0 -27
  246. package/src/blocks/form/submit-button/index.ts +0 -1
  247. package/src/blocks/form/submit-button/submit-button.tsx +0 -34
  248. package/src/blocks/fragment/component-info.ts +0 -8
  249. package/src/blocks/fragment/fragment.tsx +0 -18
  250. package/src/blocks/fragment/fragment.types.ts +0 -5
  251. package/src/blocks/fragment/index.ts +0 -1
  252. package/src/blocks/helpers.ts +0 -43
  253. package/src/blocks/image/component-info.ts +0 -124
  254. package/src/blocks/image/image.helpers.ts +0 -47
  255. package/src/blocks/image/image.tsx +0 -65
  256. package/src/blocks/image/image.types.ts +0 -19
  257. package/src/blocks/image/index.ts +0 -1
  258. package/src/blocks/img/component-info.ts +0 -16
  259. package/src/blocks/img/img.tsx +0 -55
  260. package/src/blocks/img/index.ts +0 -1
  261. package/src/blocks/raw-text/component-info.ts +0 -11
  262. package/src/blocks/raw-text/index.ts +0 -1
  263. package/src/blocks/raw-text/raw-text.tsx +0 -1
  264. package/src/blocks/section/component-info.ts +0 -41
  265. package/src/blocks/section/index.ts +0 -1
  266. package/src/blocks/section/section.tsx +0 -39
  267. package/src/blocks/section/section.types.ts +0 -6
  268. package/src/blocks/slot/component-info.ts +0 -15
  269. package/src/blocks/slot/index.ts +0 -1
  270. package/src/blocks/slot/slot.tsx +0 -42
  271. package/src/blocks/symbol/component-info.ts +0 -35
  272. package/src/blocks/symbol/index.ts +0 -1
  273. package/src/blocks/symbol/symbol.helpers.ts +0 -47
  274. package/src/blocks/symbol/symbol.tsx +0 -100
  275. package/src/blocks/symbol/symbol.types.ts +0 -17
  276. package/src/blocks/tabs/component-info.ts +0 -139
  277. package/src/blocks/tabs/index.ts +0 -1
  278. package/src/blocks/tabs/tabs.tsx +0 -79
  279. package/src/blocks/tabs/tabs.types.ts +0 -13
  280. package/src/blocks/text/component-info.ts +0 -20
  281. package/src/blocks/text/index.ts +0 -1
  282. package/src/blocks/text/text.tsx +0 -105
  283. package/src/blocks/text/text.types.ts +0 -4
  284. package/src/blocks/textarea/component-info.ts +0 -38
  285. package/src/blocks/textarea/index.ts +0 -1
  286. package/src/blocks/textarea/textarea.tsx +0 -41
  287. package/src/blocks/video/component-info.ts +0 -83
  288. package/src/blocks/video/index.ts +0 -1
  289. package/src/blocks/video/video.tsx +0 -70
  290. package/src/blocks/video/video.types.ts +0 -21
  291. package/src/components/block/animator.ts +0 -220
  292. package/src/components/block/block.helpers.ts +0 -106
  293. package/src/components/block/block.tsx +0 -235
  294. package/src/components/block/components/block-styles.tsx +0 -136
  295. package/src/components/block/components/block-wrapper.tsx +0 -53
  296. package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
  297. package/src/components/block/components/component-ref/component-ref.tsx +0 -66
  298. package/src/components/block/components/interactive-element.tsx +0 -53
  299. package/src/components/block/components/repeated-block.tsx +0 -37
  300. package/src/components/block/types.ts +0 -6
  301. package/src/components/blocks/blocks-wrapper.tsx +0 -93
  302. package/src/components/blocks/blocks.tsx +0 -57
  303. package/src/components/blocks/blocks.types.ts +0 -7
  304. package/src/components/blocks/index.ts +0 -1
  305. package/src/components/content/components/enable-editor.tsx +0 -471
  306. package/src/components/content/components/styles.helpers.ts +0 -101
  307. package/src/components/content/components/styles.tsx +0 -42
  308. package/src/components/content/content.helpers.ts +0 -40
  309. package/src/components/content/content.tsx +0 -151
  310. package/src/components/content/content.types.ts +0 -13
  311. package/src/components/content/contentProps.types.ts +0 -17
  312. package/src/components/content/index.ts +0 -1
  313. package/src/components/content/wrap-component-ref.ts +0 -6
  314. package/src/components/content-variants/content-variants.tsx +0 -146
  315. package/src/components/content-variants/content-variants.types.ts +0 -84
  316. package/src/components/content-variants/helpers.ts +0 -72
  317. package/src/components/content-variants/index.ts +0 -1
  318. package/src/components/content-variants/inlined-fns.ts +0 -22
  319. package/src/components/dynamic-div.tsx +0 -30
  320. package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
  321. package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
  322. package/src/components/error-boundary.tsx +0 -38
  323. package/src/components/inlined-script.tsx +0 -10
  324. package/src/components/inlined-styles.tsx +0 -10
  325. package/src/constants/builder-registered-components.ts +0 -59
  326. package/src/constants/device-sizes.ts +0 -59
  327. package/src/constants/extra-components.ts +0 -1
  328. package/src/constants/sdk-version.ts +0 -1
  329. package/src/constants/target.ts +0 -3
  330. package/src/context/builder.context.ts +0 -15
  331. package/src/context/components.context.ts +0 -3
  332. package/src/context/index.ts +0 -1
  333. package/src/context/types.ts +0 -38
  334. package/src/functions/apply-patch-with-mutation.ts +0 -61
  335. package/src/functions/camel-to-kebab-case.ts +0 -1
  336. package/src/functions/deopt.ts +0 -6
  337. package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
  338. package/src/functions/evaluate/browser-runtime/index.ts +0 -1
  339. package/src/functions/evaluate/choose-eval.ts +0 -23
  340. package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
  341. package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
  342. package/src/functions/evaluate/edge-runtime/index.ts +0 -1
  343. package/src/functions/evaluate/evaluate.ts +0 -76
  344. package/src/functions/evaluate/helpers.ts +0 -56
  345. package/src/functions/evaluate/index.ts +0 -1
  346. package/src/functions/evaluate/node-runtime/index.ts +0 -1
  347. package/src/functions/evaluate/node-runtime/init.ts +0 -33
  348. package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
  349. package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -14
  350. package/src/functions/evaluate/placeholder-runtime.ts +0 -4
  351. package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
  352. package/src/functions/event-handler-name.ts +0 -4
  353. package/src/functions/extract-text-styles.ts +0 -24
  354. package/src/functions/fast-clone.ts +0 -4
  355. package/src/functions/fetch-builder-props.ts +0 -75
  356. package/src/functions/get-block-actions-handler.ts +0 -17
  357. package/src/functions/get-block-actions.ts +0 -35
  358. package/src/functions/get-block-component-options.ts +0 -11
  359. package/src/functions/get-block-properties.ts +0 -62
  360. package/src/functions/get-builder-search-params/index.ts +0 -33
  361. package/src/functions/get-class-prop-name.ts +0 -15
  362. package/src/functions/get-content/generate-content-url.ts +0 -88
  363. package/src/functions/get-content/index.ts +0 -99
  364. package/src/functions/get-content/types.ts +0 -157
  365. package/src/functions/get-env.ts +0 -5
  366. package/src/functions/get-fetch.ts +0 -11
  367. package/src/functions/get-global-this.ts +0 -16
  368. package/src/functions/get-processed-block.ts +0 -70
  369. package/src/functions/get-style.ts +0 -38
  370. package/src/functions/get.ts +0 -4
  371. package/src/functions/is-browser.ts +0 -3
  372. package/src/functions/is-edge-runtime.ts +0 -9
  373. package/src/functions/is-editing.ts +0 -8
  374. package/src/functions/is-from-trusted-host.ts +0 -8
  375. package/src/functions/is-iframe.ts +0 -4
  376. package/src/functions/is-node-runtime.ts +0 -8
  377. package/src/functions/is-previewing.ts +0 -16
  378. package/src/functions/on-change.ts +0 -29
  379. package/src/functions/register-component.ts +0 -30
  380. package/src/functions/register.ts +0 -44
  381. package/src/functions/set-editor-settings.ts +0 -15
  382. package/src/functions/set.ts +0 -14
  383. package/src/functions/track/helpers.ts +0 -51
  384. package/src/functions/track/index.ts +0 -131
  385. package/src/functions/track/interaction.ts +0 -63
  386. package/src/functions/transform-block-properties.ts +0 -33
  387. package/src/functions/transform-block.ts +0 -30
  388. package/src/functions/transform-style-property.ts +0 -296
  389. package/src/helpers/ab-tests.ts +0 -166
  390. package/src/helpers/canTrack.ts +0 -2
  391. package/src/helpers/cookie.ts +0 -109
  392. package/src/helpers/css.ts +0 -33
  393. package/src/helpers/flatten.ts +0 -41
  394. package/src/helpers/localStorage.ts +0 -36
  395. package/src/helpers/logger.ts +0 -7
  396. package/src/helpers/nullable.ts +0 -2
  397. package/src/helpers/omit.ts +0 -7
  398. package/src/helpers/preview-lru-cache/get.ts +0 -4
  399. package/src/helpers/preview-lru-cache/helpers.ts +0 -1
  400. package/src/helpers/preview-lru-cache/init.ts +0 -7
  401. package/src/helpers/preview-lru-cache/set.ts +0 -12
  402. package/src/helpers/preview-lru-cache/types.ts +0 -1
  403. package/src/helpers/search/search.ts +0 -18
  404. package/src/helpers/sessionId.ts +0 -37
  405. package/src/helpers/subscribe-to-editor.ts +0 -95
  406. package/src/helpers/time.ts +0 -2
  407. package/src/helpers/url.ts +0 -15
  408. package/src/helpers/uuid.ts +0 -17
  409. package/src/helpers/visitorId.ts +0 -37
  410. package/src/index-helpers/blocks-exports.ts +0 -16
  411. package/src/index-helpers/top-of-file.ts +0 -2
  412. package/src/index.ts +0 -15
  413. package/src/scripts/init-editing.ts +0 -119
  414. package/src/server-index.ts +0 -43
  415. package/src/types/api-version.ts +0 -2
  416. package/src/types/builder-block.ts +0 -89
  417. package/src/types/builder-content.ts +0 -47
  418. package/src/types/builder-props.ts +0 -12
  419. package/src/types/can-track.ts +0 -3
  420. package/src/types/components.ts +0 -119
  421. package/src/types/deep-partial.ts +0 -1
  422. package/src/types/element.ts +0 -57
  423. package/src/types/enforced-partials.ts +0 -19
  424. package/src/types/input.ts +0 -123
  425. package/src/types/targets.ts +0 -1
  426. package/src/types/typescript.ts +0 -9
@@ -1,62 +0,0 @@
1
- import type { BuilderContextInterface } from '../context/types';
2
- import type { BuilderBlock } from '../types/builder-block';
3
- import { getClassPropName } from './get-class-prop-name';
4
- import { getStyle } from './get-style';
5
- import { transformBlockProperties } from './transform-block-properties';
6
- const extractRelevantRootBlockProperties = (block: BuilderBlock) => {
7
- // currently we are only spreading the `href` property
8
- // TO-DO: potentially spread all properties from block, but only if they are not already defined by BuilderBlock
9
-
10
- // const {
11
- // '@type': _type,
12
- // '@version': _version,
13
- // id: _id,
14
- // tagName: _tagName,
15
- // layerName: _layerName,
16
- // groupLocked: _groupLocked,
17
- // layerLocked: _layerLocked,
18
- // class: _class,
19
- // children: _children,
20
- // responsiveStyles: _responsiveStyles,
21
- // component: _component,
22
- // bindings: _bindings,
23
- // meta: _meta,
24
- // actions: _actions,
25
- // properties: _properties,
26
- // code: _code,
27
- // repeat: _repeat,
28
- // animations: _animations,
29
- // style: _style,
30
- // hide: _hide,
31
- // show: _show,
32
- // // anything set by dynamic bindings outside of predefined `BuilderBlock` properties
33
- // ...remainingBlockProperties
34
- // } = block;
35
-
36
- return {
37
- href: (block as any).href
38
- };
39
- };
40
- export function getBlockProperties({
41
- block,
42
- context
43
- }: {
44
- block: BuilderBlock;
45
- context: BuilderContextInterface;
46
- }) {
47
- const properties = {
48
- ...extractRelevantRootBlockProperties(block),
49
- ...block.properties,
50
- 'builder-id': block.id,
51
- style: getStyle({
52
- block,
53
- context
54
- }),
55
- [getClassPropName()]: [block.id, 'builder-block', block.class, block.properties?.class].filter(Boolean).join(' ')
56
- };
57
- return transformBlockProperties({
58
- properties,
59
- context,
60
- block
61
- });
62
- }
@@ -1,33 +0,0 @@
1
- import type { QueryObject } from '../../helpers/search/search';
2
- import { normalizeSearchParams } from '../../helpers/search/search';
3
- import { isBrowser } from '../is-browser';
4
- const BUILDER_SEARCHPARAMS_PREFIX = 'builder.';
5
- const BUILDER_OPTIONS_PREFIX = 'options.';
6
-
7
- /**
8
- * Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
9
- * relevant to the Builder SDK.
10
- *
11
- * @returns
12
- */
13
- export const getBuilderSearchParams = (_options: QueryObject | URLSearchParams | undefined) => {
14
- if (!_options) {
15
- return {};
16
- }
17
- const options = normalizeSearchParams(_options);
18
- const newOptions: QueryObject = {};
19
- Object.keys(options).forEach(key => {
20
- if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
21
- const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, '').replace(BUILDER_OPTIONS_PREFIX, '');
22
- newOptions[trimmedKey] = options[key];
23
- }
24
- });
25
- return newOptions;
26
- };
27
- export const getBuilderSearchParamsFromWindow = () => {
28
- if (!isBrowser()) {
29
- return {};
30
- }
31
- const searchParams = new URLSearchParams(window.location.search);
32
- return getBuilderSearchParams(searchParams);
33
- }
@@ -1,15 +0,0 @@
1
- import { TARGET } from '../constants/target';
2
- export const getClassPropName = () => {
3
- switch (TARGET) {
4
- case 'react':
5
- case 'reactNative':
6
- case 'rsc':
7
- return 'className';
8
- case 'svelte':
9
- case 'vue':
10
- case 'solid':
11
- case 'qwik':
12
- case 'angular':
13
- return 'class';
14
- }
15
- }
@@ -1,88 +0,0 @@
1
- import { flatten, flattenMongoQuery } from '../../helpers/flatten';
2
- import { normalizeSearchParams } from '../../helpers/search/search';
3
- import { DEFAULT_API_VERSION } from '../../types/api-version';
4
- import { getBuilderSearchParamsFromWindow } from '../get-builder-search-params/index';
5
- import type { GetContentOptions } from './types';
6
- const isPositiveNumber = (thing: unknown) => typeof thing === 'number' && !isNaN(thing) && thing >= 0;
7
- export const generateContentUrl = (options: GetContentOptions): URL => {
8
- const {
9
- limit = 30,
10
- userAttributes,
11
- query,
12
- model,
13
- apiKey,
14
- enrich,
15
- locale,
16
- apiVersion = DEFAULT_API_VERSION,
17
- fields,
18
- omit,
19
- offset,
20
- cacheSeconds,
21
- staleCacheSeconds,
22
- sort,
23
- includeUnpublished
24
- } = options;
25
- if (!apiKey) {
26
- throw new Error('Missing API key');
27
- }
28
- if (!['v3'].includes(apiVersion)) {
29
- throw new Error(`Invalid apiVersion: expected 'v3', received '${apiVersion}'`);
30
- }
31
-
32
- // if we are fetching an array of content, we disable noTraverse for perf reasons.
33
- const noTraverse = limit !== 1;
34
- const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}`);
35
- url.searchParams.set('apiKey', apiKey);
36
- url.searchParams.set('limit', String(limit));
37
- url.searchParams.set('noTraverse', String(noTraverse));
38
- url.searchParams.set('includeRefs', String(true));
39
- if (locale) url.searchParams.set('locale', locale);
40
- if (enrich) url.searchParams.set('enrich', String(enrich));
41
- url.searchParams.set('omit', omit || 'meta.componentsUsed');
42
- if (fields) {
43
- url.searchParams.set('fields', fields);
44
- }
45
- if (Number.isFinite(offset) && offset! > -1) {
46
- url.searchParams.set('offset', String(Math.floor(offset!)));
47
- }
48
- if (typeof includeUnpublished === 'boolean') {
49
- url.searchParams.set('includeUnpublished', String(includeUnpublished));
50
- }
51
- if (cacheSeconds && isPositiveNumber(cacheSeconds)) {
52
- url.searchParams.set('cacheSeconds', String(cacheSeconds));
53
- }
54
- if (staleCacheSeconds && isPositiveNumber(staleCacheSeconds)) {
55
- url.searchParams.set('staleCacheSeconds', String(staleCacheSeconds));
56
- }
57
- if (sort) {
58
- const flattened = flatten({
59
- sort
60
- });
61
- for (const key in flattened) {
62
- url.searchParams.set(key, JSON.stringify((flattened as any)[key]));
63
- }
64
- }
65
-
66
- // TODO: how to express 'offset' in the url - as direct queryparam or as flattened in options[key] ?
67
-
68
- const queryOptions = {
69
- ...getBuilderSearchParamsFromWindow(),
70
- ...normalizeSearchParams(options.options || {})
71
- };
72
- const flattened = flatten(queryOptions);
73
- for (const key in flattened) {
74
- url.searchParams.set(key, String(flattened[key]));
75
- }
76
- if (userAttributes) {
77
- url.searchParams.set('userAttributes', JSON.stringify(userAttributes));
78
- }
79
- if (query) {
80
- const flattened = flattenMongoQuery({
81
- query
82
- });
83
- for (const key in flattened) {
84
- url.searchParams.set(key, JSON.stringify(flattened[key]));
85
- }
86
- }
87
- return url;
88
- }
@@ -1,99 +0,0 @@
1
- import { TARGET } from '../../constants/target';
2
- import { handleABTesting } from '../../helpers/ab-tests';
3
- import { getDefaultCanTrack } from '../../helpers/canTrack';
4
- import { logger } from '../../helpers/logger';
5
- import { getPreviewContent } from '../../helpers/preview-lru-cache/get';
6
- import type { BuilderContent } from '../../types/builder-content';
7
- import { fetch } from '../get-fetch';
8
- import { isBrowser } from '../is-browser';
9
- import { generateContentUrl } from './generate-content-url';
10
- import type { GetContentOptions } from './types';
11
- const checkContentHasResults = (content: ContentResponse): content is ContentResults => 'results' in content;
12
-
13
- /**
14
- * Returns the first content entry that matches the given options.
15
- */
16
- export async function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null> {
17
- const allContent = await fetchEntries({
18
- ...options,
19
- limit: 1
20
- });
21
- if (allContent) {
22
- return allContent[0] || null;
23
- }
24
- return null;
25
- }
26
- type ContentResults = {
27
- results: BuilderContent[];
28
- };
29
- type ContentResponse = ContentResults | {
30
- status: number;
31
- message: string;
32
- };
33
- const _fetchContent = async (options: GetContentOptions) => {
34
- const url = generateContentUrl(options);
35
- const _fetch = options.fetch ?? fetch;
36
- const res = await _fetch(url.href, options.fetchOptions);
37
- const content = await (res.json() as Promise<ContentResponse>);
38
- return content;
39
- };
40
-
41
- /**
42
- * @internal Exported only for testing purposes. Do not use.
43
- */
44
- export const _processContentResult = async (options: GetContentOptions, content: ContentResults, url: URL = generateContentUrl(options)): Promise<BuilderContent[]> => {
45
- const canTrack = getDefaultCanTrack(options.canTrack);
46
- const isPreviewing = url.search.includes(`preview=`);
47
- if (TARGET === 'rsc' && isPreviewing) {
48
- const newResults: BuilderContent[] = [];
49
- for (const item of content.results) {
50
- const previewContent = getPreviewContent(url.searchParams);
51
- newResults.push(previewContent || item);
52
- }
53
- content.results = newResults;
54
- }
55
- if (!canTrack) return content.results;
56
- if (!(isBrowser() || TARGET === 'reactNative')) return content.results;
57
-
58
- /**
59
- * For client-side navigations, it is ideal to handle AB testing at this point instead of using our
60
- * complex multi-rendering variants approach, which is only needed for SSR'd content.
61
- *
62
- * This is also where react-native would handle AB testing.
63
- */
64
- try {
65
- const newResults: BuilderContent[] = [];
66
- for (const item of content.results) {
67
- newResults.push(await handleABTesting({
68
- item,
69
- canTrack
70
- }));
71
- }
72
- content.results = newResults;
73
- } catch (e) {
74
- logger.error('Could not process A/B tests. ', e);
75
- }
76
- return content.results;
77
- };
78
-
79
- /**
80
- * Returns a paginated array of entries that match the given options.
81
- */
82
- export async function fetchEntries(options: GetContentOptions) {
83
- try {
84
- const url = generateContentUrl(options);
85
- const content = await _fetchContent(options);
86
- if (!checkContentHasResults(content)) {
87
- logger.error('Error fetching data. ', {
88
- url,
89
- content,
90
- options
91
- });
92
- return null;
93
- }
94
- return _processContentResult(options, content);
95
- } catch (error) {
96
- logger.error('Error fetching data. ', error);
97
- return null;
98
- }
99
- }
@@ -1,157 +0,0 @@
1
- export interface GetContentOptions {
2
- /** The model to get content for (required) */
3
- model: string;
4
-
5
- /** Your public API key (required) */
6
- apiKey: string;
7
-
8
- /** Number of items to fetch. Default is 1 */
9
- limit?: number;
10
-
11
- /**
12
- * Use to specify an offset for pagination of results. The default is 0.
13
- */
14
- offset?: number;
15
-
16
- /**
17
- * User attribute key value pairs to be used for targeting
18
- * https://www.builder.io/c/docs/custom-targeting-attributes
19
- *
20
- * e.g.
21
- * ```js
22
- * userAttributes: {
23
- * urlPath: '/',
24
- * returnVisitor: true,
25
- * device: 'mobile'
26
- * }
27
- * ```
28
- */
29
- userAttributes?: (Record<string, any> & {
30
- urlPath?: string;
31
- }) | null;
32
-
33
- /**
34
- * Mongodb style query of your data. E.g.:
35
- *
36
- * ```js
37
- * query: {
38
- * id: 'abc123',
39
- * data: {
40
- * myCustomField: { $gt: 20 },
41
- * }
42
- * }
43
- * ```
44
- *
45
- * See more info on MongoDB's query operators and format.
46
- *
47
- * @see {@link https://docs.mongodb.com/manual/reference/operator/query/}
48
- */
49
- query?: Record<string, any>;
50
-
51
- /**
52
- * Any other API options.
53
- * Accepts both a key/value object or a `URLSearchParams` instance
54
- * */
55
- options?: Record<string, any> | URLSearchParams;
56
-
57
- /**
58
- * If set to `false`, it will not use cookies to target content. Therefore, A/B Testing will be disabled and
59
- * only the default variation will be returned to every user.
60
- *
61
- * Defaults to `true`.
62
- */
63
- canTrack?: boolean;
64
-
65
- /**
66
- * Include multilevel references in the response.
67
- */
68
- enrich?: boolean;
69
-
70
- /**
71
- * If provided, the API will auto-resolve localized objects to the value of this `locale` key.
72
- */
73
- locale?: string;
74
-
75
- /**
76
- * If provided, sets the Builder API version used to fetch content.
77
- *
78
- * Currently, the only available API version is `v3`.
79
- */
80
- apiVersion?: 'v3';
81
-
82
- /**
83
- * Only include these fields.
84
- * Note: 'omit' takes precedence over 'fields'
85
- *
86
- * @example
87
- * ```
88
- * fields: 'id, name, data.customField'
89
- * ```
90
- */
91
- fields?: string;
92
-
93
- /**
94
- * Omit only these fields.
95
- * Note: 'omit' takes precedence over 'fields'
96
- *
97
- * @example
98
- * ```
99
- * omit: 'data.bigField,data.blocks'
100
- * ```
101
- */
102
- omit?: string;
103
-
104
- /**
105
- * Seconds to cache content. Sets the max-age of the cache-control header
106
- * response header.
107
- *
108
- * Use a higher value for better performance, lower for content that will change more frequently
109
- *
110
- * @see {@link https://www.builder.io/c/docs/query-api#__next:~:text=%26includeRefs%3Dtrue-,cacheSeconds,-No}
111
- */
112
- cacheSeconds?: number;
113
-
114
- /**
115
- * Builder.io uses stale-while-revalidate caching at the CDN level. This means we always serve
116
- * from edge cache and update caches in the background for maximum possible performance. This also
117
- * means that the more frequently content is requested, the more fresh it will be. The longest we
118
- * will ever hold something in stale cache is 1 day by default, and you can set this to be shorter
119
- * yourself as well. We suggest keeping this high unless you have content that must change rapidly
120
- * and gets very little traffic.
121
- *
122
- * @see {@link https://www.fastly.com/blog/prevent-application-network-instability-serve-stale-content}
123
- */
124
- staleCacheSeconds?: number;
125
-
126
- /**
127
- * Property to order results by.
128
- * Use 1 for ascending and -1 for descending.
129
- *
130
- * The key is what you're sorting on, so the following example sorts by createdDate
131
- * and because the value is 1, the sort is ascending.
132
- *
133
- * @example
134
- * ```
135
- * createdDate: 1
136
- * ```
137
- */
138
- sort?: {
139
- [key: string]: 1 | -1;
140
- };
141
-
142
- /**
143
- * Include content entries in a response that are still in
144
- * draft mode and un-archived. Default is false.
145
- */
146
- includeUnpublished?: boolean;
147
-
148
- /**
149
- * Optional override of the `fetch` function. (Defaults to global `fetch`)
150
- */
151
- fetch?: (input: string, init?: object) => Promise<any>;
152
-
153
- /**
154
- * Optional fetch options to be passed as the second argument to the `fetch` function.
155
- */
156
- fetchOptions?: object;
157
- }
@@ -1,5 +0,0 @@
1
- export const validEnvList = ['production', 'qa', 'test', 'development', 'dev', 'cdn-qa', 'cloud', 'fast', 'cdn2', 'cdn-prod'];
2
- export const getEnv = (): string => {
3
- const env = process.env.NODE_ENV || 'production';
4
- return validEnvList.includes(env) ? env : 'production';
5
- }
@@ -1,11 +0,0 @@
1
- import { getGlobalThis } from './get-global-this';
2
- function getFetch(): typeof global.fetch {
3
- const globalFetch: typeof global.fetch = getGlobalThis().fetch;
4
- if (typeof globalFetch === 'undefined') {
5
- console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
6
- For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
7
- throw new Error('Builder SDK could not find a global `fetch` function');
8
- }
9
- return globalFetch;
10
- }
11
- export const fetch = getFetch()
@@ -1,16 +0,0 @@
1
- type Global = typeof global | typeof window | typeof self | typeof globalThis;
2
- export function getGlobalThis(): Global {
3
- if (typeof globalThis !== 'undefined') {
4
- return globalThis;
5
- }
6
- if (typeof window !== 'undefined') {
7
- return window;
8
- }
9
- if (typeof global !== 'undefined') {
10
- return global;
11
- }
12
- if (typeof self !== 'undefined') {
13
- return self;
14
- }
15
- return globalThis;
16
- }
@@ -1,70 +0,0 @@
1
- import type { BuilderContextInterface } from '../context/types';
2
- import type { BuilderBlock } from '../types/builder-block';
3
- import { evaluate } from './evaluate/index';
4
- import { fastClone } from './fast-clone';
5
- import { set } from './set';
6
- import { transformBlock } from './transform-block';
7
- const evaluateBindings = ({
8
- block,
9
- context,
10
- localState,
11
- rootState,
12
- rootSetState
13
- }: {
14
- block: BuilderBlock;
15
- } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock => {
16
- if (!block.bindings) {
17
- return block;
18
- }
19
- const copy = fastClone(block);
20
- const copied = {
21
- ...copy,
22
- properties: {
23
- ...copy.properties
24
- },
25
- actions: {
26
- ...copy.actions
27
- }
28
- };
29
- for (const binding in block.bindings) {
30
- const expression = block.bindings[binding];
31
- const value = evaluate({
32
- code: expression,
33
- localState,
34
- rootState,
35
- rootSetState,
36
- context,
37
- enableCache: true
38
- });
39
- set(copied, binding, value);
40
- }
41
- return copied;
42
- };
43
- export function getProcessedBlock({
44
- block,
45
- context,
46
- shouldEvaluateBindings,
47
- localState,
48
- rootState,
49
- rootSetState
50
- }: {
51
- block: BuilderBlock;
52
- /**
53
- * In some cases, we want to avoid evaluating bindings and only want framework-specific block transformation. It is
54
- * also sometimes too early to consider bindings, e.g. when we might be looking at a repeated block.
55
- */
56
- shouldEvaluateBindings: boolean;
57
- } & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock {
58
- const transformedBlock = transformBlock(block);
59
- if (shouldEvaluateBindings) {
60
- return evaluateBindings({
61
- block: transformedBlock,
62
- localState,
63
- rootState,
64
- rootSetState,
65
- context
66
- });
67
- } else {
68
- return transformedBlock;
69
- }
70
- }
@@ -1,38 +0,0 @@
1
- import { TARGET } from '../constants/target';
2
- import type { BuilderContextInterface } from '../context/types';
3
- import { convertStyleMapToCSSArray } from '../helpers/css';
4
- import type { BuilderBlock } from '../types/builder-block';
5
- import { transformStyleProperty } from './transform-style-property';
6
- export const getStyle = ({
7
- block,
8
- context
9
- }: {
10
- block: BuilderBlock;
11
- context: BuilderContextInterface;
12
- }) => {
13
- return mapStyleObjToStrIfNeeded(transformStyleProperty({
14
- style: block.style || {},
15
- context,
16
- block
17
- }));
18
- };
19
-
20
- /**
21
- * Svelte does not support style attribute as an object so we need to flatten it.
22
- *
23
- * Additionally, Svelte, Vue and other frameworks use kebab-case styles, so we need to convert them.
24
- */
25
- export function mapStyleObjToStrIfNeeded(style: Partial<CSSStyleDeclaration>): string | Partial<CSSStyleDeclaration> {
26
- switch (TARGET) {
27
- case 'svelte':
28
- case 'vue':
29
- case 'solid':
30
- case 'angular':
31
- return convertStyleMapToCSSArray(style).join(' ');
32
- case 'qwik':
33
- case 'reactNative':
34
- case 'react':
35
- case 'rsc':
36
- return style;
37
- }
38
- }
@@ -1,4 +0,0 @@
1
- export const get = (obj: any, path: string, defaultValue?: any) => {
2
- const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== undefined ? res[key] : res, obj);
3
- return result === undefined || result === obj ? defaultValue : result;
4
- }
@@ -1,3 +0,0 @@
1
- export function isBrowser(): boolean {
2
- return typeof window !== 'undefined' && typeof document !== 'undefined';
3
- }
@@ -1,9 +0,0 @@
1
- import { isBrowser } from './is-browser';
2
- import { isNodeRuntime } from './is-node-runtime';
3
-
4
- /**
5
- * Identifies edge runtimes (edge, workers, serverless, etc.)
6
- */
7
- export function isEdgeRuntime(): boolean {
8
- return !isBrowser() && !isNodeRuntime();
9
- }
@@ -1,8 +0,0 @@
1
- import { TARGET } from '../constants/target';
2
- import { getSearchString, type Search } from '../helpers/search/search';
3
- import { isIframe } from './is-iframe';
4
- export function isEditing(search?: Search) {
5
- return isIframe() && (TARGET === 'reactNative' ||
6
- // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
7
- getSearchString(search || window.location.search).indexOf('builder.frameEditing=') !== -1);
8
- }
@@ -1,8 +0,0 @@
1
- const DEFAULT_TRUSTED_HOSTS = ['*.beta.builder.io', 'beta.builder.io', 'builder.io', 'localhost', 'qa.builder.io'];
2
- export function isFromTrustedHost(trustedHosts: string[] | undefined, e: {
3
- origin: string;
4
- }): boolean {
5
- const url = new URL(e.origin),
6
- hostname = url.hostname;
7
- return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex(trustedHost => trustedHost.startsWith('*.') ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
8
- }
@@ -1,4 +0,0 @@
1
- import { isBrowser } from './is-browser';
2
- export function isIframe(): boolean {
3
- return isBrowser() && window.self !== window.top;
4
- }
@@ -1,8 +0,0 @@
1
- import { checkIsDefined } from '../helpers/nullable';
2
-
3
- /**
4
- * Identifies node runtime
5
- */
6
- export function isNodeRuntime(): boolean {
7
- return typeof process !== 'undefined' && checkIsDefined(process?.versions?.node);
8
- }
@@ -1,16 +0,0 @@
1
- import type { Search } from '../helpers/search/search';
2
- import { getSearchString } from '../helpers/search/search';
3
- import { isBrowser } from './is-browser';
4
- export function isPreviewing(_search?: Search) {
5
- const search = _search || (isBrowser() ? window.location.search : undefined);
6
-
7
- /**
8
- * If this function is called on the server without an explicit `search` argument,
9
- * then it can't check if the user is previewing, and will return `false`.
10
- */
11
- if (!search) {
12
- return false;
13
- }
14
- const normalizedSearch = getSearchString(search);
15
- return Boolean(normalizedSearch.indexOf('builder.preview=') !== -1);
16
- }