@builder.io/sdk-react-nextjs 0.5.8 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-29f9ac5c.js +23 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-dfa97c43.mjs +664 -0
  3. package/lib/browser/USE_SERVER_BUNDLE-25e181fa.js +1 -0
  4. package/lib/browser/USE_SERVER_BUNDLE-fcd44ecb.mjs +11 -0
  5. package/lib/browser/bundle-5cab6113.js +76 -0
  6. package/lib/browser/bundle-babbd573.mjs +2419 -0
  7. package/lib/browser/index.cjs +1 -0
  8. package/lib/browser/index.mjs +34 -0
  9. package/lib/edge/USE_CLIENT_BUNDLE-3cbb02d5.mjs +664 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-d0b99f60.js +23 -0
  11. package/lib/edge/USE_SERVER_BUNDLE-4eeb4634.mjs +11 -0
  12. package/lib/edge/USE_SERVER_BUNDLE-bbd89085.js +1 -0
  13. package/lib/edge/bundle-9ed99f98.mjs +4863 -0
  14. package/lib/edge/bundle-e4764e2a.js +96 -0
  15. package/lib/edge/index.cjs +1 -0
  16. package/lib/edge/index.mjs +34 -0
  17. package/lib/node/USE_CLIENT_BUNDLE-29f9ac5c.js +23 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-dfa97c43.mjs +664 -0
  19. package/lib/node/USE_SERVER_BUNDLE-25e181fa.js +1 -0
  20. package/lib/node/USE_SERVER_BUNDLE-fcd44ecb.mjs +11 -0
  21. package/lib/node/bundle-5cab6113.js +76 -0
  22. package/lib/node/bundle-babbd573.mjs +2419 -0
  23. package/lib/node/index.cjs +1 -0
  24. package/lib/node/index.mjs +34 -0
  25. package/package.json +96 -13
  26. package/{dist → types}/components/content/content.types.d.ts +2 -2
  27. package/{dist → types}/components/content-variants/content-variants.d.ts +2 -2
  28. package/{dist → types}/components/content-variants/content-variants.types.d.ts +1 -1
  29. package/types/constants/sdk-version.d.ts +1 -0
  30. package/types/functions/deopt.d.ts +4 -0
  31. package/types/functions/evaluate/browser-runtime/browser.d.ts +4 -0
  32. package/types/functions/evaluate/browser-runtime/index.d.ts +1 -0
  33. package/types/functions/evaluate/evaluate.d.ts +6 -0
  34. package/types/functions/evaluate/helpers.d.ts +18 -0
  35. package/types/functions/evaluate/index.d.ts +1 -0
  36. package/{dist → types}/functions/fetch-builder-props.d.ts +4 -3
  37. package/{dist → types}/functions/get-content/index.d.ts +4 -5
  38. package/{dist → types}/index-helpers/blocks-exports.d.ts +2 -2
  39. package/types/index.d.ts +7 -0
  40. package/{dist/index.d.ts → types/server-index.d.ts} +0 -1
  41. package/dist/blocks/button/button.js +0 -12
  42. package/dist/blocks/button/component-info.js +0 -34
  43. package/dist/blocks/columns/columns.js +0 -119
  44. package/dist/blocks/columns/component-info.js +0 -219
  45. package/dist/blocks/custom-code/component-info.js +0 -23
  46. package/dist/blocks/custom-code/custom-code.js +0 -51
  47. package/dist/blocks/embed/component-info.js +0 -39
  48. package/dist/blocks/embed/embed.js +0 -42
  49. package/dist/blocks/embed/helpers.js +0 -2
  50. package/dist/blocks/fragment/component-info.js +0 -7
  51. package/dist/blocks/fragment/fragment.js +0 -6
  52. package/dist/blocks/helpers.js +0 -40
  53. package/dist/blocks/image/component-info.js +0 -122
  54. package/dist/blocks/image/image.helpers.js +0 -47
  55. package/dist/blocks/image/image.js +0 -82
  56. package/dist/blocks/img/component-info.js +0 -15
  57. package/dist/blocks/img/img.js +0 -10
  58. package/dist/blocks/section/component-info.js +0 -40
  59. package/dist/blocks/section/section.js +0 -17
  60. package/dist/blocks/symbol/component-info.js +0 -34
  61. package/dist/blocks/symbol/symbol.helpers.js +0 -31
  62. package/dist/blocks/symbol/symbol.js +0 -29
  63. package/dist/blocks/text/component-info.js +0 -19
  64. package/dist/blocks/text/text.js +0 -7
  65. package/dist/blocks/video/component-info.js +0 -82
  66. package/dist/blocks/video/video.js +0 -50
  67. package/dist/components/block/block.helpers.js +0 -69
  68. package/dist/components/block/block.js +0 -92
  69. package/dist/components/block/components/block-styles.js +0 -65
  70. package/dist/components/block/components/block-wrapper.js +0 -36
  71. package/dist/components/block/components/component-ref/component-ref.helpers.js +0 -22
  72. package/dist/components/block/components/component-ref/component-ref.js +0 -21
  73. package/dist/components/block/components/interactive-element.js +0 -20
  74. package/dist/components/block/components/repeated-block.js +0 -7
  75. package/dist/components/block/types.js +0 -1
  76. package/dist/components/blocks/blocks-wrapper.js +0 -38
  77. package/dist/components/blocks/blocks.js +0 -10
  78. package/dist/components/content/components/enable-editor.js +0 -250
  79. package/dist/components/content/components/styles.helpers.js +0 -58
  80. package/dist/components/content/components/styles.js +0 -30
  81. package/dist/components/content/content.helpers.js +0 -30
  82. package/dist/components/content/content.js +0 -74
  83. package/dist/components/content/content.types.js +0 -1
  84. package/dist/components/content/wrap-component-ref.js +0 -6
  85. package/dist/components/content-variants/content-variants.js +0 -45
  86. package/dist/components/content-variants/content-variants.types.js +0 -1
  87. package/dist/components/content-variants/helpers.js +0 -189
  88. package/dist/components/inlined-script.js +0 -5
  89. package/dist/components/inlined-styles.js +0 -5
  90. package/dist/constants/builder-registered-components.js +0 -60
  91. package/dist/constants/device-sizes.js +0 -45
  92. package/dist/constants/sdk-version.d.ts +0 -1
  93. package/dist/constants/sdk-version.js +0 -1
  94. package/dist/constants/target.js +0 -2
  95. package/dist/context/builder.context.js +0 -12
  96. package/dist/context/components.context.js +0 -2
  97. package/dist/context/types.js +0 -1
  98. package/dist/functions/camel-to-kebab-case.js +0 -1
  99. package/dist/functions/evaluate/acorn-interpreter.d.ts +0 -2
  100. package/dist/functions/evaluate/acorn-interpreter.js +0 -3111
  101. package/dist/functions/evaluate/evaluate.d.ts +0 -10
  102. package/dist/functions/evaluate/evaluate.js +0 -70
  103. package/dist/functions/evaluate/index.d.ts +0 -1
  104. package/dist/functions/evaluate/index.js +0 -1
  105. package/dist/functions/evaluate/non-node-runtime/index.d.ts +0 -1
  106. package/dist/functions/evaluate/non-node-runtime/index.js +0 -2
  107. package/dist/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
  108. package/dist/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -84
  109. package/dist/functions/evaluate/types.d.ts +0 -11
  110. package/dist/functions/evaluate/types.js +0 -1
  111. package/dist/functions/event-handler-name.js +0 -4
  112. package/dist/functions/extract-text-styles.js +0 -22
  113. package/dist/functions/fast-clone.js +0 -4
  114. package/dist/functions/fetch-builder-props.js +0 -25
  115. package/dist/functions/get-block-actions-handler.js +0 -10
  116. package/dist/functions/get-block-actions.js +0 -28
  117. package/dist/functions/get-block-component-options.js +0 -10
  118. package/dist/functions/get-block-properties.js +0 -72
  119. package/dist/functions/get-builder-search-params/index.js +0 -38
  120. package/dist/functions/get-content/generate-content-url.js +0 -33
  121. package/dist/functions/get-content/index.js +0 -100
  122. package/dist/functions/get-content/types.js +0 -1
  123. package/dist/functions/get-fetch.js +0 -11
  124. package/dist/functions/get-global-this.js +0 -15
  125. package/dist/functions/get-processed-block.js +0 -46
  126. package/dist/functions/get-react-native-block-styles.js +0 -17
  127. package/dist/functions/is-browser.js +0 -3
  128. package/dist/functions/is-editing.js +0 -5
  129. package/dist/functions/is-iframe.js +0 -4
  130. package/dist/functions/is-non-node-server.d.ts +0 -4
  131. package/dist/functions/is-non-node-server.js +0 -8
  132. package/dist/functions/is-previewing.js +0 -11
  133. package/dist/functions/register-component.js +0 -38
  134. package/dist/functions/register.js +0 -27
  135. package/dist/functions/sanitize-react-native-block-styles.js +0 -61
  136. package/dist/functions/set-editor-settings.js +0 -12
  137. package/dist/functions/set.js +0 -14
  138. package/dist/functions/track/helpers.js +0 -51
  139. package/dist/functions/track/index.js +0 -71
  140. package/dist/functions/track/interaction.js +0 -53
  141. package/dist/functions/transform-block-properties.js +0 -5
  142. package/dist/functions/transform-block.js +0 -4
  143. package/dist/helpers/ab-tests.js +0 -122
  144. package/dist/helpers/canTrack.js +0 -2
  145. package/dist/helpers/cookie.js +0 -55
  146. package/dist/helpers/css.js +0 -27
  147. package/dist/helpers/flatten.js +0 -19
  148. package/dist/helpers/localStorage.js +0 -24
  149. package/dist/helpers/logger.js +0 -7
  150. package/dist/helpers/nullable.js +0 -1
  151. package/dist/helpers/preview-lru-cache/get.js +0 -9
  152. package/dist/helpers/preview-lru-cache/helpers.js +0 -9
  153. package/dist/helpers/preview-lru-cache/init.js +0 -15
  154. package/dist/helpers/preview-lru-cache/set.js +0 -7
  155. package/dist/helpers/preview-lru-cache/types.js +0 -6
  156. package/dist/helpers/sessionId.js +0 -30
  157. package/dist/helpers/url.js +0 -15
  158. package/dist/helpers/uuid.js +0 -15
  159. package/dist/helpers/visitorId.js +0 -30
  160. package/dist/index-helpers/blocks-exports.js +0 -19
  161. package/dist/index-helpers/top-of-file.js +0 -4
  162. package/dist/index.js +0 -11
  163. package/dist/scripts/init-editing.js +0 -110
  164. package/dist/types/api-version.js +0 -1
  165. package/dist/types/builder-block.js +0 -1
  166. package/dist/types/builder-content.js +0 -1
  167. package/dist/types/builder-props.js +0 -1
  168. package/dist/types/can-track.js +0 -1
  169. package/dist/types/components.js +0 -1
  170. package/dist/types/deep-partial.js +0 -1
  171. package/dist/types/element.js +0 -1
  172. package/dist/types/enforced-partials.js +0 -1
  173. package/dist/types/input.js +0 -1
  174. package/dist/types/targets.js +0 -1
  175. package/dist/types/typescript.js +0 -1
  176. /package/{dist → types}/blocks/button/button.d.ts +0 -0
  177. /package/{dist → types}/blocks/button/component-info.d.ts +0 -0
  178. /package/{dist → types}/blocks/columns/columns.d.ts +0 -0
  179. /package/{dist → types}/blocks/columns/component-info.d.ts +0 -0
  180. /package/{dist → types}/blocks/custom-code/component-info.d.ts +0 -0
  181. /package/{dist → types}/blocks/custom-code/custom-code.d.ts +0 -0
  182. /package/{dist → types}/blocks/embed/component-info.d.ts +0 -0
  183. /package/{dist → types}/blocks/embed/embed.d.ts +0 -0
  184. /package/{dist → types}/blocks/embed/helpers.d.ts +0 -0
  185. /package/{dist → types}/blocks/fragment/component-info.d.ts +0 -0
  186. /package/{dist → types}/blocks/fragment/fragment.d.ts +0 -0
  187. /package/{dist → types}/blocks/helpers.d.ts +0 -0
  188. /package/{dist → types}/blocks/image/component-info.d.ts +0 -0
  189. /package/{dist → types}/blocks/image/image.d.ts +0 -0
  190. /package/{dist → types}/blocks/image/image.helpers.d.ts +0 -0
  191. /package/{dist → types}/blocks/img/component-info.d.ts +0 -0
  192. /package/{dist → types}/blocks/img/img.d.ts +0 -0
  193. /package/{dist → types}/blocks/section/component-info.d.ts +0 -0
  194. /package/{dist → types}/blocks/section/section.d.ts +0 -0
  195. /package/{dist → types}/blocks/symbol/component-info.d.ts +0 -0
  196. /package/{dist → types}/blocks/symbol/symbol.d.ts +0 -0
  197. /package/{dist → types}/blocks/symbol/symbol.helpers.d.ts +0 -0
  198. /package/{dist → types}/blocks/text/component-info.d.ts +0 -0
  199. /package/{dist → types}/blocks/text/text.d.ts +0 -0
  200. /package/{dist → types}/blocks/video/component-info.d.ts +0 -0
  201. /package/{dist → types}/blocks/video/video.d.ts +0 -0
  202. /package/{dist → types}/components/block/block.d.ts +0 -0
  203. /package/{dist → types}/components/block/block.helpers.d.ts +0 -0
  204. /package/{dist → types}/components/block/components/block-styles.d.ts +0 -0
  205. /package/{dist → types}/components/block/components/block-wrapper.d.ts +0 -0
  206. /package/{dist → types}/components/block/components/component-ref/component-ref.d.ts +0 -0
  207. /package/{dist → types}/components/block/components/component-ref/component-ref.helpers.d.ts +0 -0
  208. /package/{dist → types}/components/block/components/interactive-element.d.ts +0 -0
  209. /package/{dist → types}/components/block/components/repeated-block.d.ts +0 -0
  210. /package/{dist → types}/components/block/types.d.ts +0 -0
  211. /package/{dist → types}/components/blocks/blocks-wrapper.d.ts +0 -0
  212. /package/{dist → types}/components/blocks/blocks.d.ts +0 -0
  213. /package/{dist → types}/components/content/components/enable-editor.d.ts +0 -0
  214. /package/{dist → types}/components/content/components/styles.d.ts +0 -0
  215. /package/{dist → types}/components/content/components/styles.helpers.d.ts +0 -0
  216. /package/{dist → types}/components/content/content.d.ts +0 -0
  217. /package/{dist → types}/components/content/content.helpers.d.ts +0 -0
  218. /package/{dist → types}/components/content/wrap-component-ref.d.ts +0 -0
  219. /package/{dist → types}/components/content-variants/helpers.d.ts +0 -0
  220. /package/{dist → types}/components/inlined-script.d.ts +0 -0
  221. /package/{dist → types}/components/inlined-styles.d.ts +0 -0
  222. /package/{dist → types}/constants/builder-registered-components.d.ts +0 -0
  223. /package/{dist → types}/constants/device-sizes.d.ts +0 -0
  224. /package/{dist → types}/constants/target.d.ts +0 -0
  225. /package/{dist → types}/context/builder.context.d.ts +0 -0
  226. /package/{dist → types}/context/components.context.d.ts +0 -0
  227. /package/{dist → types}/context/types.d.ts +0 -0
  228. /package/{dist → types}/functions/camel-to-kebab-case.d.ts +0 -0
  229. /package/{dist → types}/functions/event-handler-name.d.ts +0 -0
  230. /package/{dist → types}/functions/extract-text-styles.d.ts +0 -0
  231. /package/{dist → types}/functions/fast-clone.d.ts +0 -0
  232. /package/{dist → types}/functions/get-block-actions-handler.d.ts +0 -0
  233. /package/{dist → types}/functions/get-block-actions.d.ts +0 -0
  234. /package/{dist → types}/functions/get-block-component-options.d.ts +0 -0
  235. /package/{dist → types}/functions/get-block-properties.d.ts +0 -0
  236. /package/{dist → types}/functions/get-builder-search-params/index.d.ts +0 -0
  237. /package/{dist → types}/functions/get-content/generate-content-url.d.ts +0 -0
  238. /package/{dist → types}/functions/get-content/types.d.ts +0 -0
  239. /package/{dist → types}/functions/get-fetch.d.ts +0 -0
  240. /package/{dist → types}/functions/get-global-this.d.ts +0 -0
  241. /package/{dist → types}/functions/get-processed-block.d.ts +0 -0
  242. /package/{dist → types}/functions/get-react-native-block-styles.d.ts +0 -0
  243. /package/{dist → types}/functions/is-browser.d.ts +0 -0
  244. /package/{dist → types}/functions/is-editing.d.ts +0 -0
  245. /package/{dist → types}/functions/is-iframe.d.ts +0 -0
  246. /package/{dist → types}/functions/is-previewing.d.ts +0 -0
  247. /package/{dist → types}/functions/register-component.d.ts +0 -0
  248. /package/{dist → types}/functions/register.d.ts +0 -0
  249. /package/{dist → types}/functions/sanitize-react-native-block-styles.d.ts +0 -0
  250. /package/{dist → types}/functions/set-editor-settings.d.ts +0 -0
  251. /package/{dist → types}/functions/set.d.ts +0 -0
  252. /package/{dist → types}/functions/track/helpers.d.ts +0 -0
  253. /package/{dist → types}/functions/track/index.d.ts +0 -0
  254. /package/{dist → types}/functions/track/interaction.d.ts +0 -0
  255. /package/{dist → types}/functions/transform-block-properties.d.ts +0 -0
  256. /package/{dist → types}/functions/transform-block.d.ts +0 -0
  257. /package/{dist → types}/helpers/ab-tests.d.ts +0 -0
  258. /package/{dist → types}/helpers/canTrack.d.ts +0 -0
  259. /package/{dist → types}/helpers/cookie.d.ts +0 -0
  260. /package/{dist → types}/helpers/css.d.ts +0 -0
  261. /package/{dist → types}/helpers/flatten.d.ts +0 -0
  262. /package/{dist → types}/helpers/localStorage.d.ts +0 -0
  263. /package/{dist → types}/helpers/logger.d.ts +0 -0
  264. /package/{dist → types}/helpers/nullable.d.ts +0 -0
  265. /package/{dist → types}/helpers/preview-lru-cache/get.d.ts +0 -0
  266. /package/{dist → types}/helpers/preview-lru-cache/helpers.d.ts +0 -0
  267. /package/{dist → types}/helpers/preview-lru-cache/init.d.ts +0 -0
  268. /package/{dist → types}/helpers/preview-lru-cache/set.d.ts +0 -0
  269. /package/{dist → types}/helpers/preview-lru-cache/types.d.ts +0 -0
  270. /package/{dist → types}/helpers/sessionId.d.ts +0 -0
  271. /package/{dist → types}/helpers/url.d.ts +0 -0
  272. /package/{dist → types}/helpers/uuid.d.ts +0 -0
  273. /package/{dist → types}/helpers/visitorId.d.ts +0 -0
  274. /package/{dist → types}/index-helpers/top-of-file.d.ts +0 -0
  275. /package/{dist → types}/scripts/init-editing.d.ts +0 -0
  276. /package/{dist → types}/types/api-version.d.ts +0 -0
  277. /package/{dist → types}/types/builder-block.d.ts +0 -0
  278. /package/{dist → types}/types/builder-content.d.ts +0 -0
  279. /package/{dist → types}/types/builder-props.d.ts +0 -0
  280. /package/{dist → types}/types/can-track.d.ts +0 -0
  281. /package/{dist → types}/types/components.d.ts +0 -0
  282. /package/{dist → types}/types/deep-partial.d.ts +0 -0
  283. /package/{dist → types}/types/element.d.ts +0 -0
  284. /package/{dist → types}/types/enforced-partials.d.ts +0 -0
  285. /package/{dist → types}/types/input.d.ts +0 -0
  286. /package/{dist → types}/types/targets.d.ts +0 -0
  287. /package/{dist → types}/types/typescript.d.ts +0 -0
@@ -1,219 +0,0 @@
1
- export const componentInfo = {
2
- // TODO: ways to statically preprocess JSON for references, functions, etc
3
- name: 'Columns',
4
- isRSC: true,
5
- inputs: [{
6
- name: 'columns',
7
- type: 'array',
8
- broadcast: true,
9
- subFields: [{
10
- name: 'blocks',
11
- type: 'array',
12
- hideFromUI: true,
13
- defaultValue: [{
14
- '@type': '@builder.io/sdk:Element',
15
- responsiveStyles: {
16
- large: {
17
- display: 'flex',
18
- flexDirection: 'column',
19
- alignItems: 'stretch',
20
- flexShrink: '0',
21
- position: 'relative',
22
- marginTop: '30px',
23
- textAlign: 'center',
24
- lineHeight: 'normal',
25
- height: 'auto',
26
- minHeight: '20px',
27
- minWidth: '20px',
28
- overflow: 'hidden'
29
- }
30
- },
31
- component: {
32
- name: 'Image',
33
- options: {
34
- image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
35
- backgroundPosition: 'center',
36
- backgroundSize: 'cover',
37
- aspectRatio: 0.7004048582995948
38
- }
39
- }
40
- }, {
41
- '@type': '@builder.io/sdk:Element',
42
- responsiveStyles: {
43
- large: {
44
- display: 'flex',
45
- flexDirection: 'column',
46
- alignItems: 'stretch',
47
- flexShrink: '0',
48
- position: 'relative',
49
- marginTop: '30px',
50
- textAlign: 'center',
51
- lineHeight: 'normal',
52
- height: 'auto'
53
- }
54
- },
55
- component: {
56
- name: 'Text',
57
- options: {
58
- text: '<p>Enter some text...</p>'
59
- }
60
- }
61
- }]
62
- }, {
63
- name: 'width',
64
- type: 'number',
65
- hideFromUI: true,
66
- helperText: 'Width %, e.g. set to 50 to fill half of the space'
67
- }, {
68
- name: 'link',
69
- type: 'url',
70
- helperText: 'Optionally set a url that clicking this column will link to'
71
- }],
72
- defaultValue: [{
73
- blocks: [{
74
- '@type': '@builder.io/sdk:Element',
75
- responsiveStyles: {
76
- large: {
77
- display: 'flex',
78
- flexDirection: 'column',
79
- alignItems: 'stretch',
80
- flexShrink: '0',
81
- position: 'relative',
82
- marginTop: '30px',
83
- textAlign: 'center',
84
- lineHeight: 'normal',
85
- height: 'auto',
86
- minHeight: '20px',
87
- minWidth: '20px',
88
- overflow: 'hidden'
89
- }
90
- },
91
- component: {
92
- name: 'Image',
93
- options: {
94
- image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
95
- backgroundPosition: 'center',
96
- backgroundSize: 'cover',
97
- aspectRatio: 0.7004048582995948
98
- }
99
- }
100
- }, {
101
- '@type': '@builder.io/sdk:Element',
102
- responsiveStyles: {
103
- large: {
104
- display: 'flex',
105
- flexDirection: 'column',
106
- alignItems: 'stretch',
107
- flexShrink: '0',
108
- position: 'relative',
109
- marginTop: '30px',
110
- textAlign: 'center',
111
- lineHeight: 'normal',
112
- height: 'auto'
113
- }
114
- },
115
- component: {
116
- name: 'Text',
117
- options: {
118
- text: '<p>Enter some text...</p>'
119
- }
120
- }
121
- }]
122
- }, {
123
- blocks: [{
124
- '@type': '@builder.io/sdk:Element',
125
- responsiveStyles: {
126
- large: {
127
- display: 'flex',
128
- flexDirection: 'column',
129
- alignItems: 'stretch',
130
- flexShrink: '0',
131
- position: 'relative',
132
- marginTop: '30px',
133
- textAlign: 'center',
134
- lineHeight: 'normal',
135
- height: 'auto',
136
- minHeight: '20px',
137
- minWidth: '20px',
138
- overflow: 'hidden'
139
- }
140
- },
141
- component: {
142
- name: 'Image',
143
- options: {
144
- image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
145
- backgroundPosition: 'center',
146
- backgroundSize: 'cover',
147
- aspectRatio: 0.7004048582995948
148
- }
149
- }
150
- }, {
151
- '@type': '@builder.io/sdk:Element',
152
- responsiveStyles: {
153
- large: {
154
- display: 'flex',
155
- flexDirection: 'column',
156
- alignItems: 'stretch',
157
- flexShrink: '0',
158
- position: 'relative',
159
- marginTop: '30px',
160
- textAlign: 'center',
161
- lineHeight: 'normal',
162
- height: 'auto'
163
- }
164
- },
165
- component: {
166
- name: 'Text',
167
- options: {
168
- text: '<p>Enter some text...</p>'
169
- }
170
- }
171
- }]
172
- }],
173
- onChange: (options) => {
174
- function clearWidths() {
175
- columns.forEach(col => {
176
- col.delete('width');
177
- });
178
- }
179
- const columns = options.get('columns');
180
- if (Array.isArray(columns)) {
181
- const containsColumnWithWidth = !!columns.find(col => col.get('width'));
182
- if (containsColumnWithWidth) {
183
- const containsColumnWithoutWidth = !!columns.find(col => !col.get('width'));
184
- if (containsColumnWithoutWidth) {
185
- clearWidths();
186
- }
187
- else {
188
- const sumWidths = columns.reduce((memo, col) => {
189
- return memo + col.get('width');
190
- }, 0);
191
- const widthsDontAddUp = sumWidths !== 100;
192
- if (widthsDontAddUp) {
193
- clearWidths();
194
- }
195
- }
196
- }
197
- }
198
- }
199
- }, {
200
- name: 'space',
201
- type: 'number',
202
- defaultValue: 20,
203
- helperText: 'Size of gap between columns',
204
- advanced: true
205
- }, {
206
- name: 'stackColumnsAt',
207
- type: 'string',
208
- defaultValue: 'tablet',
209
- helperText: 'Convert horizontal columns to vertical at what device size',
210
- enum: ['tablet', 'mobile', 'never'],
211
- advanced: true
212
- }, {
213
- name: 'reverseColumnsWhenStacked',
214
- type: 'boolean',
215
- defaultValue: false,
216
- helperText: 'When stacking columns for mobile devices, reverse the ordering',
217
- advanced: true
218
- }]
219
- };
@@ -1,23 +0,0 @@
1
- export const componentInfo = {
2
- name: 'Custom Code',
3
- static: true,
4
- requiredPermissions: ['editCode'],
5
- inputs: [{
6
- name: 'code',
7
- type: 'html',
8
- required: true,
9
- defaultValue: '<p>Hello there, I am custom HTML code!</p>',
10
- code: true
11
- }, {
12
- name: 'replaceNodes',
13
- type: 'boolean',
14
- helperText: 'Preserve server rendered dom nodes',
15
- advanced: true
16
- }, {
17
- name: 'scriptsClientOnly',
18
- type: 'boolean',
19
- defaultValue: false,
20
- helperText: 'Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads',
21
- advanced: true
22
- }]
23
- };
@@ -1,51 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import { useState, useRef, useEffect } from "react";
4
- function CustomCode(props) {
5
- const elem = useRef(null);
6
- const [scriptsInserted, setScriptsInserted] = useState(() => []);
7
- const [scriptsRun, setScriptsRun] = useState(() => []);
8
- function findAndRunScripts() {
9
- // TODO: Move this function to standalone one in '@builder.io/utils'
10
- if (elem.current &&
11
- elem.current.getElementsByTagName &&
12
- typeof window !== "undefined") {
13
- const scripts = elem.current.getElementsByTagName("script");
14
- for (let i = 0; i < scripts.length; i++) {
15
- const script = scripts[i];
16
- if (script.src) {
17
- if (scriptsInserted.includes(script.src)) {
18
- continue;
19
- }
20
- scriptsInserted.push(script.src);
21
- const newScript = document.createElement("script");
22
- newScript.async = true;
23
- newScript.src = script.src;
24
- document.head.appendChild(newScript);
25
- }
26
- else if (!script.type ||
27
- [
28
- "text/javascript",
29
- "application/javascript",
30
- "application/ecmascript",
31
- ].includes(script.type)) {
32
- if (scriptsRun.includes(script.innerText)) {
33
- continue;
34
- }
35
- try {
36
- scriptsRun.push(script.innerText);
37
- new Function(script.innerText)();
38
- }
39
- catch (error) {
40
- console.warn("`CustomCode`: Error running script:", error);
41
- }
42
- }
43
- }
44
- }
45
- }
46
- useEffect(() => {
47
- findAndRunScripts();
48
- }, []);
49
- return (React.createElement("div", { ref: elem, className: "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), dangerouslySetInnerHTML: { __html: props.code } }));
50
- }
51
- export default CustomCode;
@@ -1,39 +0,0 @@
1
- export const componentInfo = {
2
- name: 'Embed',
3
- static: true,
4
- inputs: [{
5
- name: 'url',
6
- type: 'url',
7
- required: true,
8
- defaultValue: '',
9
- helperText: 'e.g. enter a youtube url, google map, etc',
10
- onChange: (options) => {
11
- const url = options.get('url');
12
- if (url) {
13
- options.set('content', 'Loading...');
14
- // TODO: get this out of here!
15
- const apiKey = 'ae0e60e78201a3f2b0de4b';
16
- return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(res => res.json()).then(data => {
17
- if (options.get('url') === url) {
18
- if (data.html) {
19
- options.set('content', data.html);
20
- }
21
- else {
22
- options.set('content', 'Invalid url, please try another');
23
- }
24
- }
25
- }).catch(_err => {
26
- options.set('content', 'There was an error embedding this URL, please try again or another URL');
27
- });
28
- }
29
- else {
30
- options.delete('content');
31
- }
32
- }
33
- }, {
34
- name: 'content',
35
- type: 'html',
36
- defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
37
- hideFromUI: true
38
- }]
39
- };
@@ -1,42 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- import { useState, useRef, useEffect } from "react";
4
- import { isJsScript } from "./helpers.js";
5
- function Embed(props) {
6
- const elem = useRef(null);
7
- const [scriptsInserted, setScriptsInserted] = useState(() => []);
8
- const [scriptsRun, setScriptsRun] = useState(() => []);
9
- const [ranInitFn, setRanInitFn] = useState(() => false);
10
- function findAndRunScripts() {
11
- if (!elem.current || !elem.current.getElementsByTagName)
12
- return;
13
- const scripts = elem.current.getElementsByTagName("script");
14
- for (let i = 0; i < scripts.length; i++) {
15
- const script = scripts[i];
16
- if (script.src && !scriptsInserted.includes(script.src)) {
17
- scriptsInserted.push(script.src);
18
- const newScript = document.createElement("script");
19
- newScript.async = true;
20
- newScript.src = script.src;
21
- document.head.appendChild(newScript);
22
- }
23
- else if (isJsScript(script) && !scriptsRun.includes(script.innerText)) {
24
- try {
25
- scriptsRun.push(script.innerText);
26
- new Function(script.innerText)();
27
- }
28
- catch (error) {
29
- console.warn("`Embed`: Error running script:", error);
30
- }
31
- }
32
- }
33
- }
34
- useEffect(() => {
35
- if (elem.current && !ranInitFn) {
36
- setRanInitFn(true);
37
- findAndRunScripts();
38
- }
39
- }, [elem.current, ranInitFn]);
40
- return (React.createElement("div", { className: "builder-embed", ref: elem, dangerouslySetInnerHTML: { __html: props.content } }));
41
- }
42
- export default Embed;
@@ -1,2 +0,0 @@
1
- const SCRIPT_MIME_TYPES = ['text/javascript', 'application/javascript', 'application/ecmascript'];
2
- export const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
@@ -1,7 +0,0 @@
1
- export const componentInfo = {
2
- name: 'Fragment',
3
- static: true,
4
- hidden: true,
5
- canHaveChildren: true,
6
- noWrap: true
7
- };
@@ -1,6 +0,0 @@
1
- "use client";
2
- import * as React from "react";
3
- function FragmentComponent(props) {
4
- return React.createElement("span", null, props.children);
5
- }
6
- export default FragmentComponent;
@@ -1,40 +0,0 @@
1
- export function filterAttrs(attrs = {}, prefix, isEvent) {
2
- const result = {};
3
- for (const attr in attrs) {
4
- if (!attrs[attr])
5
- continue;
6
- if (isEvent && !attr.startsWith(prefix))
7
- continue;
8
- const eventName = isEvent ? attr.replace(prefix, '') : attr;
9
- result[eventName] = attrs[attr];
10
- }
11
- return result;
12
- }
13
- /**
14
- * Svelte SDK: workaround to dynamically provide event handlers to components/elements.
15
- * https://svelte.dev/repl/1246699e266f41218a8eeb45b9b58b54?version=3.24.1
16
- */
17
- export function setAttrs(node, attrs = {}) {
18
- const attrKeys = Object.keys(attrs);
19
- /**
20
- *
21
- * @param {string} attr
22
- */
23
- const setup = (attr) => node.addEventListener(attr, attrs[attr]);
24
- /**
25
- *
26
- * @param {string} attr
27
- */
28
- const teardown = (attr) => node.removeEventListener(attr, attrs[attr]);
29
- attrKeys.forEach(setup);
30
- return {
31
- update(attrs = {}) {
32
- const attrKeys = Object.keys(attrs);
33
- attrKeys.forEach(teardown);
34
- attrKeys.forEach(setup);
35
- },
36
- destroy() {
37
- attrKeys.forEach(teardown);
38
- }
39
- };
40
- }
@@ -1,122 +0,0 @@
1
- export const componentInfo = {
2
- name: 'Image',
3
- static: true,
4
- image: 'https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4',
5
- defaultStyles: {
6
- position: 'relative',
7
- minHeight: '20px',
8
- minWidth: '20px',
9
- overflow: 'hidden'
10
- },
11
- canHaveChildren: true,
12
- inputs: [{
13
- name: 'image',
14
- type: 'file',
15
- bubble: true,
16
- allowedFileTypes: ['jpeg', 'jpg', 'png', 'svg'],
17
- required: true,
18
- defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
19
- onChange: (options) => {
20
- const DEFAULT_ASPECT_RATIO = 0.7041;
21
- options.delete('srcset');
22
- options.delete('noWebp');
23
- function loadImage(url, timeout = 60000) {
24
- return new Promise((resolve, reject) => {
25
- const img = document.createElement('img');
26
- let loaded = false;
27
- img.onload = () => {
28
- loaded = true;
29
- resolve(img);
30
- };
31
- img.addEventListener('error', event => {
32
- console.warn('Image load failed', event.error);
33
- reject(event.error);
34
- });
35
- img.src = url;
36
- setTimeout(() => {
37
- if (!loaded) {
38
- reject(new Error('Image load timed out'));
39
- }
40
- }, timeout);
41
- });
42
- }
43
- function round(num) {
44
- return Math.round(num * 1000) / 1000;
45
- }
46
- const value = options.get('image');
47
- const aspectRatio = options.get('aspectRatio');
48
- // For SVG images - don't render as webp, keep them as SVG
49
- fetch(value).then(res => res.blob()).then(blob => {
50
- if (blob.type.includes('svg')) {
51
- options.set('noWebp', true);
52
- }
53
- });
54
- if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
55
- return loadImage(value).then(img => {
56
- const possiblyUpdatedAspectRatio = options.get('aspectRatio');
57
- if (options.get('image') === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
58
- if (img.width && img.height) {
59
- options.set('aspectRatio', round(img.height / img.width));
60
- options.set('height', img.height);
61
- options.set('width', img.width);
62
- }
63
- }
64
- });
65
- }
66
- }
67
- }, {
68
- name: 'backgroundSize',
69
- type: 'text',
70
- defaultValue: 'cover',
71
- enum: [{
72
- label: 'contain',
73
- value: 'contain',
74
- helperText: 'The image should never get cropped'
75
- }, {
76
- label: 'cover',
77
- value: 'cover',
78
- helperText: "The image should fill it's box, cropping when needed"
79
- }]
80
- }, {
81
- name: 'backgroundPosition',
82
- type: 'text',
83
- defaultValue: 'center',
84
- enum: ['center', 'top', 'left', 'right', 'bottom', 'top left', 'top right', 'bottom left', 'bottom right']
85
- }, {
86
- name: 'altText',
87
- type: 'string',
88
- helperText: 'Text to display when the user has images off'
89
- }, {
90
- name: 'height',
91
- type: 'number',
92
- hideFromUI: true
93
- }, {
94
- name: 'width',
95
- type: 'number',
96
- hideFromUI: true
97
- }, {
98
- name: 'sizes',
99
- type: 'string',
100
- hideFromUI: true
101
- }, {
102
- name: 'srcset',
103
- type: 'string',
104
- hideFromUI: true
105
- }, {
106
- name: 'lazy',
107
- type: 'boolean',
108
- defaultValue: true,
109
- hideFromUI: true
110
- }, {
111
- name: 'fitContent',
112
- type: 'boolean',
113
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
114
- defaultValue: true
115
- }, {
116
- name: 'aspectRatio',
117
- type: 'number',
118
- helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
119
- advanced: true,
120
- defaultValue: 0.7041
121
- }]
122
- };
@@ -1,47 +0,0 @@
1
- // Taken from (and modified) the shopify theme script repo
2
- // https://github.com/Shopify/theme-scripts/blob/bcfb471f2a57d439e2f964a1bb65b67708cc90c3/packages/theme-images/images.js#L59
3
- function removeProtocol(path) {
4
- return path.replace(/http(s)?:/, '');
5
- }
6
- function updateQueryParam(uri = '', key, value) {
7
- const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
8
- const separator = uri.indexOf('?') !== -1 ? '&' : '?';
9
- if (uri.match(re)) {
10
- return uri.replace(re, '$1' + key + '=' + encodeURIComponent(value) + '$2');
11
- }
12
- return uri + separator + key + '=' + encodeURIComponent(value);
13
- }
14
- function getShopifyImageUrl(src, size) {
15
- if (!src || !src?.match(/cdn\.shopify\.com/) || !size) {
16
- return src;
17
- }
18
- if (size === 'master') {
19
- return removeProtocol(src);
20
- }
21
- const match = src.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
22
- if (match) {
23
- const prefix = src.split(match[0]);
24
- const suffix = match[3];
25
- const useSize = size.match('x') ? size : `${size}x`;
26
- return removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
27
- }
28
- return null;
29
- }
30
- export function getSrcSet(url) {
31
- if (!url) {
32
- return url;
33
- }
34
- const sizes = [100, 200, 400, 800, 1200, 1600, 2000];
35
- if (url.match(/builder\.io/)) {
36
- let srcUrl = url;
37
- const widthInSrc = Number(url.split('?width=')[1]);
38
- if (!isNaN(widthInSrc)) {
39
- srcUrl = `${srcUrl} ${widthInSrc}w`;
40
- }
41
- return sizes.filter(size => size !== widthInSrc).map(size => `${updateQueryParam(url, 'width', size)} ${size}w`).concat([srcUrl]).join(', ');
42
- }
43
- if (url.match(/cdn\.shopify\.com/)) {
44
- return sizes.map(size => [getShopifyImageUrl(url, `${size}x${size}`), size]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([url]).join(', ');
45
- }
46
- return url;
47
- }