@builder.io/sdk-react 0.0.1 → 0.0.3

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 (141) hide show
  1. package/package.json +5 -1
  2. package/packages/_rsc/src/blocks/BaseText.js +27 -0
  3. package/packages/_rsc/src/blocks/button/button.js +35 -0
  4. package/packages/_rsc/src/blocks/button/component-info.js +41 -0
  5. package/packages/_rsc/src/blocks/columns/columns.js +96 -0
  6. package/packages/_rsc/src/blocks/columns/component-info.js +242 -0
  7. package/packages/_rsc/src/blocks/custom-code/component-info.js +31 -0
  8. package/packages/_rsc/src/blocks/custom-code/custom-code.js +63 -0
  9. package/packages/_rsc/src/blocks/embed/component-info.js +44 -0
  10. package/packages/_rsc/src/blocks/embed/embed.js +55 -0
  11. package/packages/_rsc/src/blocks/embed/helpers.js +9 -0
  12. package/packages/_rsc/src/blocks/form/component-info.js +262 -0
  13. package/packages/_rsc/src/blocks/form/form.js +222 -0
  14. package/packages/_rsc/src/blocks/fragment/component-info.js +11 -0
  15. package/packages/_rsc/src/blocks/fragment/fragment.js +24 -0
  16. package/packages/_rsc/src/blocks/image/component-info.js +151 -0
  17. package/packages/_rsc/src/blocks/image/image.helpers.js +48 -0
  18. package/packages/_rsc/src/blocks/image/image.js +95 -0
  19. package/packages/_rsc/src/blocks/img/component-info.js +20 -0
  20. package/packages/_rsc/src/blocks/img/img.js +33 -0
  21. package/packages/_rsc/src/blocks/input/component-info.js +74 -0
  22. package/packages/_rsc/src/blocks/input/input.js +36 -0
  23. package/packages/_rsc/src/blocks/raw-text/component-info.js +16 -0
  24. package/packages/_rsc/src/blocks/raw-text/raw-text.js +28 -0
  25. package/packages/_rsc/src/blocks/section/component-info.js +49 -0
  26. package/packages/_rsc/src/blocks/section/section.js +31 -0
  27. package/packages/_rsc/src/blocks/select/component-info.js +59 -0
  28. package/packages/_rsc/src/blocks/select/select.js +36 -0
  29. package/packages/_rsc/src/blocks/submit-button/component-info.js +28 -0
  30. package/packages/_rsc/src/blocks/submit-button/submit-button.js +26 -0
  31. package/packages/_rsc/src/blocks/symbol/component-info.js +43 -0
  32. package/packages/_rsc/src/blocks/symbol/symbol.js +51 -0
  33. package/packages/_rsc/src/blocks/text/component-info.js +24 -0
  34. package/packages/_rsc/src/blocks/text/text.js +27 -0
  35. package/packages/_rsc/src/blocks/textarea/component-info.js +47 -0
  36. package/packages/_rsc/src/blocks/textarea/textarea.js +32 -0
  37. package/packages/_rsc/src/blocks/util.js +8 -0
  38. package/packages/_rsc/src/blocks/video/component-info.js +106 -0
  39. package/packages/_rsc/src/blocks/video/video.js +57 -0
  40. package/packages/_rsc/src/components/render-block/block-styles.js +70 -0
  41. package/packages/_rsc/src/components/render-block/render-block.helpers.js +23 -0
  42. package/packages/_rsc/src/components/render-block/render-block.js +203 -0
  43. package/packages/_rsc/src/components/render-block/render-component-with-context.js +51 -0
  44. package/packages/_rsc/src/components/render-block/render-component.js +43 -0
  45. package/packages/_rsc/src/components/render-block/render-repeated-block.js +49 -0
  46. package/packages/_rsc/src/components/render-block/types.js +0 -0
  47. package/packages/_rsc/src/components/render-blocks.js +80 -0
  48. package/packages/_rsc/src/components/render-content/builder-editing.js +35 -0
  49. package/packages/_rsc/src/components/render-content/components/render-styles.js +78 -0
  50. package/packages/_rsc/src/components/render-content/index.js +4 -0
  51. package/packages/_rsc/src/components/render-content/render-content.js +198 -0
  52. package/packages/_rsc/src/components/render-inlined-styles.js +36 -0
  53. package/packages/_rsc/src/constants/builder-registered-components.js +54 -0
  54. package/packages/_rsc/src/constants/device-sizes.js +48 -0
  55. package/packages/_rsc/src/constants/target.js +4 -0
  56. package/packages/_rsc/src/context/builder.context.js +11 -0
  57. package/packages/_rsc/src/context/types.js +0 -0
  58. package/packages/_rsc/src/functions/camel-to-kebab-case.js +4 -0
  59. package/packages/_rsc/src/functions/evaluate.js +6 -0
  60. package/packages/_rsc/src/functions/event-handler-name.js +7 -0
  61. package/packages/_rsc/src/functions/extract-text-styles.js +22 -0
  62. package/packages/_rsc/src/functions/fast-clone.js +4 -0
  63. package/packages/_rsc/src/functions/get-block-actions-handler.js +12 -0
  64. package/packages/_rsc/src/functions/get-block-actions.js +18 -0
  65. package/packages/_rsc/src/functions/get-block-component-options.js +28 -0
  66. package/packages/_rsc/src/functions/get-block-properties.js +29 -0
  67. package/packages/_rsc/src/functions/get-block-tag.js +6 -0
  68. package/packages/_rsc/src/functions/get-builder-search-params/fn.test.js +13 -0
  69. package/packages/_rsc/src/functions/get-builder-search-params/index.js +37 -0
  70. package/packages/_rsc/src/functions/get-content/ab-testing.js +99 -0
  71. package/packages/_rsc/src/functions/get-content/fn.test.js +31 -0
  72. package/packages/_rsc/src/functions/get-content/index.js +100 -0
  73. package/packages/_rsc/src/functions/get-content/types.js +0 -0
  74. package/packages/_rsc/src/functions/get-fetch.js +34 -0
  75. package/packages/_rsc/src/functions/get-global-this.js +18 -0
  76. package/packages/_rsc/src/functions/get-processed-block.js +59 -0
  77. package/packages/_rsc/src/functions/get-processed-block.test.js +32 -0
  78. package/packages/_rsc/src/functions/get-react-native-block-styles.js +32 -0
  79. package/packages/_rsc/src/functions/if-target.js +15 -0
  80. package/packages/_rsc/src/functions/is-browser.js +6 -0
  81. package/packages/_rsc/src/functions/is-editing.js +7 -0
  82. package/packages/_rsc/src/functions/is-iframe.js +7 -0
  83. package/packages/_rsc/src/functions/is-previewing.js +14 -0
  84. package/packages/_rsc/src/functions/mark-mutable.js +10 -0
  85. package/packages/_rsc/src/functions/on-change.js +27 -0
  86. package/packages/_rsc/src/functions/on-change.test.js +19 -0
  87. package/packages/_rsc/src/functions/register-component.js +68 -0
  88. package/packages/_rsc/src/functions/register.js +29 -0
  89. package/packages/_rsc/src/functions/sanitize-react-native-block-styles.js +66 -0
  90. package/packages/_rsc/src/functions/set-editor-settings.js +15 -0
  91. package/packages/_rsc/src/functions/set.js +11 -0
  92. package/packages/_rsc/src/functions/set.test.js +16 -0
  93. package/packages/_rsc/src/functions/track.js +120 -0
  94. package/packages/_rsc/src/functions/transform-block.js +6 -0
  95. package/packages/_rsc/src/helpers/ab-tests.js +16 -0
  96. package/packages/_rsc/src/helpers/cookie.js +79 -0
  97. package/packages/_rsc/src/helpers/css.js +28 -0
  98. package/packages/_rsc/src/helpers/flatten.js +34 -0
  99. package/packages/_rsc/src/helpers/localStorage.js +34 -0
  100. package/packages/_rsc/src/helpers/nullable.js +4 -0
  101. package/packages/_rsc/src/helpers/sessionId.js +49 -0
  102. package/packages/_rsc/src/helpers/time.js +5 -0
  103. package/packages/_rsc/src/helpers/url.js +10 -0
  104. package/packages/_rsc/src/helpers/url.test.js +15 -0
  105. package/packages/_rsc/src/helpers/uuid.js +13 -0
  106. package/packages/_rsc/src/helpers/visitorId.js +33 -0
  107. package/packages/_rsc/src/index-helpers/blocks-exports.js +22 -0
  108. package/packages/_rsc/src/index-helpers/top-of-file.js +2 -0
  109. package/packages/_rsc/src/index.js +14 -0
  110. package/packages/_rsc/src/scripts/init-editing.js +87 -0
  111. package/packages/_rsc/src/types/builder-block.js +0 -0
  112. package/packages/_rsc/src/types/builder-content.js +0 -0
  113. package/packages/_rsc/src/types/can-track.js +0 -0
  114. package/packages/_rsc/src/types/components.js +0 -0
  115. package/packages/_rsc/src/types/deep-partial.js +0 -0
  116. package/packages/_rsc/src/types/element.js +0 -0
  117. package/packages/_rsc/src/types/targets.js +0 -0
  118. package/packages/_rsc/src/types/typescript.js +0 -0
  119. package/src/blocks/button/button.jsx +6 -5
  120. package/src/blocks/columns/columns.jsx +9 -10
  121. package/src/blocks/columns/component-info.js +2 -2
  122. package/src/blocks/embed/component-info.js +2 -2
  123. package/src/blocks/form/form.jsx +4 -7
  124. package/src/blocks/image/component-info.js +2 -2
  125. package/src/blocks/img/img.jsx +2 -5
  126. package/src/blocks/submit-button/submit-button.jsx +2 -5
  127. package/src/blocks/symbol/symbol.jsx +3 -4
  128. package/src/blocks/util.js +6 -5
  129. package/src/components/render-block/block-styles.jsx +9 -3
  130. package/src/components/render-block/render-block.jsx +7 -7
  131. package/src/components/render-block/render-component.jsx +1 -2
  132. package/src/components/render-content/builder-editing.jsx +7 -0
  133. package/src/components/render-content/render-content.jsx +16 -11
  134. package/src/components/render-inlined-styles.jsx +4 -4
  135. package/src/constants/device-sizes.js +29 -2
  136. package/src/constants/target.js +1 -1
  137. package/src/functions/get-content/index.js +6 -2
  138. package/src/functions/register-component.js +1 -5
  139. package/src/functions/track.js +11 -8
  140. package/src/index.js +5 -1
  141. package/src/scripts/init-editing.js +7 -1
@@ -0,0 +1,10 @@
1
+ const getTopLevelDomain = (host) => {
2
+ const parts = host.split(".");
3
+ if (parts.length > 2) {
4
+ return parts.slice(1).join(".");
5
+ }
6
+ return host;
7
+ };
8
+ export {
9
+ getTopLevelDomain
10
+ };
@@ -0,0 +1,15 @@
1
+ import { getTopLevelDomain } from "./url.js";
2
+ describe("getTopLevelDomain", () => {
3
+ test("handles root domain", () => {
4
+ const output = getTopLevelDomain("example.com");
5
+ expect(output).toBe("example.com");
6
+ });
7
+ test("handles subdomain", () => {
8
+ const output = getTopLevelDomain("wwww.example.com");
9
+ expect(output).toBe("example.com");
10
+ });
11
+ test("handles subdomain with long suffix", () => {
12
+ const output = getTopLevelDomain("www.example.co.uk");
13
+ expect(output).toBe("example.co.uk");
14
+ });
15
+ });
@@ -0,0 +1,13 @@
1
+ function uuidv4() {
2
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
3
+ const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
4
+ return v.toString(16);
5
+ });
6
+ }
7
+ function uuid() {
8
+ return uuidv4().replace(/-/g, "");
9
+ }
10
+ export {
11
+ uuid,
12
+ uuidv4
13
+ };
@@ -0,0 +1,33 @@
1
+ import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
2
+ import { checkIsDefined } from "./nullable.js";
3
+ import { uuid } from "./uuid.js";
4
+ const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
5
+ const getVisitorId = ({ canTrack }) => {
6
+ if (!canTrack) {
7
+ return void 0;
8
+ }
9
+ const visitorId = getLocalStorageItem({
10
+ key: VISITOR_LOCAL_STORAGE_KEY,
11
+ canTrack
12
+ });
13
+ if (checkIsDefined(visitorId)) {
14
+ return visitorId;
15
+ } else {
16
+ const newVisitorId = createVisitorId();
17
+ setVisitorId({ id: newVisitorId, canTrack });
18
+ }
19
+ };
20
+ const createVisitorId = () => uuid();
21
+ const setVisitorId = ({
22
+ id,
23
+ canTrack
24
+ }) => setLocalStorageItem({
25
+ key: VISITOR_LOCAL_STORAGE_KEY,
26
+ value: id,
27
+ canTrack
28
+ });
29
+ export {
30
+ createVisitorId,
31
+ getVisitorId,
32
+ setVisitorId
33
+ };
@@ -0,0 +1,22 @@
1
+ import { default as default2 } from "../blocks/columns/columns.js";
2
+ import { default as default3 } from "../blocks/image/image.js";
3
+ import { default as default4 } from "../blocks/text/text.js";
4
+ import { default as default5 } from "../blocks/video/video.js";
5
+ import { default as default6 } from "../blocks/symbol/symbol.js";
6
+ import { default as default7 } from "../blocks/button/button.js";
7
+ import { default as default8 } from "../blocks/section/section.js";
8
+ import { default as default9 } from "../blocks/fragment/fragment.js";
9
+ import { default as default10 } from "../components/render-content/render-content.js";
10
+ import { default as default11 } from "../components/render-blocks.js";
11
+ export {
12
+ default7 as Button,
13
+ default2 as Columns,
14
+ default9 as Fragment,
15
+ default3 as Image,
16
+ default11 as RenderBlocks,
17
+ default10 as RenderContent,
18
+ default8 as Section,
19
+ default6 as Symbol,
20
+ default4 as Text,
21
+ default5 as Video
22
+ };
@@ -0,0 +1,2 @@
1
+ export * from "../components/render-content/builder-editing";
2
+ export * from "../constants/builder-registered-components";
@@ -0,0 +1,14 @@
1
+ export * from "./index-helpers/top-of-file.js";
2
+ import "./scripts/init-editing.js";
3
+ export * from "./index-helpers/blocks-exports.js";
4
+ export * from "./functions/is-editing.js";
5
+ export * from "./functions/is-previewing.js";
6
+ export * from "./functions/register-component.js";
7
+ export * from "./functions/register.js";
8
+ export * from "./functions/set-editor-settings.js";
9
+ export * from "./functions/get-content/index.js";
10
+ export * from "./functions/get-builder-search-params/index.js";
11
+ import { track } from "./functions/track";
12
+ export {
13
+ track
14
+ };
@@ -0,0 +1,87 @@
1
+ import { TARGET } from "../constants/target.js";
2
+ import { isBrowser } from "../functions/is-browser.js";
3
+ import { register } from "../functions/register.js";
4
+ const registerInsertMenu = () => {
5
+ register("insertMenu", {
6
+ name: "_default",
7
+ default: true,
8
+ items: [
9
+ { name: "Box" },
10
+ { name: "Text" },
11
+ { name: "Image" },
12
+ { name: "Columns" },
13
+ ...TARGET === "reactNative" ? [] : [
14
+ { name: "Core:Section" },
15
+ { name: "Core:Button" },
16
+ { name: "Embed" },
17
+ { name: "Custom Code" }
18
+ ]
19
+ ]
20
+ });
21
+ };
22
+ let isSetupForEditing = false;
23
+ const setupBrowserForEditing = () => {
24
+ var _a;
25
+ if (isSetupForEditing) {
26
+ return;
27
+ }
28
+ isSetupForEditing = true;
29
+ if (isBrowser()) {
30
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
31
+ type: "builder.sdkInfo",
32
+ data: {
33
+ target: TARGET,
34
+ supportsPatchUpdates: false,
35
+ supportsAddBlockScoping: true,
36
+ supportsCustomBreakpoints: true
37
+ }
38
+ }, "*");
39
+ window.addEventListener("message", ({ data }) => {
40
+ var _a2, _b;
41
+ if (!(data == null ? void 0 : data.type)) {
42
+ return;
43
+ }
44
+ switch (data.type) {
45
+ case "builder.evaluate": {
46
+ const text = data.data.text;
47
+ const args = data.data.arguments || [];
48
+ const id = data.data.id;
49
+ const fn = new Function(text);
50
+ let result;
51
+ let error = null;
52
+ try {
53
+ result = fn.apply(null, args);
54
+ } catch (err) {
55
+ error = err;
56
+ }
57
+ if (error) {
58
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
59
+ type: "builder.evaluateError",
60
+ data: { id, error: error.message }
61
+ }, "*");
62
+ } else {
63
+ if (result && typeof result.then === "function") {
64
+ result.then((finalResult) => {
65
+ var _a3;
66
+ (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
67
+ type: "builder.evaluateResult",
68
+ data: { id, result: finalResult }
69
+ }, "*");
70
+ }).catch(console.error);
71
+ } else {
72
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
73
+ type: "builder.evaluateResult",
74
+ data: { result, id }
75
+ }, "*");
76
+ }
77
+ }
78
+ break;
79
+ }
80
+ }
81
+ });
82
+ }
83
+ };
84
+ export {
85
+ registerInsertMenu,
86
+ setupBrowserForEditing
87
+ };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -19,13 +19,14 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import * as React from "react";
21
21
  function Button(props) {
22
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("a", __spreadProps(__spreadValues({}, props.attributes), {
23
- role: "button",
22
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("a", __spreadProps(__spreadValues({
23
+ role: "button"
24
+ }, props.attributes), {
24
25
  href: props.link,
25
26
  target: props.openLinkInNewTab ? "_blank" : void 0
26
- }), props.text)) : /* @__PURE__ */ React.createElement("button", __spreadProps(__spreadValues({}, props.attributes), {
27
- className: "button-31efdaa8"
28
- }), props.text), /* @__PURE__ */ React.createElement("style", null, `.button-31efdaa8 {
27
+ }), props.text)) : /* @__PURE__ */ React.createElement("button", __spreadValues({
28
+ className: "button-7028b0a4"
29
+ }, props.attributes), props.text), /* @__PURE__ */ React.createElement("style", null, `.button-7028b0a4 {
29
30
  all: unset; }`));
30
31
  }
31
32
  export {
@@ -16,7 +16,6 @@ var __spreadValues = (a, b) => {
16
16
  };
17
17
  import * as React from "react";
18
18
  import RenderBlocks from "../../components/render-blocks.jsx";
19
- import { markMutable } from "../../functions/mark-mutable";
20
19
  function Columns(props) {
21
20
  var _a;
22
21
  function getGutterSize() {
@@ -58,33 +57,33 @@ function Columns(props) {
58
57
  };
59
58
  }
60
59
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
61
- className: "builder-columns div-4fe0d43b",
60
+ className: "builder-columns div-48253552",
62
61
  style: columnsCssVars()
63
62
  }, (_a = props.columns) == null ? void 0 : _a.map((column, index) => /* @__PURE__ */ React.createElement("div", {
64
- className: "builder-column div-4fe0d43b-2",
63
+ className: "builder-column div-48253552-2",
65
64
  style: __spreadValues({
66
65
  width: getColumnCssWidth(index),
67
66
  marginLeft: `${index === 0 ? 0 : getGutterSize()}px`
68
67
  }, columnCssVars()),
69
68
  key: index
70
69
  }, /* @__PURE__ */ React.createElement(RenderBlocks, {
71
- blocks: markMutable(column.blocks),
70
+ blocks: column.blocks,
72
71
  path: `component.options.columns.${index}.blocks`,
73
72
  parent: props.builderBlock.id,
74
73
  styleProp: {
75
74
  flexGrow: "1"
76
75
  }
77
- })))), /* @__PURE__ */ React.createElement("style", null, `.div-4fe0d43b {
76
+ })))), /* @__PURE__ */ React.createElement("style", null, `.div-48253552 {
78
77
  display: flex;
79
78
  align-items: stretch;
80
- line-height: normal; }@media (max-width: 991px) { .div-4fe0d43b {
81
- flex-direction: var(--flex-dir-tablet); } }@media (max-width: 639px) { .div-4fe0d43b {
82
- flex-direction: var(--flex-dir); } }.div-4fe0d43b-2 {
79
+ line-height: normal; }@media (max-width: 991px) { .div-48253552 {
80
+ flex-direction: var(--flex-dir-tablet); } }@media (max-width: 639px) { .div-48253552 {
81
+ flex-direction: var(--flex-dir); } }.div-48253552-2 {
83
82
  display: flex;
84
83
  flex-direction: column;
85
- align-items: stretch; }@media (max-width: 991px) { .div-4fe0d43b-2 {
84
+ align-items: stretch; }@media (max-width: 991px) { .div-48253552-2 {
86
85
  width: var(--column-width-tablet) !important;
87
- margin-left: var(--column-margin-left-tablet) !important; } }@media (max-width: 639px) { .div-4fe0d43b-2 {
86
+ margin-left: var(--column-margin-left-tablet) !important; } }@media (max-width: 639px) { .div-48253552-2 {
88
87
  width: var(--column-width) !important;
89
88
  margin-left: var(--column-margin-left) !important; } }`));
90
89
  }
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util.js";
1
+ import { serializeFn } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Columns",
4
4
  builtIn: true,
@@ -187,7 +187,7 @@ const componentInfo = {
187
187
  ]
188
188
  }
189
189
  ],
190
- onChange: markSerializable((options) => {
190
+ onChange: serializeFn((options) => {
191
191
  function clearWidths() {
192
192
  columns.forEach((col) => {
193
193
  col.delete("width");
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util.js";
1
+ import { serializeFn } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Embed",
4
4
  static: true,
@@ -10,7 +10,7 @@ const componentInfo = {
10
10
  required: true,
11
11
  defaultValue: "",
12
12
  helperText: "e.g. enter a youtube url, google map, etc",
13
- onChange: markSerializable((options) => {
13
+ onChange: serializeFn((options) => {
14
14
  const url = options.get("url");
15
15
  if (url) {
16
16
  options.set("content", "Loading...");
@@ -1,6 +1,4 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  var __async = (__this, __arguments, generator) => {
21
18
  return new Promise((resolve, reject) => {
22
19
  var fulfilled = (value) => {
@@ -192,14 +189,14 @@ function FormComponent(props) {
192
189
  }
193
190
  }
194
191
  const builderContext = useContext(BuilderContext);
195
- return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", /* @__PURE__ */ React.createElement("form", __spreadProps(__spreadValues({}, props.attributes), {
192
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, " ", /* @__PURE__ */ React.createElement("form", __spreadValues({
196
193
  validate: props.validate,
197
194
  ref: formRef,
198
195
  action: !props.sendWithJs && props.action,
199
196
  method: props.method,
200
197
  name: props.name,
201
198
  onSubmit: (event) => onSubmit(event)
202
- }), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
199
+ }, props.attributes), " ", props.builderBlock && props.builderBlock.children ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.map((block) => /* @__PURE__ */ React.createElement(RenderBlock, {
203
200
  block,
204
201
  context: builderContext
205
202
  }))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
@@ -209,11 +206,11 @@ function FormComponent(props) {
209
206
  dataPath: "sendingMessage",
210
207
  blocks: props.sendingMessage
211
208
  })) : null, " ", submissionState() === "error" && responseData ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("pre", {
212
- className: "builder-form-error-text pre-928514ea"
209
+ className: "builder-form-error-text pre-bdd3175a"
213
210
  }, " ", JSON.stringify(responseData, null, 2), " ")) : null, " ", submissionState() === "success" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
214
211
  dataPath: "successMessage",
215
212
  blocks: props.successMessage
216
- })) : null, " "), " ", /* @__PURE__ */ React.createElement("style", null, `.pre-928514ea { padding: 10px; color: red; text-align: center; }`), " ");
213
+ })) : null, " "), " ", /* @__PURE__ */ React.createElement("style", null, `.pre-bdd3175a { padding: 10px; color: red; text-align: center; }`), " ");
217
214
  }
218
215
  export {
219
216
  FormComponent as default
@@ -1,4 +1,4 @@
1
- import { markSerializable } from "../util.js";
1
+ import { serializeFn } from "../util.js";
2
2
  const componentInfo = {
3
3
  name: "Image",
4
4
  static: true,
@@ -19,7 +19,7 @@ const componentInfo = {
19
19
  allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
20
20
  required: true,
21
21
  defaultValue: "https://cdn.builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
22
- onChange: markSerializable((options) => {
22
+ onChange: serializeFn((options) => {
23
23
  const DEFAULT_ASPECT_RATIO = 0.7041;
24
24
  options.delete("srcset");
25
25
  options.delete("noWebp");
@@ -1,6 +1,4 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -16,11 +14,10 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  import * as React from "react";
21
18
  import { isEditing } from "../../functions/is-editing.js";
22
19
  function ImgComponent(props) {
23
- return /* @__PURE__ */ React.createElement("img", __spreadProps(__spreadValues({}, props.attributes), {
20
+ return /* @__PURE__ */ React.createElement("img", __spreadValues({
24
21
  style: {
25
22
  objectFit: props.backgroundSize || "cover",
26
23
  objectPosition: props.backgroundPosition || "center"
@@ -28,7 +25,7 @@ function ImgComponent(props) {
28
25
  key: isEditing() && props.imgSrc || "default-key",
29
26
  alt: props.altText,
30
27
  src: props.imgSrc || props.image
31
- }));
28
+ }, props.attributes));
32
29
  }
33
30
  export {
34
31
  ImgComponent as default
@@ -1,6 +1,4 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -16,12 +14,11 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  import * as React from "react";
21
18
  function SubmitButton(props) {
22
- return /* @__PURE__ */ React.createElement("button", __spreadProps(__spreadValues({}, props.attributes), {
19
+ return /* @__PURE__ */ React.createElement("button", __spreadValues({
23
20
  type: "submit"
24
- }), props.text);
21
+ }, props.attributes), props.text);
25
22
  }
26
23
  export {
27
24
  SubmitButton as default
@@ -22,7 +22,6 @@ import { useState, useContext, useEffect } from "react";
22
22
  import RenderContent from "../../components/render-content/render-content.jsx";
23
23
  import BuilderContext from "../../context/builder.context.js";
24
24
  import { getContent } from "../../functions/get-content/index.js";
25
- import { markMutable } from "../../functions/mark-mutable";
26
25
  function Symbol(props) {
27
26
  var _a, _b, _c, _d, _e;
28
27
  const [className, setClassName] = useState(() => "builder-symbol");
@@ -54,10 +53,10 @@ function Symbol(props) {
54
53
  }), /* @__PURE__ */ React.createElement(RenderContent, {
55
54
  apiKey: builderContext.apiKey,
56
55
  context: builderContext.context,
57
- customComponents: markMutable(Object.values(builderContext.registeredComponents)),
58
- data: markMutable(__spreadValues(__spreadValues(__spreadValues({}, (_a = props.symbol) == null ? void 0 : _a.data), builderContext.state), (_d = (_c = (_b = props.symbol) == null ? void 0 : _b.content) == null ? void 0 : _c.data) == null ? void 0 : _d.state)),
56
+ customComponents: Object.values(builderContext.registeredComponents),
57
+ data: __spreadValues(__spreadValues(__spreadValues({}, (_a = props.symbol) == null ? void 0 : _a.data), builderContext.state), (_d = (_c = (_b = props.symbol) == null ? void 0 : _b.content) == null ? void 0 : _c.data) == null ? void 0 : _d.state),
59
58
  model: (_e = props.symbol) == null ? void 0 : _e.model,
60
- content: markMutable(contentToUse())
59
+ content: contentToUse()
61
60
  }));
62
61
  }
63
62
  export {
@@ -1,7 +1,8 @@
1
- function markSerializable(fn) {
2
- fn.__qwik_serializable__ = true;
3
- return fn;
4
- }
1
+ const serializeFn = (fnValue) => {
2
+ const fnStr = fnValue.toString().trim();
3
+ const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
4
+ return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
5
+ };
5
6
  export {
6
- markSerializable
7
+ serializeFn
7
8
  };
@@ -1,5 +1,8 @@
1
1
  import * as React from "react";
2
- import { getMaxWidthQueryForSize } from "../../constants/device-sizes.js";
2
+ import {
3
+ getMaxWidthQueryForSize,
4
+ getSizesForBreakpoints
5
+ } from "../../constants/device-sizes.js";
3
6
  import { TARGET } from "../../constants/target.js";
4
7
  import { getProcessedBlock } from "../../functions/get-processed-block.js";
5
8
  import { createCssClass } from "../../helpers/css.js";
@@ -14,7 +17,10 @@ function BlockStyles(props) {
14
17
  });
15
18
  }
16
19
  function css() {
20
+ var _a;
17
21
  const styles = useBlock().responsiveStyles;
22
+ const content = props.context.content;
23
+ const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(((_a = content == null ? void 0 : content.meta) == null ? void 0 : _a.breakpoints) || {});
18
24
  const largeStyles = styles == null ? void 0 : styles.large;
19
25
  const mediumStyles = styles == null ? void 0 : styles.medium;
20
26
  const smallStyles = styles == null ? void 0 : styles.small;
@@ -26,12 +32,12 @@ function BlockStyles(props) {
26
32
  const mediumStylesClass = mediumStyles ? createCssClass({
27
33
  className,
28
34
  styles: mediumStyles,
29
- mediaQuery: getMaxWidthQueryForSize("medium")
35
+ mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
30
36
  }) : "";
31
37
  const smallStylesClass = smallStyles ? createCssClass({
32
38
  className,
33
39
  styles: smallStyles,
34
- mediaQuery: getMaxWidthQueryForSize("small")
40
+ mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
35
41
  }) : "";
36
42
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
37
43
  }
@@ -68,7 +68,7 @@ function RenderBlock(props) {
68
68
  return ref;
69
69
  }
70
70
  }
71
- function tagName() {
71
+ function tag() {
72
72
  return getBlockTag(useBlock());
73
73
  }
74
74
  function useBlock() {
@@ -98,7 +98,7 @@ function RenderBlock(props) {
98
98
  function renderComponentProps() {
99
99
  var _a2;
100
100
  return {
101
- blockChildren: children(),
101
+ blockChildren: useChildren(),
102
102
  componentRef: (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component,
103
103
  componentOptions: __spreadValues(__spreadValues({}, getBlockComponentOptions(useBlock())), shouldWrap() ? {} : {
104
104
  attributes: attributes()
@@ -106,14 +106,14 @@ function RenderBlock(props) {
106
106
  context: childrenContext()
107
107
  };
108
108
  }
109
- function children() {
109
+ function useChildren() {
110
110
  var _a2;
111
111
  return (_a2 = useBlock().children) != null ? _a2 : [];
112
112
  }
113
113
  function childrenWithoutParentComponent() {
114
114
  var _a2;
115
115
  const shouldRenderChildrenOutsideRef = !((_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component) && !repeatItemData();
116
- return shouldRenderChildrenOutsideRef ? children() : [];
116
+ return shouldRenderChildrenOutsideRef ? useChildren() : [];
117
117
  }
118
118
  function repeatItemData() {
119
119
  const _a2 = props.block, { repeat } = _a2, blockWithoutRepeat = __objRest(_a2, ["repeat"]);
@@ -174,12 +174,12 @@ function RenderBlock(props) {
174
174
  }
175
175
  const [componentInfo, setComponentInfo] = useState(() => null);
176
176
  const RenderComponentTagRef = renderComponentTag();
177
- const TagNameRef = tagName();
178
- return /* @__PURE__ */ React.createElement(React.Fragment, null, shouldWrap() ? /* @__PURE__ */ React.createElement(React.Fragment, null, isEmptyHtmlElement(tagName()) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()))) : null, !isEmptyHtmlElement(tagName()) && repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = repeatItemData()) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
177
+ const TagRef = tag();
178
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, shouldWrap() ? /* @__PURE__ */ React.createElement(React.Fragment, null, isEmptyHtmlElement(tag()) ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagRef, __spreadValues({}, attributes()))) : null, !isEmptyHtmlElement(tag()) && repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, (_a = repeatItemData()) == null ? void 0 : _a.map((data, index) => /* @__PURE__ */ React.createElement(RenderRepeatedBlock, {
179
179
  key: index,
180
180
  repeatContext: data.context,
181
181
  block: data.block
182
- }))) : null, !isEmptyHtmlElement(tagName()) && !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagNameRef, __spreadValues({}, attributes()), /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadValues({}, renderComponentProps())), (_b = childrenWithoutParentComponent()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
182
+ }))) : null, !isEmptyHtmlElement(tag()) && !repeatItemData() ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TagRef, __spreadValues({}, attributes()), /* @__PURE__ */ React.createElement(RenderComponentTagRef, __spreadValues({}, renderComponentProps())), (_b = childrenWithoutParentComponent()) == null ? void 0 : _b.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
183
183
  key: "render-block-" + child.id,
184
184
  block: child,
185
185
  context: childrenContext()
@@ -17,11 +17,10 @@ var __spreadValues = (a, b) => {
17
17
  import * as React from "react";
18
18
  import BlockStyles from "./block-styles.jsx";
19
19
  import RenderBlock from "./render-block.jsx";
20
- import { markPropsMutable } from "../../functions/mark-mutable.js";
21
20
  function RenderComponent(props) {
22
21
  var _a, _b;
23
22
  const ComponentRefRef = props.componentRef;
24
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.componentRef ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, markPropsMutable(props.componentOptions)), (_a = props.blockChildren) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
23
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.componentRef ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ComponentRefRef, __spreadValues({}, props.componentOptions), (_a = props.blockChildren) == null ? void 0 : _a.map((child) => /* @__PURE__ */ React.createElement(RenderBlock, {
25
24
  key: "render-block-" + child.id,
26
25
  block: child,
27
26
  context: props.context
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ function BuilderEditing(props) {
3
+ return /* @__PURE__ */ React.createElement("div", null);
4
+ }
5
+ export {
6
+ BuilderEditing as default
7
+ };