@builder.io/sdk-react-native 3.0.0 → 3.0.1-1

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 (277) hide show
  1. package/lib/browser/commonjs/blocks/image/component-info.js +2 -1
  2. package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
  3. package/lib/browser/commonjs/blocks/img/component-info.js +2 -1
  4. package/lib/browser/commonjs/blocks/img/component-info.js.map +1 -1
  5. package/lib/browser/commonjs/blocks/video/component-info.js +3 -2
  6. package/lib/browser/commonjs/blocks/video/component-info.js.map +1 -1
  7. package/lib/browser/commonjs/components/block/block.helpers.js +17 -6
  8. package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
  9. package/lib/browser/commonjs/components/block/block.js +3 -2
  10. package/lib/browser/commonjs/components/block/block.js.map +1 -1
  11. package/lib/browser/commonjs/components/blocks/blocks.js +46 -11
  12. package/lib/browser/commonjs/components/blocks/blocks.js.map +1 -1
  13. package/lib/browser/commonjs/components/content/components/enable-editor.helpers.js +24 -0
  14. package/lib/browser/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
  15. package/lib/browser/commonjs/components/content/components/enable-editor.js +17 -7
  16. package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
  17. package/lib/browser/commonjs/components/content/content.js +37 -54
  18. package/lib/browser/commonjs/components/content/content.js.map +1 -1
  19. package/lib/browser/commonjs/constants/file-types.js +9 -0
  20. package/lib/browser/commonjs/constants/file-types.js.map +1 -0
  21. package/lib/browser/commonjs/constants/sdk-version.js +1 -1
  22. package/lib/browser/commonjs/context/builder.context.js +2 -1
  23. package/lib/browser/commonjs/context/builder.context.js.map +1 -1
  24. package/lib/browser/commonjs/functions/extract-localized-values.js +45 -0
  25. package/lib/browser/commonjs/functions/extract-localized-values.js.map +1 -0
  26. package/lib/browser/commonjs/functions/get-processed-block.js +3 -1
  27. package/lib/browser/commonjs/functions/get-processed-block.js.map +1 -1
  28. package/lib/browser/commonjs/functions/register-component.js +4 -1
  29. package/lib/browser/commonjs/functions/register-component.js.map +1 -1
  30. package/lib/browser/commonjs/functions/traverse.js +69 -0
  31. package/lib/browser/commonjs/functions/traverse.js.map +1 -0
  32. package/lib/browser/module/blocks/image/component-info.js +2 -1
  33. package/lib/browser/module/blocks/image/component-info.js.map +1 -1
  34. package/lib/browser/module/blocks/img/component-info.js +2 -1
  35. package/lib/browser/module/blocks/img/component-info.js.map +1 -1
  36. package/lib/browser/module/blocks/video/component-info.js +3 -2
  37. package/lib/browser/module/blocks/video/component-info.js.map +1 -1
  38. package/lib/browser/module/components/block/block.helpers.js +17 -6
  39. package/lib/browser/module/components/block/block.helpers.js.map +1 -1
  40. package/lib/browser/module/components/block/block.js +3 -2
  41. package/lib/browser/module/components/block/block.js.map +1 -1
  42. package/lib/browser/module/components/blocks/blocks.js +46 -11
  43. package/lib/browser/module/components/blocks/blocks.js.map +1 -1
  44. package/lib/browser/module/components/content/components/enable-editor.helpers.js +17 -0
  45. package/lib/browser/module/components/content/components/enable-editor.helpers.js.map +1 -0
  46. package/lib/browser/module/components/content/components/enable-editor.js +17 -7
  47. package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
  48. package/lib/browser/module/components/content/content.js +37 -54
  49. package/lib/browser/module/components/content/content.js.map +1 -1
  50. package/lib/browser/module/constants/file-types.js +3 -0
  51. package/lib/browser/module/constants/file-types.js.map +1 -0
  52. package/lib/browser/module/constants/sdk-version.js +1 -1
  53. package/lib/browser/module/context/builder.context.js +2 -1
  54. package/lib/browser/module/context/builder.context.js.map +1 -1
  55. package/lib/browser/module/functions/extract-localized-values.js +39 -0
  56. package/lib/browser/module/functions/extract-localized-values.js.map +1 -0
  57. package/lib/browser/module/functions/get-processed-block.js +3 -1
  58. package/lib/browser/module/functions/get-processed-block.js.map +1 -1
  59. package/lib/browser/module/functions/register-component.js +4 -1
  60. package/lib/browser/module/functions/register-component.js.map +1 -1
  61. package/lib/browser/module/functions/traverse.js +63 -0
  62. package/lib/browser/module/functions/traverse.js.map +1 -0
  63. package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
  64. package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
  65. package/lib/browser/typescript/components/block/block.helpers.d.ts +6 -3
  66. package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
  67. package/lib/browser/typescript/components/blocks/blocks.d.ts +3 -2
  68. package/lib/browser/typescript/components/blocks/blocks.d.ts.map +1 -1
  69. package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  70. package/lib/browser/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
  71. package/lib/browser/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
  72. package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
  73. package/lib/browser/typescript/constants/file-types.d.ts +3 -0
  74. package/lib/browser/typescript/constants/file-types.d.ts.map +1 -0
  75. package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
  76. package/lib/browser/typescript/context/builder.context.d.ts.map +1 -1
  77. package/lib/browser/typescript/context/types.d.ts +1 -0
  78. package/lib/browser/typescript/context/types.d.ts.map +1 -1
  79. package/lib/browser/typescript/functions/extract-localized-values.d.ts +3 -0
  80. package/lib/browser/typescript/functions/extract-localized-values.d.ts.map +1 -0
  81. package/lib/browser/typescript/functions/get-processed-block.d.ts.map +1 -1
  82. package/lib/browser/typescript/functions/register-component.d.ts.map +1 -1
  83. package/lib/browser/typescript/functions/traverse.d.ts +35 -0
  84. package/lib/browser/typescript/functions/traverse.d.ts.map +1 -0
  85. package/lib/browser/typescript/types/components.d.ts +3 -0
  86. package/lib/browser/typescript/types/components.d.ts.map +1 -1
  87. package/lib/edge/commonjs/blocks/image/component-info.js +2 -1
  88. package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
  89. package/lib/edge/commonjs/blocks/img/component-info.js +2 -1
  90. package/lib/edge/commonjs/blocks/img/component-info.js.map +1 -1
  91. package/lib/edge/commonjs/blocks/video/component-info.js +3 -2
  92. package/lib/edge/commonjs/blocks/video/component-info.js.map +1 -1
  93. package/lib/edge/commonjs/components/block/block.helpers.js +17 -6
  94. package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
  95. package/lib/edge/commonjs/components/block/block.js +3 -2
  96. package/lib/edge/commonjs/components/block/block.js.map +1 -1
  97. package/lib/edge/commonjs/components/blocks/blocks.js +46 -11
  98. package/lib/edge/commonjs/components/blocks/blocks.js.map +1 -1
  99. package/lib/edge/commonjs/components/content/components/enable-editor.helpers.js +24 -0
  100. package/lib/edge/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
  101. package/lib/edge/commonjs/components/content/components/enable-editor.js +17 -7
  102. package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
  103. package/lib/edge/commonjs/components/content/content.js +37 -54
  104. package/lib/edge/commonjs/components/content/content.js.map +1 -1
  105. package/lib/edge/commonjs/constants/file-types.js +9 -0
  106. package/lib/edge/commonjs/constants/file-types.js.map +1 -0
  107. package/lib/edge/commonjs/constants/sdk-version.js +1 -1
  108. package/lib/edge/commonjs/context/builder.context.js +2 -1
  109. package/lib/edge/commonjs/context/builder.context.js.map +1 -1
  110. package/lib/edge/commonjs/functions/extract-localized-values.js +45 -0
  111. package/lib/edge/commonjs/functions/extract-localized-values.js.map +1 -0
  112. package/lib/edge/commonjs/functions/get-processed-block.js +3 -1
  113. package/lib/edge/commonjs/functions/get-processed-block.js.map +1 -1
  114. package/lib/edge/commonjs/functions/register-component.js +4 -1
  115. package/lib/edge/commonjs/functions/register-component.js.map +1 -1
  116. package/lib/edge/commonjs/functions/traverse.js +69 -0
  117. package/lib/edge/commonjs/functions/traverse.js.map +1 -0
  118. package/lib/edge/module/blocks/image/component-info.js +2 -1
  119. package/lib/edge/module/blocks/image/component-info.js.map +1 -1
  120. package/lib/edge/module/blocks/img/component-info.js +2 -1
  121. package/lib/edge/module/blocks/img/component-info.js.map +1 -1
  122. package/lib/edge/module/blocks/video/component-info.js +3 -2
  123. package/lib/edge/module/blocks/video/component-info.js.map +1 -1
  124. package/lib/edge/module/components/block/block.helpers.js +17 -6
  125. package/lib/edge/module/components/block/block.helpers.js.map +1 -1
  126. package/lib/edge/module/components/block/block.js +3 -2
  127. package/lib/edge/module/components/block/block.js.map +1 -1
  128. package/lib/edge/module/components/blocks/blocks.js +46 -11
  129. package/lib/edge/module/components/blocks/blocks.js.map +1 -1
  130. package/lib/edge/module/components/content/components/enable-editor.helpers.js +17 -0
  131. package/lib/edge/module/components/content/components/enable-editor.helpers.js.map +1 -0
  132. package/lib/edge/module/components/content/components/enable-editor.js +17 -7
  133. package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
  134. package/lib/edge/module/components/content/content.js +37 -54
  135. package/lib/edge/module/components/content/content.js.map +1 -1
  136. package/lib/edge/module/constants/file-types.js +3 -0
  137. package/lib/edge/module/constants/file-types.js.map +1 -0
  138. package/lib/edge/module/constants/sdk-version.js +1 -1
  139. package/lib/edge/module/context/builder.context.js +2 -1
  140. package/lib/edge/module/context/builder.context.js.map +1 -1
  141. package/lib/edge/module/functions/extract-localized-values.js +39 -0
  142. package/lib/edge/module/functions/extract-localized-values.js.map +1 -0
  143. package/lib/edge/module/functions/get-processed-block.js +3 -1
  144. package/lib/edge/module/functions/get-processed-block.js.map +1 -1
  145. package/lib/edge/module/functions/register-component.js +4 -1
  146. package/lib/edge/module/functions/register-component.js.map +1 -1
  147. package/lib/edge/module/functions/traverse.js +63 -0
  148. package/lib/edge/module/functions/traverse.js.map +1 -0
  149. package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
  150. package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
  151. package/lib/edge/typescript/components/block/block.helpers.d.ts +6 -3
  152. package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
  153. package/lib/edge/typescript/components/blocks/blocks.d.ts +3 -2
  154. package/lib/edge/typescript/components/blocks/blocks.d.ts.map +1 -1
  155. package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  156. package/lib/edge/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
  157. package/lib/edge/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
  158. package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
  159. package/lib/edge/typescript/constants/file-types.d.ts +3 -0
  160. package/lib/edge/typescript/constants/file-types.d.ts.map +1 -0
  161. package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
  162. package/lib/edge/typescript/context/builder.context.d.ts.map +1 -1
  163. package/lib/edge/typescript/context/types.d.ts +1 -0
  164. package/lib/edge/typescript/context/types.d.ts.map +1 -1
  165. package/lib/edge/typescript/functions/extract-localized-values.d.ts +3 -0
  166. package/lib/edge/typescript/functions/extract-localized-values.d.ts.map +1 -0
  167. package/lib/edge/typescript/functions/get-processed-block.d.ts.map +1 -1
  168. package/lib/edge/typescript/functions/register-component.d.ts.map +1 -1
  169. package/lib/edge/typescript/functions/traverse.d.ts +35 -0
  170. package/lib/edge/typescript/functions/traverse.d.ts.map +1 -0
  171. package/lib/edge/typescript/types/components.d.ts +3 -0
  172. package/lib/edge/typescript/types/components.d.ts.map +1 -1
  173. package/lib/node/commonjs/blocks/image/component-info.js +2 -1
  174. package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
  175. package/lib/node/commonjs/blocks/img/component-info.js +2 -1
  176. package/lib/node/commonjs/blocks/img/component-info.js.map +1 -1
  177. package/lib/node/commonjs/blocks/video/component-info.js +3 -2
  178. package/lib/node/commonjs/blocks/video/component-info.js.map +1 -1
  179. package/lib/node/commonjs/components/block/block.helpers.js +17 -6
  180. package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
  181. package/lib/node/commonjs/components/block/block.js +3 -2
  182. package/lib/node/commonjs/components/block/block.js.map +1 -1
  183. package/lib/node/commonjs/components/blocks/blocks.js +46 -11
  184. package/lib/node/commonjs/components/blocks/blocks.js.map +1 -1
  185. package/lib/node/commonjs/components/content/components/enable-editor.helpers.js +24 -0
  186. package/lib/node/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
  187. package/lib/node/commonjs/components/content/components/enable-editor.js +17 -7
  188. package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
  189. package/lib/node/commonjs/components/content/content.js +37 -54
  190. package/lib/node/commonjs/components/content/content.js.map +1 -1
  191. package/lib/node/commonjs/constants/file-types.js +9 -0
  192. package/lib/node/commonjs/constants/file-types.js.map +1 -0
  193. package/lib/node/commonjs/constants/sdk-version.js +1 -1
  194. package/lib/node/commonjs/context/builder.context.js +2 -1
  195. package/lib/node/commonjs/context/builder.context.js.map +1 -1
  196. package/lib/node/commonjs/functions/extract-localized-values.js +45 -0
  197. package/lib/node/commonjs/functions/extract-localized-values.js.map +1 -0
  198. package/lib/node/commonjs/functions/get-processed-block.js +3 -1
  199. package/lib/node/commonjs/functions/get-processed-block.js.map +1 -1
  200. package/lib/node/commonjs/functions/register-component.js +4 -1
  201. package/lib/node/commonjs/functions/register-component.js.map +1 -1
  202. package/lib/node/commonjs/functions/traverse.js +69 -0
  203. package/lib/node/commonjs/functions/traverse.js.map +1 -0
  204. package/lib/node/module/blocks/image/component-info.js +2 -1
  205. package/lib/node/module/blocks/image/component-info.js.map +1 -1
  206. package/lib/node/module/blocks/img/component-info.js +2 -1
  207. package/lib/node/module/blocks/img/component-info.js.map +1 -1
  208. package/lib/node/module/blocks/video/component-info.js +3 -2
  209. package/lib/node/module/blocks/video/component-info.js.map +1 -1
  210. package/lib/node/module/components/block/block.helpers.js +17 -6
  211. package/lib/node/module/components/block/block.helpers.js.map +1 -1
  212. package/lib/node/module/components/block/block.js +3 -2
  213. package/lib/node/module/components/block/block.js.map +1 -1
  214. package/lib/node/module/components/blocks/blocks.js +46 -11
  215. package/lib/node/module/components/blocks/blocks.js.map +1 -1
  216. package/lib/node/module/components/content/components/enable-editor.helpers.js +17 -0
  217. package/lib/node/module/components/content/components/enable-editor.helpers.js.map +1 -0
  218. package/lib/node/module/components/content/components/enable-editor.js +17 -7
  219. package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
  220. package/lib/node/module/components/content/content.js +37 -54
  221. package/lib/node/module/components/content/content.js.map +1 -1
  222. package/lib/node/module/constants/file-types.js +3 -0
  223. package/lib/node/module/constants/file-types.js.map +1 -0
  224. package/lib/node/module/constants/sdk-version.js +1 -1
  225. package/lib/node/module/context/builder.context.js +2 -1
  226. package/lib/node/module/context/builder.context.js.map +1 -1
  227. package/lib/node/module/functions/extract-localized-values.js +39 -0
  228. package/lib/node/module/functions/extract-localized-values.js.map +1 -0
  229. package/lib/node/module/functions/get-processed-block.js +3 -1
  230. package/lib/node/module/functions/get-processed-block.js.map +1 -1
  231. package/lib/node/module/functions/register-component.js +4 -1
  232. package/lib/node/module/functions/register-component.js.map +1 -1
  233. package/lib/node/module/functions/traverse.js +63 -0
  234. package/lib/node/module/functions/traverse.js.map +1 -0
  235. package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
  236. package/lib/node/typescript/components/block/block.d.ts.map +1 -1
  237. package/lib/node/typescript/components/block/block.helpers.d.ts +6 -3
  238. package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
  239. package/lib/node/typescript/components/blocks/blocks.d.ts +3 -2
  240. package/lib/node/typescript/components/blocks/blocks.d.ts.map +1 -1
  241. package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
  242. package/lib/node/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
  243. package/lib/node/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
  244. package/lib/node/typescript/components/content/content.d.ts.map +1 -1
  245. package/lib/node/typescript/constants/file-types.d.ts +3 -0
  246. package/lib/node/typescript/constants/file-types.d.ts.map +1 -0
  247. package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
  248. package/lib/node/typescript/context/builder.context.d.ts.map +1 -1
  249. package/lib/node/typescript/context/types.d.ts +1 -0
  250. package/lib/node/typescript/context/types.d.ts.map +1 -1
  251. package/lib/node/typescript/functions/extract-localized-values.d.ts +3 -0
  252. package/lib/node/typescript/functions/extract-localized-values.d.ts.map +1 -0
  253. package/lib/node/typescript/functions/get-processed-block.d.ts.map +1 -1
  254. package/lib/node/typescript/functions/register-component.d.ts.map +1 -1
  255. package/lib/node/typescript/functions/traverse.d.ts +35 -0
  256. package/lib/node/typescript/functions/traverse.d.ts.map +1 -0
  257. package/lib/node/typescript/types/components.d.ts +3 -0
  258. package/lib/node/typescript/types/components.d.ts.map +1 -1
  259. package/package.json +1 -1
  260. package/src/blocks/image/component-info.ts +2 -1
  261. package/src/blocks/img/component-info.ts +2 -1
  262. package/src/blocks/video/component-info.ts +3 -2
  263. package/src/components/block/block.helpers.ts +18 -6
  264. package/src/components/block/block.tsx +3 -1
  265. package/src/components/blocks/blocks.tsx +89 -54
  266. package/src/components/content/components/enable-editor.helpers.ts +18 -0
  267. package/src/components/content/components/enable-editor.tsx +25 -5
  268. package/src/components/content/content.tsx +3 -10
  269. package/src/constants/file-types.ts +2 -0
  270. package/src/constants/sdk-version.ts +1 -1
  271. package/src/context/builder.context.ts +1 -0
  272. package/src/context/types.ts +1 -0
  273. package/src/functions/extract-localized-values.ts +38 -0
  274. package/src/functions/get-processed-block.ts +3 -1
  275. package/src/functions/register-component.ts +4 -1
  276. package/src/functions/traverse.ts +64 -0
  277. package/src/types/components.ts +3 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Recursively traverses an object or array, invoking a callback on each value.
3
+ *
4
+ * @param {any} obj - The object or array to traverse. Can also handle primitives, null, or undefined.
5
+ * @param {TraverseCallback} callback - The function to invoke on each value. Receives the current value
6
+ * and an `update` function to modify the value in its parent container.
7
+ * @param {any} [parent=null] - The parent object or array of the current value. Used internally.
8
+ * @param {any} [key=null] - The key or index of the current value in its parent. Used internally.
9
+ * @param {WeakSet} [visited=new WeakSet()] - Tracks visited objects to handle circular references. Used internally.
10
+ *
11
+ * @example
12
+ * // Example: Doubling all numbers in an object
13
+ * const obj = { a: 1, b: [2, 3, { c: 4 }] };
14
+ * traverse(obj, (value, update) => {
15
+ * if (typeof value === 'number') {
16
+ * update(value * 2);
17
+ * }
18
+ * });
19
+ * console.log(obj); // { a: 2, b: [4, 6, { c: 8 }] }
20
+ *
21
+ * @example
22
+ * // Example: Handling circular references
23
+ * const obj = { a: 1 };
24
+ * obj.self = obj;
25
+ * traverse(obj, (value, update) => {
26
+ * if (typeof value === 'number') {
27
+ * update(value * 2);
28
+ * }
29
+ * });
30
+ * console.log(obj.a); // 2
31
+ */
32
+ export function traverse(obj, callback, parent = null, key = null, visited = new WeakSet()) {
33
+ if (obj == null || typeof obj !== 'object') {
34
+ callback(obj, newValue => {
35
+ if (parent !== null && key !== null) {
36
+ parent[key] = newValue;
37
+ }
38
+ });
39
+ return;
40
+ }
41
+ if (visited.has(obj)) {
42
+ return;
43
+ }
44
+ visited.add(obj);
45
+ if (Array.isArray(obj)) {
46
+ obj.forEach((item, index) => {
47
+ const update = newValue => {
48
+ obj[index] = newValue;
49
+ };
50
+ callback(item, update);
51
+ traverse(item, callback, obj, index, visited);
52
+ });
53
+ } else {
54
+ Object.entries(obj).forEach(([key, value]) => {
55
+ const update = newValue => {
56
+ obj[key] = newValue;
57
+ };
58
+ callback(value, update);
59
+ traverse(value, callback, obj, key, visited);
60
+ });
61
+ }
62
+ }
63
+ //# sourceMappingURL=traverse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["traverse","obj","callback","parent","key","visited","WeakSet","newValue","has","add","Array","isArray","forEach","item","index","update","Object","entries","value"],"sourceRoot":"../../../../src","sources":["functions/traverse.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,QAAQA,CAACC,GAAQ,EAAEC,QAA0B,EAAEC,MAAW,GAAG,IAAI,EAAEC,GAAQ,GAAG,IAAI,EAAEC,O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component-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,eAAO,MAAM,aAAa,EAAE,aAkI3B,CAAA"}
1
+ {"version":3,"file":"component-info.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/image/component-info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,eAAO,MAAM,aAAa,EAAE,aAkI3B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB9D,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,qBAsM/B;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB9D,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,qBAwM/B;AAED,eAAe,KAAK,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import type { BuilderContextInterface, RegisteredComponent, RegisteredComponents } from '../../context/types';
2
2
  import type { BuilderBlock } from '../../types/builder-block';
3
3
  import type { RepeatData } from './types';
4
- export declare const getComponent: ({ block, registeredComponents }: {
4
+ export declare const getComponent: ({ block, registeredComponents, model }: {
5
5
  block: BuilderBlock;
6
6
  registeredComponents: RegisteredComponents;
7
+ model: string;
7
8
  }) => RegisteredComponent;
8
9
  export declare const getRepeatItemData: ({ block, context }: {
9
10
  block: BuilderBlock;
@@ -18,8 +19,10 @@ export declare const provideLinkComponent: (block: RegisteredComponent | null |
18
19
  } | {
19
20
  builderLinkComponent?: undefined;
20
21
  };
21
- export declare const provideRegisteredComponents: (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents) => {
22
- builderComponents: RegisteredComponents;
22
+ export declare const provideRegisteredComponents: (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents, model: string) => {
23
+ builderComponents: {
24
+ [k: string]: RegisteredComponent;
25
+ };
23
26
  } | {
24
27
  builderComponents?: undefined;
25
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"block.helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAI9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,eAAO,MAAM,YAAY;WAIhB,YAAY;0BACG,oBAAoB;yBAgB3C,CAAC;AACF,eAAO,MAAM,iBAAiB;WAIrB,YAAY;aACV,uBAAuB;MAC9B,UAAU,EAAE,GAAG,SAsClB,CAAC;AACF,eA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S,gBAAgB,YAAY;;;;CAK5G,CAAC;AACF,eAAO,MAAM,qBAAqB,UAAW,mBAAmB,GAAG,IAAI,GAAG,SAAS,WAAW,uBAAuB;;;;CAKpH,CAAA"}
@@ -1,5 +1,6 @@
1
- import * as React from "react";
1
+ import React from 'react';
2
2
  import type { BlocksProps } from "./blocks.types";
3
3
  declare function Blocks(props: BlocksProps): React.JSX.Element;
4
- export default Blocks;
4
+ declare const _default: React.MemoExoticComponent<typeof Blocks>;
5
+ export default _default;
5
6
  //# sourceMappingURL=blocks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,qBAqCjC;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAS9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4BhD,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,qBAuDjC;;AAGD,wBAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAuBtE,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,kBAAkB,CAAC;AAG1B,iBAAS,YAAY,CAAC,KAAK,EAAE,kBAAkB,qBAkY9C;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAuBtE,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,kBAAkB,CAAC;AAI1B,iBAAS,YAAY,CAAC,KAAK,EAAE,kBAAkB,qBAqZ9C;AAED,eAAe,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Target } from '../../../types/targets';
2
+ /**
3
+ * SDKS that use the elementRef approach to enable visual editing.
4
+ * We don't need to render the div for other SDKs as they attach event listeners to the window.
5
+ */
6
+ export declare const SDKS_USING_ELEMENT_REF_APPROACH: Target[];
7
+ /**
8
+ * We need to attach this div only when content exists or isPreviewing/isEditing even when content is null,
9
+ * as we need to set the elementRef and allow previewing and visual editing
10
+ */
11
+ export declare const needsElementRefDivForEditing: () => boolean;
12
+ //# sourceMappingURL=enable-editor.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable-editor.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,+BAA+B,UAA0C,CAAC;AAEvF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,eAExC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,qBA+J5C;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,qBAwJ5C;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const IMAGE_FILE_TYPES: string[];
2
+ export declare const VIDEO_FILE_TYPES: string[];
3
+ //# sourceMappingURL=file-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-types.d.ts","sourceRoot":"","sources":["../../../../src/constants/file-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAA2L,CAAC;AACzN,eAAO,MAAM,gBAAgB,UAAsR,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "3.0.0";
1
+ export declare const SDK_VERSION = "3.0.1";
2
2
  //# sourceMappingURL=sdk-version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.context.d.ts","sourceRoot":"","sources":["../../../../src/context/builder.context.ts"],"names":[],"mappings":";;AAEA,wBAaG"}
1
+ {"version":3,"file":"builder.context.d.ts","sourceRoot":"","sources":["../../../../src/context/builder.context.ts"],"names":[],"mappings":";;AAEA,wBAcG"}
@@ -36,6 +36,7 @@ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'Block
36
36
  componentInfos: Dictionary<ComponentInfo>;
37
37
  inheritedStyles: Record<string, unknown>;
38
38
  nonce: string;
39
+ model: string;
39
40
  canTrack?: boolean;
40
41
  }
41
42
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,SAAS,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3D,MAAM,WAAW,uBAAwB,SAAQ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B,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3D,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,oBAAoB,CAAC,EAAE,iBAAiB;IAClI,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClC,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;OAIG;IACH,SAAS,EAAE,kBAAkB,CAAC;IAC9B;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE;;;;OAIG;IACH,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC3C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,cAAc,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAE1C,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ import type { BuilderBlock } from '../types/builder-block';
2
+ export declare function resolveLocalizedValues(block: BuilderBlock, locale: string | undefined): BuilderBlock;
3
+ //# sourceMappingURL=extract-localized-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-localized-values.d.ts","sourceRoot":"","sources":["../../../../src/functions/extract-localized-values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA6B3D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,gBAQrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-processed-block.d.ts","sourceRoot":"","sources":["../../../../src/functions/get-processed-block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO3D,wBAAgB,uBAAuB,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAiB1D;AAwDD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,YAAY,EACb,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC,GAAG,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC,GAAG,YAAY,CAaxG"}
1
+ {"version":3,"file":"get-processed-block.d.ts","sourceRoot":"","sources":["../../../../src/functions/get-processed-block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQ3D,wBAAgB,uBAAuB,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAiB1D;AAwDD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,YAAY,EACb,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC,GAAG,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC,GAAG,YAAY,CAcxG"}
@@ -1 +1 @@
1
- {"version":3,"file":"register-component.d.ts","sourceRoot":"","sources":["../../../../src/functions/register-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,eAAO,MAAM,8BAA8B,SAAU,aAAa;;;CAGhE,CAAC;AAeH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,OAO9D"}
1
+ {"version":3,"file":"register-component.d.ts","sourceRoot":"","sources":["../../../../src/functions/register-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,eAAO,MAAM,8BAA8B,SAAU,aAAa;;;CAGhE,CAAC;AAkBH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,OAO9D"}
@@ -0,0 +1,35 @@
1
+ type TraverseCallback = (value: any, update: (newValue: any) => void) => void;
2
+ /**
3
+ * Recursively traverses an object or array, invoking a callback on each value.
4
+ *
5
+ * @param {any} obj - The object or array to traverse. Can also handle primitives, null, or undefined.
6
+ * @param {TraverseCallback} callback - The function to invoke on each value. Receives the current value
7
+ * and an `update` function to modify the value in its parent container.
8
+ * @param {any} [parent=null] - The parent object or array of the current value. Used internally.
9
+ * @param {any} [key=null] - The key or index of the current value in its parent. Used internally.
10
+ * @param {WeakSet} [visited=new WeakSet()] - Tracks visited objects to handle circular references. Used internally.
11
+ *
12
+ * @example
13
+ * // Example: Doubling all numbers in an object
14
+ * const obj = { a: 1, b: [2, 3, { c: 4 }] };
15
+ * traverse(obj, (value, update) => {
16
+ * if (typeof value === 'number') {
17
+ * update(value * 2);
18
+ * }
19
+ * });
20
+ * console.log(obj); // { a: 2, b: [4, 6, { c: 8 }] }
21
+ *
22
+ * @example
23
+ * // Example: Handling circular references
24
+ * const obj = { a: 1 };
25
+ * obj.self = obj;
26
+ * traverse(obj, (value, update) => {
27
+ * if (typeof value === 'number') {
28
+ * update(value * 2);
29
+ * }
30
+ * });
31
+ * console.log(obj.a); // 2
32
+ */
33
+ export declare function traverse(obj: any, callback: TraverseCallback, parent?: any, key?: any, visited?: WeakSet<object>): void;
34
+ export {};
35
+ //# sourceMappingURL=traverse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../../../src/functions/traverse.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,GAAE,GAAU,EAAE,GAAG,GAAE,GAAU,EAAE,OAAO,kBAAgB,GAAG,IAAI,CA8BjI"}
@@ -146,6 +146,9 @@ export interface ComponentInfo {
146
146
  */
147
147
  builderLinkComponent?: boolean;
148
148
  };
149
+ meta?: {
150
+ [key: string]: any;
151
+ };
149
152
  }
150
153
  type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
151
154
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/types/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI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oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AACD,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react-native",
3
3
  "description": "Builder.io SDK for React Native",
4
- "version": "3.0.0",
4
+ "version": "3.0.1-1",
5
5
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/react-native",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,3 +1,4 @@
1
+ import { IMAGE_FILE_TYPES } from '../../constants/file-types';
1
2
  import type { ComponentInfo } from '../../types/components';
2
3
  export const componentInfo: ComponentInfo = {
3
4
  name: 'Image',
@@ -14,7 +15,7 @@ export const componentInfo: ComponentInfo = {
14
15
  name: 'image',
15
16
  type: 'file',
16
17
  bubble: true,
17
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'webp'],
18
+ allowedFileTypes: IMAGE_FILE_TYPES,
18
19
  required: true,
19
20
  defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
20
21
  onChange: (options: Map<string, any>): void | Promise<void> => {
@@ -1,3 +1,4 @@
1
+ import { IMAGE_FILE_TYPES } from '../../constants/file-types';
1
2
  import type { ComponentInfo } from '../../types/components';
2
3
  export const componentInfo: ComponentInfo = {
3
4
  // friendlyName?
@@ -8,7 +9,7 @@ export const componentInfo: ComponentInfo = {
8
9
  name: 'image',
9
10
  bubble: true,
10
11
  type: 'file',
11
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg', 'gif', 'webp'],
12
+ allowedFileTypes: IMAGE_FILE_TYPES,
12
13
  required: true
13
14
  }],
14
15
  noWrap: true,
@@ -1,3 +1,4 @@
1
+ import { IMAGE_FILE_TYPES, VIDEO_FILE_TYPES } from '../../constants/file-types';
1
2
  import type { ComponentInfo } from '../../types/components';
2
3
  export const componentInfo: ComponentInfo = {
3
4
  name: 'Video',
@@ -10,14 +11,14 @@ export const componentInfo: ComponentInfo = {
10
11
  inputs: [{
11
12
  name: 'video',
12
13
  type: 'file',
13
- allowedFileTypes: ['mp4'],
14
+ allowedFileTypes: VIDEO_FILE_TYPES,
14
15
  bubble: true,
15
16
  defaultValue: 'https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true',
16
17
  required: true
17
18
  }, {
18
19
  name: 'posterImage',
19
20
  type: 'file',
20
- allowedFileTypes: ['jpeg', 'png'],
21
+ allowedFileTypes: IMAGE_FILE_TYPES,
21
22
  helperText: 'Image to show before the video plays'
22
23
  }, {
23
24
  name: 'autoPlay',
@@ -4,19 +4,26 @@ import { extractTextStyles } from '../../functions/extract-text-styles';
4
4
  import { getStyle } from '../../functions/get-style';
5
5
  import type { BuilderBlock } from '../../types/builder-block';
6
6
  import type { RepeatData } from './types';
7
+ const checkIsComponentRestricted = (component: RegisteredComponent | null | undefined, model: string) => {
8
+ if (!component) return true;
9
+ if (!model) return false;
10
+ return component.models && component.models.length > 0 && !component.models.includes(model);
11
+ };
7
12
  export const getComponent = ({
8
13
  block,
9
- registeredComponents
14
+ registeredComponents,
15
+ model
10
16
  }: {
11
17
  block: BuilderBlock;
12
18
  registeredComponents: RegisteredComponents;
19
+ model: string;
13
20
  }) => {
14
21
  const componentName = block.component?.name;
15
22
  if (!componentName) {
16
23
  return null;
17
24
  }
18
25
  const ref = registeredComponents[componentName];
19
- if (!ref) {
26
+ if (!ref || checkIsComponentRestricted(ref, model)) {
20
27
  // TODO: Public doc page with more info about this message
21
28
  console.warn(`
22
29
  Could not find a registered component named "${componentName}".
@@ -93,10 +100,15 @@ export const provideLinkComponent = (block: RegisteredComponent | null | undefin
93
100
  };
94
101
  return {};
95
102
  };
96
- export const provideRegisteredComponents = (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents) => {
97
- if (block?.shouldReceiveBuilderProps?.builderComponents) return {
98
- builderComponents: registeredComponents
99
- };
103
+ export const provideRegisteredComponents = (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents, model: string) => {
104
+ if (block?.shouldReceiveBuilderProps?.builderComponents) {
105
+ const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
106
+ return !checkIsComponentRestricted(component, model);
107
+ }));
108
+ return {
109
+ builderComponents: filteredRegisteredComponents
110
+ };
111
+ }
100
112
  return {};
101
113
  };
102
114
  export const provideBuilderBlock = (block: RegisteredComponent | null | undefined, builderBlock: BuilderBlock) => {
@@ -83,6 +83,7 @@ function Block(props: BlockProps) {
83
83
  return getComponent({
84
84
  block: processedBlock(),
85
85
  registeredComponents: props.registeredComponents,
86
+ model: props.context.model,
86
87
  });
87
88
  }
88
89
 
@@ -134,7 +135,8 @@ function Block(props: BlockProps) {
134
135
  ...provideLinkComponent(blockComponent(), props.linkComponent),
135
136
  ...provideRegisteredComponents(
136
137
  blockComponent(),
137
- props.registeredComponents
138
+ props.registeredComponents,
139
+ props.context.model
138
140
  ),
139
141
  },
140
142
  context: {
@@ -1,61 +1,96 @@
1
- import * as React from "react";
1
+ import React, {memo, useContext} from 'react';
2
2
  import {
3
- FlatList,
4
- ScrollView,
5
- View,
6
- StyleSheet,
7
- Image,
8
- Text,
9
- Pressable,
10
- TextInput,
11
- TouchableOpacity,
12
- Button,
13
- Linking,
14
- } from "react-native";
15
- import { useContext } from "react";
3
+ FlatList
4
+ } from "react-native";
5
+
16
6
  import BuilderContext from "../../context/builder.context";
17
7
  import ComponentsContext from "../../context/components.context";
18
8
  import Block from "../block/block";
19
9
  import BlocksWrapper from "./blocks-wrapper";
20
10
  import type { BlocksProps } from "./blocks.types";
21
11
 
22
- function Blocks(props: BlocksProps) {
23
- const builderContext = useContext(BuilderContext);
24
-
25
- const componentsContext = useContext(ComponentsContext);
26
-
27
- return (
28
- <BlocksWrapper
29
- blocks={props.blocks}
30
- parent={props.parent}
31
- path={props.path}
32
- styleProp={props.styleProp}
33
- classNameProp={props.className}
34
- BlocksWrapper={
35
- props.context?.BlocksWrapper || builderContext?.BlocksWrapper
36
- }
37
- BlocksWrapperProps={
38
- props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps
39
- }
40
- >
41
- {props.blocks ? (
42
- <>
43
- {props.blocks?.map((block) => (
44
- <Block
45
- key={block.id}
46
- block={block}
47
- linkComponent={props.linkComponent}
48
- context={props.context || builderContext}
49
- registeredComponents={
50
- props.registeredComponents ||
51
- componentsContext?.registeredComponents
52
- }
53
- />
54
- ))}
55
- </>
56
- ) : null}
57
- </BlocksWrapper>
58
- );
59
- }
60
-
61
- export default Blocks;
12
+ type RenderBlockProps = {
13
+ item: any; // Replace 'any' with your block type
14
+ linkComponent?: React.ComponentType<any>;
15
+ context?: any; // Replace with your context type
16
+ registeredComponents?: any; // Replace with your components type
17
+ };
18
+
19
+ // Moved outside and memoized
20
+ const RenderBlock = memo(({
21
+ item: block,
22
+ linkComponent,
23
+ context,
24
+ registeredComponents
25
+ }: RenderBlockProps) => (
26
+ <Block
27
+ key={block.id}
28
+ block={block}
29
+ linkComponent={linkComponent}
30
+ context={context}
31
+ registeredComponents={registeredComponents}
32
+ />
33
+ ));
34
+
35
+ // Optional: Give the component a display name for better debugging
36
+ RenderBlock.displayName = 'RenderBlock';
37
+
38
+ function Blocks(props: BlocksProps) {
39
+ const builderContext = useContext(BuilderContext);
40
+ const componentsContext = useContext(ComponentsContext);
41
+
42
+ // Memoize renderItem function to prevent unnecessary recreations
43
+ const renderItem = React.useCallback(({ item }: { item: any }) => (
44
+ <RenderBlock
45
+ item={item}
46
+ linkComponent={props.linkComponent}
47
+ context={props.context || builderContext}
48
+ registeredComponents={
49
+ props.registeredComponents || componentsContext?.registeredComponents
50
+ }
51
+ />
52
+ ), [
53
+ props.linkComponent,
54
+ props.context,
55
+ props.registeredComponents,
56
+ builderContext,
57
+ componentsContext?.registeredComponents
58
+ ]);
59
+
60
+ // Memoize keyExtractor
61
+ const keyExtractor = React.useCallback((item: any) =>
62
+ item.id.toString()
63
+ , []);
64
+
65
+ return (
66
+ <BlocksWrapper
67
+ blocks={props.blocks}
68
+ parent={props.parent}
69
+ path={props.path}
70
+ styleProp={props.styleProp}
71
+ classNameProp={props.className}
72
+ BlocksWrapper={
73
+ props.context?.BlocksWrapper || builderContext?.BlocksWrapper
74
+ }
75
+ BlocksWrapperProps={
76
+ props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps
77
+ }
78
+ >
79
+ {props.blocks ? (
80
+ <FlatList
81
+ data={props.blocks}
82
+ renderItem={renderItem}
83
+ keyExtractor={keyExtractor}
84
+ // Optional: Add these props for better performance
85
+ removeClippedSubviews={true}
86
+ maxToRenderPerBatch={10}
87
+ windowSize={5}
88
+ initialNumToRender={5}
89
+ />
90
+ ) : null}
91
+ </BlocksWrapper>
92
+ );
93
+ }
94
+
95
+ // Memoize the entire Blocks component
96
+ export default memo(Blocks);
@@ -0,0 +1,18 @@
1
+ import { TARGET } from '../../../constants/target';
2
+ import { isEditing } from '../../../functions/is-editing';
3
+ import { isPreviewing } from '../../../functions/is-previewing';
4
+ import type { Target } from '../../../types/targets';
5
+
6
+ /**
7
+ * SDKS that use the elementRef approach to enable visual editing.
8
+ * We don't need to render the div for other SDKs as they attach event listeners to the window.
9
+ */
10
+ export const SDKS_USING_ELEMENT_REF_APPROACH = (['svelte', 'qwik', 'vue'] as Target[]);
11
+
12
+ /**
13
+ * We need to attach this div only when content exists or isPreviewing/isEditing even when content is null,
14
+ * as we need to set the elementRef and allow previewing and visual editing
15
+ */
16
+ export const needsElementRefDivForEditing = () => {
17
+ return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
18
+ }