@builder.io/sdk-vue 0.0.1-5 → 0.0.1-52

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 (309) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +48 -0
  3. package/nuxt.js +24 -0
  4. package/nuxt2/src/blocks/button/button.vue +19 -0
  5. package/nuxt2/src/blocks/button/component-info.js +48 -0
  6. package/nuxt2/src/blocks/columns/columns.vue +107 -0
  7. package/nuxt2/src/blocks/columns/component-info.js +224 -0
  8. package/nuxt2/src/blocks/custom-code/component-info.js +38 -0
  9. package/nuxt2/src/blocks/custom-code/custom-code.vue +79 -0
  10. package/nuxt2/src/blocks/embed/component-info.js +31 -0
  11. package/nuxt2/src/blocks/embed/embed.vue +60 -0
  12. package/nuxt2/src/blocks/form/component-info.js +269 -0
  13. package/nuxt2/src/blocks/form/form.vue +310 -0
  14. package/{src/blocks/text_script.js → nuxt2/src/blocks/fragment/component-info.js} +8 -5
  15. package/nuxt2/src/blocks/fragment/fragment.vue +10 -0
  16. package/nuxt2/src/blocks/image/component-info.js +111 -0
  17. package/nuxt2/src/blocks/image/image.vue +101 -0
  18. package/nuxt2/src/blocks/img/component-info.js +27 -0
  19. package/nuxt2/src/blocks/img/img.vue +29 -0
  20. package/nuxt2/src/blocks/input/component-info.js +81 -0
  21. package/nuxt2/src/blocks/input/input.vue +31 -0
  22. package/{src/blocks/submit-button_script.js → nuxt2/src/blocks/raw-text/component-info.js} +13 -5
  23. package/nuxt2/src/blocks/raw-text/raw-text.vue +27 -0
  24. package/nuxt2/src/blocks/section/component-info.js +56 -0
  25. package/nuxt2/src/blocks/section/section.vue +21 -0
  26. package/nuxt2/src/blocks/select/component-info.js +66 -0
  27. package/nuxt2/src/blocks/select/select.vue +28 -0
  28. package/nuxt2/src/blocks/submit-button/component-info.js +35 -0
  29. package/nuxt2/src/blocks/submit-button/submit-button.vue +12 -0
  30. package/nuxt2/src/blocks/symbol/component-info.js +49 -0
  31. package/nuxt2/src/blocks/symbol/symbol.vue +89 -0
  32. package/nuxt2/src/blocks/text/component-info.js +31 -0
  33. package/nuxt2/src/blocks/text/text.vue +10 -0
  34. package/nuxt2/src/blocks/textarea/component-info.js +54 -0
  35. package/nuxt2/src/blocks/textarea/textarea.vue +16 -0
  36. package/nuxt2/src/blocks/video/component-info.js +113 -0
  37. package/nuxt2/src/blocks/video/video.vue +39 -0
  38. package/{src → nuxt2/src}/components/error-boundary.vue +3 -1
  39. package/nuxt2/src/components/render-block/block-styles.vue +44 -0
  40. package/nuxt2/src/components/render-block/render-block.helpers.js +30 -0
  41. package/nuxt2/src/components/render-block/render-block.vue +141 -0
  42. package/nuxt2/src/components/render-blocks.vue +84 -0
  43. package/nuxt2/src/components/render-content/components/render-styles.vue +80 -0
  44. package/{src/blocks/symbol.js → nuxt2/src/components/render-content/index.js} +2 -4
  45. package/nuxt2/src/components/render-content/render-content.vue +300 -0
  46. package/nuxt2/src/components/render-inlined-styles.vue +26 -0
  47. package/nuxt2/src/constants/builder-registered-components.js +66 -0
  48. package/{src → nuxt2/src}/constants/device-sizes.js +0 -0
  49. package/nuxt2/src/constants/target.js +11 -0
  50. package/{src → nuxt2/src}/context/builder.context.js +0 -0
  51. package/{src → nuxt2/src}/functions/evaluate.js +17 -8
  52. package/nuxt2/src/functions/event-handler-name.js +11 -0
  53. package/nuxt2/src/functions/fast-clone.js +11 -0
  54. package/{src → nuxt2/src}/functions/get-block-actions.js +14 -13
  55. package/nuxt2/src/functions/get-block-component-options.js +29 -0
  56. package/{src → nuxt2/src}/functions/get-block-properties.js +0 -0
  57. package/{src → nuxt2/src}/functions/get-block-styles.js +0 -0
  58. package/{src → nuxt2/src}/functions/get-block-tag.js +0 -0
  59. package/nuxt2/src/functions/get-builder-search-params/fn.test.js +31 -0
  60. package/nuxt2/src/functions/get-builder-search-params/index.js +29 -0
  61. package/nuxt2/src/functions/get-content/fn.test.js +49 -0
  62. package/{src/functions/get-content.js → nuxt2/src/functions/get-content/index.js} +82 -46
  63. package/nuxt2/src/functions/get-fetch.js +57 -0
  64. package/nuxt2/src/functions/get-global-this.js +25 -0
  65. package/{src → nuxt2/src}/functions/get-processed-block.js +5 -3
  66. package/{src → nuxt2/src}/functions/get-processed-block.test.js +15 -10
  67. package/nuxt2/src/functions/if-target.js +38 -0
  68. package/nuxt2/src/functions/is-browser.js +13 -0
  69. package/{src → nuxt2/src}/functions/is-editing.js +1 -1
  70. package/{src → nuxt2/src}/functions/is-iframe.js +1 -1
  71. package/nuxt2/src/functions/is-previewing.js +37 -0
  72. package/{src → nuxt2/src}/functions/macro-eval.js +0 -0
  73. package/{src → nuxt2/src}/functions/on-change.js +0 -0
  74. package/{src → nuxt2/src}/functions/on-change.test.js +7 -8
  75. package/{src/functions/is-browser.js → nuxt2/src/functions/previewing-model-name.js} +8 -4
  76. package/{src → nuxt2/src}/functions/register-component.js +31 -13
  77. package/{src → nuxt2/src}/functions/register.js +1 -1
  78. package/{src → nuxt2/src}/functions/set-editor-settings.js +1 -1
  79. package/{src → nuxt2/src}/functions/set.js +0 -0
  80. package/{src → nuxt2/src}/functions/set.test.js +7 -8
  81. package/{src → nuxt2/src}/functions/track.js +7 -3
  82. package/nuxt2/src/functions/transform-block.js +13 -0
  83. package/{src/components/block-styles_script.js → nuxt2/src/index-helpers/blocks-exports.js} +1 -4
  84. package/{src/components/error-boundary_script.js → nuxt2/src/index-helpers/top-of-file.js} +1 -4
  85. package/{src/blocks/input_script.js → nuxt2/src/index.js} +11 -17
  86. package/nuxt2/src/scripts/init-editing.js +98 -0
  87. package/{src → nuxt2/src}/types/builder-block.js +0 -0
  88. package/{src → nuxt2/src}/types/builder-content.js +0 -0
  89. package/{src/types/deep-partial.js → nuxt2/src/types/components.js} +0 -0
  90. package/nuxt2/src/types/deep-partial.js +3 -0
  91. package/nuxt2/src/types/element.js +3 -0
  92. package/nuxt2/src/types/targets.js +3 -0
  93. package/nuxt2/src/types/typescript.js +3 -0
  94. package/package.json +12 -3
  95. package/vue2/src/blocks/button/component-info.js +48 -0
  96. package/vue2/src/blocks/columns/component-info.js +224 -0
  97. package/vue2/src/blocks/custom-code/component-info.js +38 -0
  98. package/vue2/src/blocks/embed/component-info.js +31 -0
  99. package/vue2/src/blocks/form/component-info.js +269 -0
  100. package/vue2/src/blocks/fragment/component-info.js +18 -0
  101. package/vue2/src/blocks/image/component-info.js +111 -0
  102. package/vue2/src/blocks/img/component-info.js +27 -0
  103. package/vue2/src/blocks/input/component-info.js +81 -0
  104. package/vue2/src/blocks/raw-text/component-info.js +23 -0
  105. package/vue2/src/blocks/section/component-info.js +56 -0
  106. package/vue2/src/blocks/select/component-info.js +66 -0
  107. package/vue2/src/blocks/submit-button/component-info.js +35 -0
  108. package/vue2/src/blocks/symbol/component-info.js +49 -0
  109. package/vue2/src/blocks/text/component-info.js +31 -0
  110. package/vue2/src/blocks/textarea/component-info.js +54 -0
  111. package/vue2/src/blocks/video/component-info.js +113 -0
  112. package/vue2/src/components/error-boundary.vue +17 -0
  113. package/vue2/src/components/render-block/render-block.helpers.js +30 -0
  114. package/{src/components/block-styles.js → vue2/src/components/render-content/index.js} +2 -4
  115. package/vue2/src/constants/builder-registered-components.js +66 -0
  116. package/vue2/src/constants/device-sizes.js +46 -0
  117. package/vue2/src/constants/target.js +11 -0
  118. package/vue2/src/context/builder.context.js +11 -0
  119. package/vue2/src/functions/evaluate.js +51 -0
  120. package/vue2/src/functions/event-handler-name.js +11 -0
  121. package/vue2/src/functions/fast-clone.js +11 -0
  122. package/vue2/src/functions/get-block-actions.js +46 -0
  123. package/vue2/src/functions/get-block-component-options.js +29 -0
  124. package/vue2/src/functions/get-block-properties.js +46 -0
  125. package/vue2/src/functions/get-block-styles.js +13 -0
  126. package/{src/functions/if-target.js → vue2/src/functions/get-block-tag.js} +3 -3
  127. package/vue2/src/functions/get-builder-search-params/fn.test.js +31 -0
  128. package/vue2/src/functions/get-builder-search-params/index.js +29 -0
  129. package/vue2/src/functions/get-content/fn.test.js +49 -0
  130. package/vue2/src/functions/get-content/index.js +159 -0
  131. package/vue2/src/functions/get-fetch.js +57 -0
  132. package/vue2/src/functions/get-global-this.js +25 -0
  133. package/vue2/src/functions/get-processed-block.js +67 -0
  134. package/vue2/src/functions/get-processed-block.test.js +49 -0
  135. package/vue2/src/functions/if-target.js +38 -0
  136. package/vue2/src/functions/is-browser.js +13 -0
  137. package/vue2/src/functions/is-editing.js +30 -0
  138. package/vue2/src/functions/is-iframe.js +30 -0
  139. package/vue2/src/functions/is-previewing.js +37 -0
  140. package/{src/functions/get-target.js → vue2/src/functions/macro-eval.js} +2 -3
  141. package/vue2/src/functions/on-change.js +34 -0
  142. package/{src/blocks/img_script.js → vue2/src/functions/on-change.test.js} +18 -19
  143. package/{src/components/error-boundary.js → vue2/src/functions/previewing-model-name.js} +9 -4
  144. package/vue2/src/functions/register-component.js +91 -0
  145. package/vue2/src/functions/register.js +52 -0
  146. package/vue2/src/functions/set-editor-settings.js +38 -0
  147. package/vue2/src/functions/set.js +18 -0
  148. package/{src/components/render-block.js → vue2/src/functions/set.test.js} +15 -10
  149. package/vue2/src/functions/track.js +45 -0
  150. package/vue2/src/functions/transform-block.js +13 -0
  151. package/vue2/src/index-helpers/blocks-exports.js +11 -0
  152. package/vue2/src/index-helpers/top-of-file.js +11 -0
  153. package/{src/blocks/fragment_script.js → vue2/src/index.js} +11 -16
  154. package/vue2/src/scripts/init-editing.js +98 -0
  155. package/vue2/src/types/builder-block.js +3 -0
  156. package/vue2/src/types/builder-content.js +3 -0
  157. package/vue2/src/types/components.js +3 -0
  158. package/vue2/src/types/deep-partial.js +3 -0
  159. package/vue2/src/types/element.js +3 -0
  160. package/vue2/src/types/targets.js +3 -0
  161. package/vue2/src/types/typescript.js +3 -0
  162. package/vue3/src/blocks/button/component-info.js +48 -0
  163. package/vue3/src/blocks/columns/component-info.js +224 -0
  164. package/vue3/src/blocks/custom-code/component-info.js +38 -0
  165. package/vue3/src/blocks/embed/component-info.js +31 -0
  166. package/vue3/src/blocks/form/component-info.js +269 -0
  167. package/vue3/src/blocks/fragment/component-info.js +18 -0
  168. package/vue3/src/blocks/image/component-info.js +111 -0
  169. package/vue3/src/blocks/img/component-info.js +27 -0
  170. package/vue3/src/blocks/input/component-info.js +81 -0
  171. package/vue3/src/blocks/raw-text/component-info.js +23 -0
  172. package/vue3/src/blocks/section/component-info.js +56 -0
  173. package/vue3/src/blocks/select/component-info.js +66 -0
  174. package/vue3/src/blocks/submit-button/component-info.js +35 -0
  175. package/vue3/src/blocks/symbol/component-info.js +49 -0
  176. package/vue3/src/blocks/text/component-info.js +31 -0
  177. package/vue3/src/blocks/textarea/component-info.js +54 -0
  178. package/vue3/src/blocks/video/component-info.js +113 -0
  179. package/vue3/src/components/error-boundary.vue +17 -0
  180. package/vue3/src/components/render-block/render-block.helpers.js +30 -0
  181. package/vue3/src/components/render-content/index.js +27 -0
  182. package/vue3/src/constants/builder-registered-components.js +66 -0
  183. package/vue3/src/constants/device-sizes.js +46 -0
  184. package/vue3/src/constants/target.js +11 -0
  185. package/vue3/src/context/builder.context.js +11 -0
  186. package/vue3/src/functions/evaluate.js +51 -0
  187. package/vue3/src/functions/event-handler-name.js +11 -0
  188. package/vue3/src/functions/fast-clone.js +11 -0
  189. package/vue3/src/functions/get-block-actions.js +46 -0
  190. package/vue3/src/functions/get-block-component-options.js +29 -0
  191. package/vue3/src/functions/get-block-properties.js +46 -0
  192. package/vue3/src/functions/get-block-styles.js +13 -0
  193. package/vue3/src/functions/get-block-tag.js +13 -0
  194. package/vue3/src/functions/get-builder-search-params/fn.test.js +31 -0
  195. package/vue3/src/functions/get-builder-search-params/index.js +29 -0
  196. package/vue3/src/functions/get-content/fn.test.js +49 -0
  197. package/vue3/src/functions/get-content/index.js +159 -0
  198. package/vue3/src/functions/get-fetch.js +57 -0
  199. package/vue3/src/functions/get-global-this.js +25 -0
  200. package/vue3/src/functions/get-processed-block.js +67 -0
  201. package/vue3/src/functions/get-processed-block.test.js +49 -0
  202. package/vue3/src/functions/if-target.js +38 -0
  203. package/vue3/src/functions/is-browser.js +13 -0
  204. package/vue3/src/functions/is-editing.js +30 -0
  205. package/vue3/src/functions/is-iframe.js +30 -0
  206. package/vue3/src/functions/is-previewing.js +37 -0
  207. package/vue3/src/functions/macro-eval.js +12 -0
  208. package/vue3/src/functions/on-change.js +34 -0
  209. package/{src/blocks/fragment.js → vue3/src/functions/on-change.test.js} +18 -12
  210. package/vue3/src/functions/previewing-model-name.js +34 -0
  211. package/vue3/src/functions/register-component.js +91 -0
  212. package/vue3/src/functions/register.js +52 -0
  213. package/vue3/src/functions/set-editor-settings.js +38 -0
  214. package/vue3/src/functions/set.js +18 -0
  215. package/vue3/src/functions/set.test.js +34 -0
  216. package/vue3/src/functions/track.js +45 -0
  217. package/vue3/src/functions/transform-block.js +13 -0
  218. package/vue3/src/index-helpers/blocks-exports.js +11 -0
  219. package/vue3/src/index-helpers/top-of-file.js +11 -0
  220. package/vue3/src/index.js +29 -0
  221. package/vue3/src/scripts/init-editing.js +98 -0
  222. package/vue3/src/types/builder-block.js +3 -0
  223. package/vue3/src/types/builder-content.js +3 -0
  224. package/vue3/src/types/components.js +3 -0
  225. package/vue3/src/types/deep-partial.js +3 -0
  226. package/vue3/src/types/element.js +3 -0
  227. package/vue3/src/types/targets.js +3 -0
  228. package/vue3/src/types/typescript.js +3 -0
  229. package/src/blocks/button.js +0 -31
  230. package/src/blocks/button.original.vue +0 -48
  231. package/src/blocks/button_script.js +0 -40
  232. package/src/blocks/button_styles.js +0 -0
  233. package/src/blocks/columns.js +0 -31
  234. package/src/blocks/columns.original.vue +0 -59
  235. package/src/blocks/columns_script.js +0 -47
  236. package/src/blocks/columns_styles.js +0 -14
  237. package/src/blocks/custom-code.js +0 -31
  238. package/src/blocks/custom-code.original.vue +0 -72
  239. package/src/blocks/custom-code_script.js +0 -59
  240. package/src/blocks/custom-code_styles.js +0 -0
  241. package/src/blocks/embed.js +0 -31
  242. package/src/blocks/embed.original.vue +0 -64
  243. package/src/blocks/embed_script.js +0 -47
  244. package/src/blocks/embed_styles.js +0 -0
  245. package/src/blocks/form.js +0 -31
  246. package/src/blocks/form.original.vue +0 -289
  247. package/src/blocks/form_script.js +0 -267
  248. package/src/blocks/form_styles.js +0 -12
  249. package/src/blocks/fragment.original.vue +0 -28
  250. package/src/blocks/fragment_styles.js +0 -0
  251. package/src/blocks/image.js +0 -31
  252. package/src/blocks/image.original.vue +0 -52
  253. package/src/blocks/image_script.js +0 -38
  254. package/src/blocks/image_styles.js +0 -13
  255. package/src/blocks/img.js +0 -31
  256. package/src/blocks/img.original.vue +0 -31
  257. package/src/blocks/img_styles.js +0 -0
  258. package/src/blocks/input.js +0 -31
  259. package/src/blocks/input.original.vue +0 -28
  260. package/src/blocks/input_styles.js +0 -0
  261. package/src/blocks/raw-text.js +0 -31
  262. package/src/blocks/raw-text.original.vue +0 -35
  263. package/src/blocks/raw-text_script.js +0 -28
  264. package/src/blocks/raw-text_styles.js +0 -0
  265. package/src/blocks/section.js +0 -31
  266. package/src/blocks/section.original.vue +0 -29
  267. package/src/blocks/section_script.js +0 -21
  268. package/src/blocks/section_styles.js +0 -0
  269. package/src/blocks/select.js +0 -31
  270. package/src/blocks/select.original.vue +0 -32
  271. package/src/blocks/select_script.js +0 -39
  272. package/src/blocks/select_styles.js +0 -0
  273. package/src/blocks/submit-button.js +0 -31
  274. package/src/blocks/submit-button.original.vue +0 -27
  275. package/src/blocks/submit-button_styles.js +0 -0
  276. package/src/blocks/symbol.original.vue +0 -33
  277. package/src/blocks/symbol_script.js +0 -38
  278. package/src/blocks/symbol_styles.js +0 -0
  279. package/src/blocks/text.js +0 -31
  280. package/src/blocks/text.original.vue +0 -25
  281. package/src/blocks/text_styles.js +0 -0
  282. package/src/blocks/textarea.js +0 -31
  283. package/src/blocks/textarea.original.vue +0 -25
  284. package/src/blocks/textarea_script.js +0 -15
  285. package/src/blocks/textarea_styles.js +0 -0
  286. package/src/blocks/video.js +0 -31
  287. package/src/blocks/video.original.vue +0 -34
  288. package/src/blocks/video_script.js +0 -26
  289. package/src/blocks/video_styles.js +0 -0
  290. package/src/components/block-styles.original.vue +0 -25
  291. package/src/components/block-styles.vue +0 -34
  292. package/src/components/block-styles_styles.js +0 -0
  293. package/src/components/error-boundary.original.vue +0 -25
  294. package/src/components/error-boundary_styles.js +0 -0
  295. package/src/components/render-block.original.vue +0 -116
  296. package/src/components/render-block_script.js +0 -85
  297. package/src/components/render-block_styles.js +0 -0
  298. package/src/components/render-blocks.js +0 -29
  299. package/src/components/render-blocks.original.vue +0 -75
  300. package/src/components/render-blocks_script.js +0 -80
  301. package/src/components/render-blocks_styles.js +0 -12
  302. package/src/components/render-content.js +0 -29
  303. package/src/components/render-content.original.vue +0 -95
  304. package/src/components/render-content_script.js +0 -93
  305. package/src/components/render-content_styles.js +0 -0
  306. package/src/functions/get-block-component-options.js +0 -14
  307. package/src/functions/is-react-native.js +0 -13
  308. package/src/index.js +0 -51
  309. package/src/scripts/init-editing.js +0 -78
package/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ ### 0.0.1-51
2
+
3
+ ⚠️ Deprecation notice: Registering components via `registerComponent(component, info)` is now deprecated.
4
+ To register your custom components in Builder, you must now provide a `customComponents` array to the `RenderContent` component containing `[{ component, info }]`.
5
+ See [builder-registered-components.ts](/packages/sdks/src/constants/builder-registered-components.ts) for examples of how to do so, or see the example provided for this SDK.
6
+
7
+ ### 0.0.1-50
8
+
9
+ - feat: 🎸 export `isPreviewing()` (https://github.com/BuilderIO/builder/pull/951)
10
+ - feat: 🎸 Add support for Symbols (https://github.com/BuilderIO/builder/pull/951)
11
+ - feat: 🎸 Add support for Data Bindings https://github.com/BuilderIO/builder/pull/970
12
+
13
+ - BREAKING CHANGE: 🧨 RenderContent must now be provided the `apiKey` as a prop (https://github.com/BuilderIO/builder/pull/951)
14
+ ### 0.0.1-49
15
+
16
+ - Fix: show the "+ add block" button on empty pages https://github.com/BuilderIO/builder/pull/934
17
+ - Add `getBuilderSearchParams` helper export to easily view current drafts on your production site. https://github.com/BuilderIO/builder/pull/883
18
+
19
+ ### 0.0.1-48
20
+
21
+ Changes:
22
+
23
+ - Adds support for Columns https://github.com/BuilderIO/builder/pull/717
24
+ - Add preliminary support for Children within custom components https://github.com/BuilderIO/builder/pull/753
25
+ - Seeds classnames to reduce variation in changes https://github.com/BuilderIO/builder/pull/703
26
+ - Fixes `getAllContent` to traverse all symbols/references https://github.com/BuilderIO/builder/pull/718
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Builder.io Vue 2.0 SDK (BETA)
2
+
3
+ This is the 2.0 Vue SDK. It is currently in beta.
4
+
5
+ NOTE: If you are looking for the stable 1.0 Vue SDK, you can find it [here](/packages/vue)
6
+
7
+ ## Feature Support
8
+
9
+ To check the status of the SDK, look at [these tables](../../README.md#feature-implementation).
10
+
11
+ ## Version Support
12
+
13
+ Legend:
14
+
15
+ - ✅: implemented
16
+ - 🏗: currently in progress
17
+ - ⚠️: not-yet implemented
18
+ - N/A : does not apply
19
+
20
+ | Platform | Support |
21
+ | -------- | ------- |
22
+ | Vue 2 | 🏗 |
23
+ | Nuxt 2 | 🏗 |
24
+ | Vue 3 | ⚠️ |
25
+ | Nuxt 3 | ⚠️ |
26
+
27
+ ## Getting Started
28
+
29
+ ```
30
+ npm install @builder.io/sdk-vue@dev
31
+ ```
32
+
33
+ ## Usage with Nuxt
34
+
35
+ > Requires nuxt >= @2.15
36
+
37
+ Add to your `nuxt.config.js`:
38
+
39
+ ```js
40
+ buildModules: ['@builder.io/sdk-vue/nuxt'];
41
+ ```
42
+
43
+ Then register built in and custom components as seen [here](/examples/vue/nuxt-2/scripts/register-builder-components.js)
44
+
45
+ You can see examples of using Builder.io:
46
+
47
+ - with Nuxt [here](/examples/vue/nuxt-2/)
48
+ - with Vue Storefront [here](/examples/vue/vue-storefront-2)
package/nuxt.js ADDED
@@ -0,0 +1,24 @@
1
+ import { join } from 'path';
2
+
3
+ export default function () {
4
+ // Make sure components is enabled
5
+ if (!this.nuxt.options.components) {
6
+ throw new Error(
7
+ 'Please set `components: true` inside `nuxt.config` and ensure using `nuxt >= 2.13.0`'
8
+ );
9
+ }
10
+
11
+ this.nuxt.hook('components:dirs', (dirs) => {
12
+ // Add ./components dir to the list
13
+ dirs.push({
14
+ path: join(__dirname, 'nuxt2/src/components'),
15
+ prefix: 'builder',
16
+ });
17
+ // Add ./blocks dir to the list
18
+ dirs.push({
19
+ path: join(__dirname, 'nuxt2/src/blocks'),
20
+ prefix: 'builder',
21
+ pattern: "**/index.*",
22
+ });
23
+ });
24
+ }
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <a
3
+ v-bind="attributes"
4
+ role="button"
5
+ v-if="link"
6
+ :href="link"
7
+ :target="openLinkInNewTab ? '_blank' : undefined"
8
+ >
9
+ {{ text }}
10
+ </a>
11
+ <span v-bind="attributes" v-else="">{{ text }}</span>
12
+ </template>
13
+ <script>
14
+ export default {
15
+ name: "builder-button",
16
+
17
+ props: ["attributes", "text", "link", "openLinkInNewTab"],
18
+ };
19
+ </script>
@@ -0,0 +1,48 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
+ var __export = (target, all) => {
4
+ __markAsModule(target);
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+ __export(exports, {
9
+ componentInfo: () => componentInfo
10
+ });
11
+ const componentInfo = {
12
+ name: "Core:Button",
13
+ builtIn: true,
14
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
15
+ defaultStyles: {
16
+ appearance: "none",
17
+ paddingTop: "15px",
18
+ paddingBottom: "15px",
19
+ paddingLeft: "25px",
20
+ paddingRight: "25px",
21
+ backgroundColor: "#000000",
22
+ color: "white",
23
+ borderRadius: "4px",
24
+ textAlign: "center",
25
+ cursor: "pointer"
26
+ },
27
+ inputs: [
28
+ {
29
+ name: "text",
30
+ type: "text",
31
+ defaultValue: "Click me!",
32
+ bubble: true
33
+ },
34
+ {
35
+ name: "link",
36
+ type: "url",
37
+ bubble: true
38
+ },
39
+ {
40
+ name: "openLinkInNewTab",
41
+ type: "boolean",
42
+ defaultValue: false,
43
+ friendlyName: "Open link in new tab"
44
+ }
45
+ ],
46
+ static: true,
47
+ noWrap: true
48
+ };
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div class="builder-columns div-4wbls88y960" :style="columnsCssVars">
3
+ <div
4
+ class="builder-column div-4wbls88y960-2"
5
+ v-for="(column, index) in columns"
6
+ :style="{
7
+ width: getColumnCssWidth(index),
8
+ marginLeft: `${index === 0 ? 0 : getGutterSize()}px`,
9
+ ...columnCssVars,
10
+ }"
11
+ :key="index"
12
+ >
13
+ <render-blocks :blocks="column.blocks"></render-blocks>
14
+ </div>
15
+ </div>
16
+ </template>
17
+ <script>
18
+ import RenderBlocks from "../../components/render-blocks";
19
+
20
+ export default {
21
+ name: "builder-columns",
22
+ components: { "render-blocks": async () => RenderBlocks },
23
+ props: ["space", "columns", "stackColumnsAt", "reverseColumnsWhenStacked"],
24
+
25
+ computed: {
26
+ columnsCssVars() {
27
+ const flexDir =
28
+ this.stackColumnsAt === "never"
29
+ ? "inherit"
30
+ : this.reverseColumnsWhenStacked
31
+ ? "column-reverse"
32
+ : "column";
33
+ return {
34
+ "--flex-dir": flexDir,
35
+ "--flex-dir-tablet": this.maybeApplyForTablet(flexDir),
36
+ };
37
+ },
38
+ columnCssVars() {
39
+ const width = "100%";
40
+ const marginLeft = "0";
41
+ return {
42
+ "--column-width": width,
43
+ "--column-margin-left": marginLeft,
44
+ "--column-width-tablet": this.maybeApplyForTablet(width),
45
+ "--column-margin-left-tablet": this.maybeApplyForTablet(marginLeft),
46
+ };
47
+ },
48
+ },
49
+
50
+ methods: {
51
+ getGutterSize() {
52
+ return typeof this.space === "number" ? this.space || 0 : 20;
53
+ },
54
+ getColumns() {
55
+ return this.columns || [];
56
+ },
57
+ getWidth(index) {
58
+ const columns = this.getColumns();
59
+ return columns[index]?.width || 100 / columns.length;
60
+ },
61
+ getColumnCssWidth(index) {
62
+ const columns = this.getColumns();
63
+ const gutterSize = this.getGutterSize();
64
+ const subtractWidth =
65
+ (gutterSize * (columns.length - 1)) / columns.length;
66
+ return `calc(${this.getWidth(index)}% - ${subtractWidth}px)`;
67
+ },
68
+ maybeApplyForTablet(prop) {
69
+ const _stackColumnsAt = this.stackColumnsAt || "tablet";
70
+
71
+ return _stackColumnsAt === "tablet" ? prop : "inherit";
72
+ },
73
+ },
74
+ };
75
+ </script>
76
+ <style scoped>
77
+ .div-4wbls88y960 {
78
+ display: flex;
79
+ align-items: stretch;
80
+ line-height: normal;
81
+ }
82
+ @media (max-width: 999px) {
83
+ .div-4wbls88y960 {
84
+ flex-direction: var(--flex-dir-tablet);
85
+ }
86
+ }
87
+ @media (max-width: 639px) {
88
+ .div-4wbls88y960 {
89
+ flex-direction: var(--flex-dir);
90
+ }
91
+ }
92
+ .div-4wbls88y960-2 {
93
+ flex-grow: 1;
94
+ }
95
+ @media (max-width: 999px) {
96
+ .div-4wbls88y960-2 {
97
+ width: var(--column-width-tablet) !important;
98
+ margin-left: var(--column-margin-left-tablet) !important;
99
+ }
100
+ }
101
+ @media (max-width: 639px) {
102
+ .div-4wbls88y960-2 {
103
+ width: var(--column-width) !important;
104
+ margin-left: var(--column-margin-left) !important;
105
+ }
106
+ }
107
+ </style>
@@ -0,0 +1,224 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
+ var __export = (target, all) => {
4
+ __markAsModule(target);
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+ __export(exports, {
9
+ componentInfo: () => componentInfo
10
+ });
11
+ const componentInfo = {
12
+ name: "Columns",
13
+ builtIn: true,
14
+ inputs: [
15
+ {
16
+ name: "columns",
17
+ type: "array",
18
+ broadcast: true,
19
+ subFields: [
20
+ {
21
+ name: "blocks",
22
+ type: "array",
23
+ hideFromUI: true,
24
+ defaultValue: [
25
+ {
26
+ "@type": "@builder.io/sdk:Element",
27
+ responsiveStyles: {
28
+ large: {
29
+ display: "flex",
30
+ flexDirection: "column",
31
+ alignItems: "stretch",
32
+ flexShrink: "0",
33
+ position: "relative",
34
+ marginTop: "30px",
35
+ textAlign: "center",
36
+ lineHeight: "normal",
37
+ height: "auto",
38
+ minHeight: "20px",
39
+ minWidth: "20px",
40
+ overflow: "hidden"
41
+ }
42
+ },
43
+ component: {
44
+ name: "Image",
45
+ options: {
46
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
47
+ backgroundPosition: "center",
48
+ backgroundSize: "cover",
49
+ aspectRatio: 0.7004048582995948
50
+ }
51
+ }
52
+ },
53
+ {
54
+ "@type": "@builder.io/sdk:Element",
55
+ responsiveStyles: {
56
+ large: {
57
+ display: "flex",
58
+ flexDirection: "column",
59
+ alignItems: "stretch",
60
+ flexShrink: "0",
61
+ position: "relative",
62
+ marginTop: "30px",
63
+ textAlign: "center",
64
+ lineHeight: "normal",
65
+ height: "auto"
66
+ }
67
+ },
68
+ component: {
69
+ name: "Text",
70
+ options: {
71
+ text: "<p>Enter some text...</p>"
72
+ }
73
+ }
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ name: "width",
79
+ type: "number",
80
+ hideFromUI: true,
81
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
82
+ },
83
+ {
84
+ name: "link",
85
+ type: "url",
86
+ helperText: "Optionally set a url that clicking this column will link to"
87
+ }
88
+ ],
89
+ defaultValue: [
90
+ {
91
+ blocks: [
92
+ {
93
+ "@type": "@builder.io/sdk:Element",
94
+ responsiveStyles: {
95
+ large: {
96
+ display: "flex",
97
+ flexDirection: "column",
98
+ alignItems: "stretch",
99
+ flexShrink: "0",
100
+ position: "relative",
101
+ marginTop: "30px",
102
+ textAlign: "center",
103
+ lineHeight: "normal",
104
+ height: "auto",
105
+ minHeight: "20px",
106
+ minWidth: "20px",
107
+ overflow: "hidden"
108
+ }
109
+ },
110
+ component: {
111
+ name: "Image",
112
+ options: {
113
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
114
+ backgroundPosition: "center",
115
+ backgroundSize: "cover",
116
+ aspectRatio: 0.7004048582995948
117
+ }
118
+ }
119
+ },
120
+ {
121
+ "@type": "@builder.io/sdk:Element",
122
+ responsiveStyles: {
123
+ large: {
124
+ display: "flex",
125
+ flexDirection: "column",
126
+ alignItems: "stretch",
127
+ flexShrink: "0",
128
+ position: "relative",
129
+ marginTop: "30px",
130
+ textAlign: "center",
131
+ lineHeight: "normal",
132
+ height: "auto"
133
+ }
134
+ },
135
+ component: {
136
+ name: "Text",
137
+ options: {
138
+ text: "<p>Enter some text...</p>"
139
+ }
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ blocks: [
146
+ {
147
+ "@type": "@builder.io/sdk:Element",
148
+ responsiveStyles: {
149
+ large: {
150
+ display: "flex",
151
+ flexDirection: "column",
152
+ alignItems: "stretch",
153
+ flexShrink: "0",
154
+ position: "relative",
155
+ marginTop: "30px",
156
+ textAlign: "center",
157
+ lineHeight: "normal",
158
+ height: "auto",
159
+ minHeight: "20px",
160
+ minWidth: "20px",
161
+ overflow: "hidden"
162
+ }
163
+ },
164
+ component: {
165
+ name: "Image",
166
+ options: {
167
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
168
+ backgroundPosition: "center",
169
+ backgroundSize: "cover",
170
+ aspectRatio: 0.7004048582995948
171
+ }
172
+ }
173
+ },
174
+ {
175
+ "@type": "@builder.io/sdk:Element",
176
+ responsiveStyles: {
177
+ large: {
178
+ display: "flex",
179
+ flexDirection: "column",
180
+ alignItems: "stretch",
181
+ flexShrink: "0",
182
+ position: "relative",
183
+ marginTop: "30px",
184
+ textAlign: "center",
185
+ lineHeight: "normal",
186
+ height: "auto"
187
+ }
188
+ },
189
+ component: {
190
+ name: "Text",
191
+ options: {
192
+ text: "<p>Enter some text...</p>"
193
+ }
194
+ }
195
+ }
196
+ ]
197
+ }
198
+ ],
199
+ onChange: " function clearWidths() { columns.forEach(col => { col.delete('width'); }); } const columns = options.get('columns') as Array<Map<String, any>>; if (Array.isArray(columns)) { const containsColumnWithWidth = !!columns.find(col => col.get('width')); if (containsColumnWithWidth) { const containsColumnWithoutWidth = !!columns.find(col => !col.get('width')); if (containsColumnWithoutWidth) { clearWidths(); } else { const sumWidths = columns.reduce((memo, col) => { return memo + col.get('width'); }, 0); const widthsDontAddUp = sumWidths !== 100; if (widthsDontAddUp) { clearWidths(); } } } } "
200
+ },
201
+ {
202
+ name: "space",
203
+ type: "number",
204
+ defaultValue: 20,
205
+ helperText: "Size of gap between columns",
206
+ advanced: true
207
+ },
208
+ {
209
+ name: "stackColumnsAt",
210
+ type: "string",
211
+ defaultValue: "tablet",
212
+ helperText: "Convert horizontal columns to vertical at what device size",
213
+ enum: ["tablet", "mobile", "never"],
214
+ advanced: true
215
+ },
216
+ {
217
+ name: "reverseColumnsWhenStacked",
218
+ type: "boolean",
219
+ defaultValue: false,
220
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
221
+ advanced: true
222
+ }
223
+ ]
224
+ };
@@ -0,0 +1,38 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
+ var __export = (target, all) => {
4
+ __markAsModule(target);
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+ __export(exports, {
9
+ componentInfo: () => componentInfo
10
+ });
11
+ const componentInfo = {
12
+ name: "Custom Code",
13
+ static: true,
14
+ builtIn: true,
15
+ requiredPermissions: ["editCode"],
16
+ inputs: [
17
+ {
18
+ name: "code",
19
+ type: "html",
20
+ required: true,
21
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
22
+ code: true
23
+ },
24
+ {
25
+ name: "replaceNodes",
26
+ type: "boolean",
27
+ helperText: "Preserve server rendered dom nodes",
28
+ advanced: true
29
+ },
30
+ {
31
+ name: "scriptsClientOnly",
32
+ type: "boolean",
33
+ defaultValue: false,
34
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
35
+ advanced: true
36
+ }
37
+ ]
38
+ };
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <div
3
+ ref="elem"
4
+ :class="
5
+ _classStringToObject(
6
+ 'builder-custom-code' + (this.replaceNodes ? ' replace-nodes' : '')
7
+ )
8
+ "
9
+ v-html="code"
10
+ ></div>
11
+ </template>
12
+ <script>
13
+ export default {
14
+ name: "builder-custom-code",
15
+
16
+ props: ["replaceNodes", "code"],
17
+
18
+ data: () => ({ scriptsInserted: [], scriptsRun: [] }),
19
+
20
+ mounted() {
21
+ this.findAndRunScripts();
22
+ },
23
+
24
+ methods: {
25
+ findAndRunScripts() {
26
+ // TODO: Move this function to standalone one in '@builder.io/utils'
27
+ if (this.$refs.elem && typeof window !== "undefined") {
28
+ /** @type {HTMLScriptElement[]} */
29
+ const scripts = this.$refs.elem.getElementsByTagName("script");
30
+
31
+ for (let i = 0; i < scripts.length; i++) {
32
+ const script = scripts[i];
33
+
34
+ if (script.src) {
35
+ if (this.scriptsInserted.includes(script.src)) {
36
+ continue;
37
+ }
38
+
39
+ this.scriptsInserted.push(script.src);
40
+ const newScript = document.createElement("script");
41
+ newScript.async = true;
42
+ newScript.src = script.src;
43
+ document.head.appendChild(newScript);
44
+ } else if (
45
+ !script.type ||
46
+ [
47
+ "text/javascript",
48
+ "application/javascript",
49
+ "application/ecmascript",
50
+ ].includes(script.type)
51
+ ) {
52
+ if (this.scriptsRun.includes(script.innerText)) {
53
+ continue;
54
+ }
55
+
56
+ try {
57
+ this.scriptsRun.push(script.innerText);
58
+ new Function(script.innerText)();
59
+ } catch (error) {
60
+ console.warn("`CustomCode`: Error running script:", error);
61
+ }
62
+ }
63
+ }
64
+ }
65
+ },
66
+ _classStringToObject(str) {
67
+ const obj = {};
68
+ if (typeof str !== "string") {
69
+ return obj;
70
+ }
71
+ const classNames = str.trim().split(/\s+/);
72
+ for (const name of classNames) {
73
+ obj[name] = true;
74
+ }
75
+ return obj;
76
+ },
77
+ },
78
+ };
79
+ </script>
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
3
+ var __export = (target, all) => {
4
+ __markAsModule(target);
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+ __export(exports, {
9
+ componentInfo: () => componentInfo
10
+ });
11
+ const componentInfo = {
12
+ name: "Embed",
13
+ static: true,
14
+ builtIn: true,
15
+ inputs: [
16
+ {
17
+ name: "url",
18
+ type: "url",
19
+ required: true,
20
+ defaultValue: "",
21
+ helperText: "e.g. enter a youtube url, google map, etc",
22
+ onChange: " const url = options.get('url'); if (url) { options.set('content', 'Loading...'); // TODO: get this out of here! const apiKey = 'ae0e60e78201a3f2b0de4b'; return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`) .then(res => res.json()) .then(data => { if (options.get('url') === url) { if (data.html) { options.set('content', data.html); } else { options.set('content', 'Invalid url, please try another'); } } }) .catch(err => { options.set( 'content', 'There was an error embedding this URL, please try again or another URL' ); }); } else { options.delete('content'); } "
23
+ },
24
+ {
25
+ name: "content",
26
+ type: "html",
27
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
28
+ hideFromUI: true
29
+ }
30
+ ]
31
+ };