@builder.io/sdk-solid 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +1 -1
  3. package/src/blocks/BaseText.jsx +1 -1
  4. package/src/blocks/button/button.jsx +5 -3
  5. package/src/blocks/button/component-info.js +16 -22
  6. package/src/blocks/columns/columns.jsx +12 -21
  7. package/src/blocks/columns/component-info.js +203 -226
  8. package/src/blocks/custom-code/component-info.js +19 -25
  9. package/src/blocks/embed/component-info.js +31 -37
  10. package/src/blocks/embed/helpers.js +3 -9
  11. package/src/blocks/form/component-info.js +174 -212
  12. package/src/blocks/form/form.jsx +1 -268
  13. package/src/blocks/fragment/component-info.js +1 -3
  14. package/src/blocks/helpers.js +27 -0
  15. package/src/blocks/image/component-info.js +105 -133
  16. package/src/blocks/image/image.helpers.js +3 -5
  17. package/src/blocks/img/component-info.js +8 -12
  18. package/src/blocks/img/img.jsx +2 -0
  19. package/src/blocks/input/component-info.js +29 -57
  20. package/src/blocks/input/input.jsx +2 -0
  21. package/src/blocks/raw-text/component-info.js +7 -11
  22. package/src/blocks/raw-text/raw-text.jsx +2 -2
  23. package/src/blocks/section/component-info.js +24 -31
  24. package/src/blocks/section/section.jsx +3 -0
  25. package/src/blocks/select/component-info.js +34 -48
  26. package/src/blocks/select/select.jsx +2 -0
  27. package/src/blocks/submit-button/component-info.js +6 -10
  28. package/src/blocks/submit-button/submit-button.jsx +3 -1
  29. package/src/blocks/symbol/component-info.js +30 -37
  30. package/src/blocks/symbol/symbol.helpers.js +60 -0
  31. package/src/blocks/symbol/symbol.jsx +31 -68
  32. package/src/blocks/text/component-info.js +10 -13
  33. package/src/blocks/text/text.jsx +1 -1
  34. package/src/blocks/textarea/component-info.js +22 -30
  35. package/src/blocks/textarea/textarea.jsx +3 -0
  36. package/src/blocks/video/component-info.js +74 -96
  37. package/src/blocks/video/video.jsx +1 -0
  38. package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
  39. package/src/components/{render-block/render-block.jsx → block/block.jsx} +65 -80
  40. package/src/components/{render-block → block/components}/block-styles.jsx +16 -16
  41. package/src/components/block/components/block-wrapper.jsx +50 -0
  42. package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
  43. package/src/components/block/components/component-ref/component-ref.jsx +58 -0
  44. package/src/components/block/components/interactive-element.jsx +30 -0
  45. package/src/components/block/components/repeated-block.jsx +20 -0
  46. package/src/components/blocks/blocks-wrapper.jsx +66 -0
  47. package/src/components/blocks/blocks.jsx +48 -0
  48. package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +86 -175
  49. package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
  50. package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +4 -4
  51. package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
  52. package/src/components/content/content.jsx +129 -0
  53. package/src/components/content/index.js +2 -0
  54. package/src/components/content/wrap-component-ref.js +2 -0
  55. package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +19 -22
  56. package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
  57. package/src/constants/builder-registered-components.js +34 -25
  58. package/src/constants/device-sizes.js +6 -6
  59. package/src/constants/sdk-version.js +1 -1
  60. package/src/context/builder.context.js +1 -1
  61. package/src/functions/apply-patch-with-mutation.js +66 -0
  62. package/src/functions/camel-to-kebab-case.js +2 -4
  63. package/src/functions/evaluate/acorn.js +1595 -0
  64. package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
  65. package/src/functions/evaluate/index.js +2 -0
  66. package/src/functions/evaluate/interpreter.js +2801 -0
  67. package/src/functions/evaluate/non-node-runtime.js +92 -0
  68. package/src/functions/evaluate/types.js +0 -0
  69. package/src/functions/event-handler-name.js +2 -4
  70. package/src/functions/extract-text-styles.js +4 -12
  71. package/src/functions/fast-clone.js +2 -4
  72. package/src/functions/get-block-actions-handler.js +3 -5
  73. package/src/functions/get-block-actions.js +15 -4
  74. package/src/functions/get-block-component-options.js +11 -12
  75. package/src/functions/get-block-properties.js +29 -19
  76. package/src/functions/get-builder-search-params/index.js +5 -10
  77. package/src/functions/get-content/generate-content-url.js +17 -19
  78. package/src/functions/get-content/index.js +43 -29
  79. package/src/functions/get-fetch.js +1 -3
  80. package/src/functions/get-global-this.js +1 -3
  81. package/src/functions/get-processed-block.js +12 -13
  82. package/src/functions/get-react-native-block-styles.js +11 -12
  83. package/src/functions/if-target.js +1 -3
  84. package/src/functions/is-browser.js +1 -3
  85. package/src/functions/is-editing.js +1 -3
  86. package/src/functions/is-iframe.js +1 -3
  87. package/src/functions/is-non-node-server.js +9 -0
  88. package/src/functions/is-previewing.js +1 -3
  89. package/src/functions/on-change.js +1 -4
  90. package/src/functions/register-component.js +34 -42
  91. package/src/functions/register.js +1 -3
  92. package/src/functions/sanitize-react-native-block-styles.js +22 -17
  93. package/src/functions/set-editor-settings.js +1 -3
  94. package/src/functions/set.js +1 -3
  95. package/src/functions/track/helpers.js +3 -5
  96. package/src/functions/track/index.js +45 -43
  97. package/src/functions/track/interaction.js +11 -7
  98. package/src/functions/transform-block-properties.js +1 -3
  99. package/src/functions/transform-block.js +1 -3
  100. package/src/helpers/ab-tests.js +45 -28
  101. package/src/helpers/canTrack.js +3 -5
  102. package/src/helpers/cookie.js +15 -24
  103. package/src/helpers/css.js +3 -7
  104. package/src/helpers/flatten.js +15 -18
  105. package/src/helpers/localStorage.js +1 -4
  106. package/src/helpers/logger.js +1 -3
  107. package/src/helpers/nullable.js +2 -4
  108. package/src/helpers/preview-lru-cache/get.js +8 -0
  109. package/src/helpers/preview-lru-cache/helpers.js +10 -0
  110. package/src/helpers/preview-lru-cache/init.js +10 -0
  111. package/src/helpers/preview-lru-cache/set.js +35 -0
  112. package/src/helpers/preview-lru-cache/types.js +0 -0
  113. package/src/helpers/sessionId.js +14 -11
  114. package/src/helpers/time.js +1 -3
  115. package/src/helpers/url.js +2 -4
  116. package/src/helpers/uuid.js +4 -6
  117. package/src/helpers/visitorId.js +8 -7
  118. package/src/index-helpers/blocks-exports.js +3 -14
  119. package/src/index-helpers/top-of-file.js +1 -3
  120. package/src/index.js +2 -17
  121. package/src/scripts/init-editing.js +62 -48
  122. package/src/types/api-version.js +1 -3
  123. package/src/types/builder-props.js +0 -0
  124. package/src/blocks/util.js +0 -8
  125. package/src/components/render-block/render-component.jsx +0 -40
  126. package/src/components/render-block/render-repeated-block.jsx +0 -16
  127. package/src/components/render-blocks.jsx +0 -100
  128. package/src/components/render-content/builder-editing.jsx +0 -5
  129. package/src/components/render-content/index.js +0 -4
  130. package/src/components/render-content/wrap-component-ref.js +0 -4
  131. package/src/functions/evaluate.test.js +0 -17
  132. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  133. package/src/functions/get-content/generate-content-url.test.js +0 -97
  134. package/src/functions/get-processed-block.test.js +0 -34
  135. package/src/functions/on-change.test.js +0 -19
  136. package/src/functions/set.test.js +0 -16
  137. package/src/helpers/url.test.js +0 -21
  138. /package/src/components/{render-block → block}/types.js +0 -0
  139. /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
  140. /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
@@ -1,33 +1,27 @@
1
1
  const componentInfo = {
2
2
  name: "Form:TextArea",
3
3
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
4
- inputs: [
5
- {
6
- advanced: true,
7
- name: "value",
8
- type: "string"
9
- },
10
- {
11
- name: "name",
12
- type: "string",
13
- required: true,
14
- helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
15
- },
16
- {
17
- name: "defaultValue",
18
- type: "string"
19
- },
20
- {
21
- name: "placeholder",
22
- type: "string",
23
- defaultValue: "Hello there"
24
- },
25
- {
26
- name: "required",
27
- type: "boolean",
28
- defaultValue: false
29
- }
30
- ],
4
+ inputs: [{
5
+ advanced: true,
6
+ name: "value",
7
+ type: "string"
8
+ }, {
9
+ name: "name",
10
+ type: "string",
11
+ required: true,
12
+ helperText: 'Every input in a form needs a unique name describing what it gets, e.g. "email"'
13
+ }, {
14
+ name: "defaultValue",
15
+ type: "string"
16
+ }, {
17
+ name: "placeholder",
18
+ type: "string",
19
+ defaultValue: "Hello there"
20
+ }, {
21
+ name: "required",
22
+ type: "boolean",
23
+ defaultValue: false
24
+ }],
31
25
  defaultStyles: {
32
26
  paddingTop: "10px",
33
27
  paddingBottom: "10px",
@@ -41,6 +35,4 @@ const componentInfo = {
41
35
  static: true,
42
36
  noWrap: true
43
37
  };
44
- export {
45
- componentInfo
46
- };
38
+ export { componentInfo }
@@ -1,6 +1,9 @@
1
+ import { filterAttrs } from "../helpers.js";
2
+
1
3
  function Textarea(props) {
2
4
  return (
3
5
  <textarea
6
+ {...{}}
4
7
  {...props.attributes}
5
8
  placeholder={props.placeholder}
6
9
  name={props.name}
@@ -6,100 +6,78 @@ const componentInfo = {
6
6
  minWidth: "20px"
7
7
  },
8
8
  image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
9
- inputs: [
10
- {
11
- name: "video",
12
- type: "file",
13
- allowedFileTypes: ["mp4"],
14
- bubble: true,
15
- defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
16
- required: true
17
- },
18
- {
19
- name: "posterImage",
20
- type: "file",
21
- allowedFileTypes: ["jpeg", "png"],
22
- helperText: "Image to show before the video plays"
23
- },
24
- {
25
- name: "autoPlay",
26
- type: "boolean",
27
- defaultValue: true
28
- },
29
- {
30
- name: "controls",
31
- type: "boolean",
32
- defaultValue: false
33
- },
34
- {
35
- name: "muted",
36
- type: "boolean",
37
- defaultValue: true
38
- },
39
- {
40
- name: "loop",
41
- type: "boolean",
42
- defaultValue: true
43
- },
44
- {
45
- name: "playsInline",
46
- type: "boolean",
47
- defaultValue: true
48
- },
49
- {
50
- name: "fit",
51
- type: "text",
52
- defaultValue: "cover",
53
- enum: ["contain", "cover", "fill", "auto"]
54
- },
55
- {
56
- name: "fitContent",
57
- type: "boolean",
58
- helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
59
- defaultValue: true,
60
- advanced: true
61
- },
62
- {
63
- name: "position",
64
- type: "text",
65
- defaultValue: "center",
66
- enum: [
67
- "center",
68
- "top",
69
- "left",
70
- "right",
71
- "bottom",
72
- "top left",
73
- "top right",
74
- "bottom left",
75
- "bottom right"
76
- ]
77
- },
78
- {
79
- name: "height",
80
- type: "number",
81
- advanced: true
82
- },
83
- {
84
- name: "width",
85
- type: "number",
86
- advanced: true
87
- },
88
- {
89
- name: "aspectRatio",
90
- type: "number",
91
- advanced: true,
92
- defaultValue: 0.7004048582995948
93
- },
94
- {
95
- name: "lazyLoad",
96
- type: "boolean",
97
- helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
98
- defaultValue: true,
99
- advanced: true
100
- }
101
- ]
102
- };
103
- export {
104
- componentInfo
9
+ inputs: [{
10
+ name: "video",
11
+ type: "file",
12
+ allowedFileTypes: ["mp4"],
13
+ bubble: true,
14
+ defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
15
+ required: true
16
+ }, {
17
+ name: "posterImage",
18
+ type: "file",
19
+ allowedFileTypes: ["jpeg", "png"],
20
+ helperText: "Image to show before the video plays"
21
+ }, {
22
+ name: "autoPlay",
23
+ type: "boolean",
24
+ defaultValue: true
25
+ }, {
26
+ name: "controls",
27
+ type: "boolean",
28
+ defaultValue: false
29
+ }, {
30
+ name: "muted",
31
+ type: "boolean",
32
+ defaultValue: true
33
+ }, {
34
+ name: "loop",
35
+ type: "boolean",
36
+ defaultValue: true
37
+ }, {
38
+ name: "playsInline",
39
+ type: "boolean",
40
+ defaultValue: true
41
+ }, {
42
+ name: "fit",
43
+ type: "text",
44
+ defaultValue: "cover",
45
+ enum: ["contain", "cover", "fill", "auto"]
46
+ }, {
47
+ name: "preload",
48
+ type: "text",
49
+ defaultValue: "metadata",
50
+ enum: ["auto", "metadata", "none"]
51
+ }, {
52
+ name: "fitContent",
53
+ type: "boolean",
54
+ helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
55
+ defaultValue: true,
56
+ advanced: true
57
+ }, {
58
+ name: "position",
59
+ type: "text",
60
+ defaultValue: "center",
61
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
62
+ }, {
63
+ name: "height",
64
+ type: "number",
65
+ advanced: true
66
+ }, {
67
+ name: "width",
68
+ type: "number",
69
+ advanced: true
70
+ }, {
71
+ name: "aspectRatio",
72
+ type: "number",
73
+ advanced: true,
74
+ defaultValue: 0.7004048582995948
75
+ }, {
76
+ name: "lazyLoad",
77
+ type: "boolean",
78
+ helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
79
+ defaultValue: true,
80
+ advanced: true
81
+ }]
105
82
  };
83
+ export { componentInfo }
@@ -41,6 +41,7 @@ function Video(props) {
41
41
  return (
42
42
  <video
43
43
  {...spreadProps()}
44
+ preload={props.preload || "metadata"}
44
45
  style={{
45
46
  width: "100%",
46
47
  height: "100%",
@@ -4,56 +4,38 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value
12
+ }) : obj[key] = value;
8
13
  var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
14
+ for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
17
+ }
17
18
  return a;
18
19
  };
19
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
21
  var __objRest = (source, exclude) => {
21
22
  var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
23
+ for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop];
24
+ if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) {
25
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop];
26
+ }
30
27
  return target;
31
28
  };
32
29
  import { evaluate } from "../../functions/evaluate";
33
- import { getProcessedBlock } from "../../functions/get-processed-block";
34
- const EMPTY_HTML_ELEMENTS = [
35
- "area",
36
- "base",
37
- "br",
38
- "col",
39
- "embed",
40
- "hr",
41
- "img",
42
- "input",
43
- "keygen",
44
- "link",
45
- "meta",
46
- "param",
47
- "source",
48
- "track",
49
- "wbr"
50
- ];
51
- const isEmptyHtmlElement = (tagName) => {
30
+ import { getProcessedBlock } from "../../functions/get-processed-block.js";
31
+ const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
32
+ const isEmptyHtmlElement = tagName => {
52
33
  return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
53
34
  };
54
35
  const getComponent = ({
55
36
  block,
56
- context
37
+ context,
38
+ registeredComponents
57
39
  }) => {
58
40
  var _a;
59
41
  const componentName = (_a = getProcessedBlock({
@@ -67,7 +49,7 @@ const getComponent = ({
67
49
  if (!componentName) {
68
50
  return null;
69
51
  }
70
- const ref = context.registeredComponents[componentName];
52
+ const ref = registeredComponents[componentName];
71
53
  if (!ref) {
72
54
  console.warn(`
73
55
  Could not find a registered component named "${componentName}".
@@ -81,7 +63,11 @@ const getRepeatItemData = ({
81
63
  block,
82
64
  context
83
65
  }) => {
84
- const _a = block, { repeat } = _a, blockWithoutRepeat = __objRest(_a, ["repeat"]);
66
+ const _a = block,
67
+ {
68
+ repeat
69
+ } = _a,
70
+ blockWithoutRepeat = __objRest(_a, ["repeat"]);
85
71
  if (!(repeat == null ? void 0 : repeat.collection)) {
86
72
  return void 0;
87
73
  }
@@ -110,8 +96,4 @@ const getRepeatItemData = ({
110
96
  }));
111
97
  return repeatArray;
112
98
  };
113
- export {
114
- getComponent,
115
- getRepeatItemData,
116
- isEmptyHtmlElement
117
- };
99
+ export { getComponent, getRepeatItemData, isEmptyHtmlElement }
@@ -1,33 +1,29 @@
1
1
  import { Show, For, createSignal } from "solid-js";
2
- import { Dynamic } from "solid-js/web";
3
2
 
4
- import { getBlockActions } from "../../functions/get-block-actions.js";
5
3
  import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
6
4
  import { getBlockProperties } from "../../functions/get-block-properties.js";
7
5
  import { getProcessedBlock } from "../../functions/get-processed-block.js";
8
- import BlockStyles from "./block-styles.jsx";
6
+ import BlockStyles from "./components/block-styles.jsx";
9
7
  import {
10
8
  getComponent,
11
9
  getRepeatItemData,
12
10
  isEmptyHtmlElement,
13
- } from "./render-block.helpers.js";
14
- import RenderRepeatedBlock from "./render-repeated-block.jsx";
15
- import { TARGET } from "../../constants/target.js";
11
+ } from "./block.helpers.js";
12
+ import RepeatedBlock from "./components/repeated-block.jsx";
16
13
  import { extractTextStyles } from "../../functions/extract-text-styles.js";
17
- import RenderComponent from "./render-component.jsx";
18
- import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
14
+ import ComponentRef from "./components/component-ref/component-ref.jsx";
15
+ import BlockWrapper from "./components/block-wrapper.jsx";
19
16
 
20
- function RenderBlock(props) {
21
- const [component, setComponent] = createSignal(
22
- getComponent({
17
+ function Block(props) {
18
+ const [childrenContext, setChildrenContext] = createSignal(props.context);
19
+
20
+ function blockComponent() {
21
+ return getComponent({
23
22
  block: props.block,
24
23
  context: props.context,
25
- })
26
- );
27
-
28
- const [Tag, setTag] = createSignal(props.block.tagName || "div");
29
-
30
- const [childrenContext, setChildrenContext] = createSignal(props.context);
24
+ registeredComponents: props.registeredComponents,
25
+ });
26
+ }
31
27
 
32
28
  function repeatItem() {
33
29
  return getRepeatItemData({
@@ -36,7 +32,7 @@ function RenderBlock(props) {
36
32
  });
37
33
  }
38
34
 
39
- function useBlock() {
35
+ function processedBlock() {
40
36
  return repeatItem()
41
37
  ? props.block
42
38
  : getProcessedBlock({
@@ -49,42 +45,20 @@ function RenderBlock(props) {
49
45
  });
50
46
  }
51
47
 
48
+ function Tag() {
49
+ return props.block.tagName || "div";
50
+ }
51
+
52
52
  function canShowBlock() {
53
- if ("hide" in useBlock()) {
54
- return !useBlock().hide;
53
+ if ("hide" in processedBlock()) {
54
+ return !processedBlock().hide;
55
55
  }
56
- if ("show" in useBlock()) {
57
- return useBlock().show;
56
+ if ("show" in processedBlock()) {
57
+ return processedBlock().show;
58
58
  }
59
59
  return true;
60
60
  }
61
61
 
62
- function actions() {
63
- return getBlockActions({
64
- block: useBlock(),
65
- rootState: props.context.rootState,
66
- rootSetState: props.context.rootSetState,
67
- localState: props.context.localState,
68
- context: props.context.context,
69
- });
70
- }
71
-
72
- function attributes() {
73
- const blockProperties = getBlockProperties(useBlock());
74
- return {
75
- ...blockProperties,
76
- ...(TARGET === "reactNative"
77
- ? {
78
- style: getReactNativeBlockStyles({
79
- block: useBlock(),
80
- context: props.context,
81
- blockStyles: blockProperties.style,
82
- }),
83
- }
84
- : {}),
85
- };
86
- }
87
-
88
62
  function childrenWithoutParentComponent() {
89
63
  /**
90
64
  * When there is no `componentRef`, there might still be children that need to be rendered. In this case,
@@ -93,70 +67,81 @@ function RenderBlock(props) {
93
67
  * blocks, and the children will be repeated within those blocks.
94
68
  */
95
69
  const shouldRenderChildrenOutsideRef =
96
- !component()?.component && !repeatItem();
97
- return shouldRenderChildrenOutsideRef ? useBlock().children ?? [] : [];
70
+ !blockComponent()?.component && !repeatItem();
71
+ return shouldRenderChildrenOutsideRef
72
+ ? processedBlock().children ?? []
73
+ : [];
98
74
  }
99
75
 
100
- function renderComponentProps() {
76
+ function componentRefProps() {
101
77
  return {
102
- blockChildren: useBlock().children ?? [],
103
- componentRef: component()?.component,
78
+ blockChildren: processedBlock().children ?? [],
79
+ componentRef: blockComponent()?.component,
104
80
  componentOptions: {
105
- ...getBlockComponentOptions(useBlock()),
106
- /**
107
- * These attributes are passed to the wrapper element when there is one. If `noWrap` is set to true, then
108
- * they are provided to the component itself directly.
109
- */
110
- ...(!component()?.noWrap
111
- ? {}
112
- : {
113
- attributes: {
114
- ...attributes(),
115
- ...actions(),
116
- },
117
- }),
81
+ ...getBlockComponentOptions(processedBlock()),
82
+ builderContext: props.context,
83
+ ...(blockComponent()?.name === "Symbol" ||
84
+ blockComponent()?.name === "Columns"
85
+ ? {
86
+ builderComponents: props.registeredComponents,
87
+ }
88
+ : {}),
118
89
  },
119
90
  context: childrenContext(),
91
+ registeredComponents: props.registeredComponents,
92
+ builderBlock: processedBlock(),
93
+ includeBlockProps: blockComponent()?.noWrap === true,
94
+ isInteractive: !blockComponent()?.isRSC,
120
95
  };
121
96
  }
122
97
 
123
98
  return (
124
99
  <Show when={canShowBlock()}>
125
100
  <Show
126
- fallback={
127
- <RenderComponent {...renderComponentProps()}></RenderComponent>
128
- }
129
- when={!component()?.noWrap}
101
+ fallback={<ComponentRef {...componentRefProps()}></ComponentRef>}
102
+ when={!blockComponent()?.noWrap}
130
103
  >
131
104
  <Show when={isEmptyHtmlElement(Tag())}>
132
- <Dynamic {...attributes()} {...actions()} component={Tag()}></Dynamic>
105
+ <BlockWrapper
106
+ Wrapper={Tag()}
107
+ block={processedBlock()}
108
+ context={props.context}
109
+ hasChildren={false}
110
+ ></BlockWrapper>
133
111
  </Show>
134
112
  <Show when={!isEmptyHtmlElement(Tag()) && repeatItem()}>
135
113
  <For each={repeatItem()}>
136
114
  {(data, _index) => {
137
115
  const index = _index();
138
116
  return (
139
- <RenderRepeatedBlock
117
+ <RepeatedBlock
140
118
  key={index}
141
119
  repeatContext={data.context}
142
120
  block={data.block}
143
- ></RenderRepeatedBlock>
121
+ registeredComponents={props.registeredComponents}
122
+ ></RepeatedBlock>
144
123
  );
145
124
  }}
146
125
  </For>
147
126
  </Show>
148
127
  <Show when={!isEmptyHtmlElement(Tag()) && !repeatItem()}>
149
- <Dynamic {...attributes()} {...actions()} component={Tag()}>
150
- <RenderComponent {...renderComponentProps()}></RenderComponent>
128
+ <BlockWrapper
129
+ Wrapper={Tag()}
130
+ block={processedBlock()}
131
+ context={props.context}
132
+ hasChildren={true}
133
+ >
134
+ <ComponentRef {...componentRefProps()}></ComponentRef>
151
135
  <For each={childrenWithoutParentComponent()}>
152
136
  {(child, _index) => {
153
137
  const index = _index();
154
138
  return (
155
- <RenderBlock
156
- key={"render-block-" + child.id}
139
+ <Block
140
+ key={"block-" + child.id}
157
141
  block={child}
158
142
  context={childrenContext()}
159
- ></RenderBlock>
143
+ registeredComponents={props.registeredComponents}
144
+ ></Block>
160
145
  );
161
146
  }}
162
147
  </For>
@@ -172,11 +157,11 @@ function RenderBlock(props) {
172
157
  );
173
158
  }}
174
159
  </For>
175
- </Dynamic>
160
+ </BlockWrapper>
176
161
  </Show>
177
162
  </Show>
178
163
  </Show>
179
164
  );
180
165
  }
181
166
 
182
- export default RenderBlock;
167
+ export default Block;
@@ -3,38 +3,38 @@ import { Show, createSignal } from "solid-js";
3
3
  import {
4
4
  getMaxWidthQueryForSize,
5
5
  getSizesForBreakpoints,
6
- } from "../../constants/device-sizes.js";
7
- import { TARGET } from "../../constants/target.js";
8
- import { getProcessedBlock } from "../../functions/get-processed-block.js";
9
- import { createCssClass } from "../../helpers/css.js";
10
- import { checkIsDefined } from "../../helpers/nullable.js";
11
- import InlinedStyles from "../inlined-styles";
6
+ } from "../../../constants/device-sizes.js";
7
+ import { TARGET } from "../../../constants/target.js";
8
+ import { getProcessedBlock } from "../../../functions/get-processed-block.js";
9
+ import { createCssClass } from "../../../helpers/css.js";
10
+ import { checkIsDefined } from "../../../helpers/nullable.js";
11
+ import InlinedStyles from "../../inlined-styles.jsx";
12
12
 
13
13
  function BlockStyles(props) {
14
- function useBlock() {
15
- return getProcessedBlock({
14
+ const [processedBlock, setProcessedBlock] = createSignal(
15
+ getProcessedBlock({
16
16
  block: props.block,
17
17
  localState: props.context.localState,
18
18
  rootState: props.context.rootState,
19
19
  rootSetState: props.context.rootSetState,
20
20
  context: props.context.context,
21
21
  shouldEvaluateBindings: true,
22
- });
23
- }
22
+ })
23
+ );
24
24
 
25
25
  function canShowBlock() {
26
26
  // only render styles for blocks that are visible
27
- if (checkIsDefined(useBlock().hide)) {
28
- return !useBlock().hide;
27
+ if (checkIsDefined(processedBlock().hide)) {
28
+ return !processedBlock().hide;
29
29
  }
30
- if (checkIsDefined(useBlock().show)) {
31
- return useBlock().show;
30
+ if (checkIsDefined(processedBlock().show)) {
31
+ return processedBlock().show;
32
32
  }
33
33
  return true;
34
34
  }
35
35
 
36
36
  function css() {
37
- const styles = useBlock().responsiveStyles;
37
+ const styles = processedBlock().responsiveStyles;
38
38
  const content = props.context.content;
39
39
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
40
40
  content?.meta?.breakpoints || {}
@@ -42,7 +42,7 @@ function BlockStyles(props) {
42
42
  const largeStyles = styles?.large;
43
43
  const mediumStyles = styles?.medium;
44
44
  const smallStyles = styles?.small;
45
- const className = useBlock().id;
45
+ const className = processedBlock().id;
46
46
  if (!className) {
47
47
  return "";
48
48
  }