@builder.io/sdk-react-native 0.0.11 → 0.0.13

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react-native",
3
3
  "description": "Builder.io SDK for React Native",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "main": "src/index.js",
6
6
  "files": [
7
7
  "src"
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@react-native-async-storage/async-storage": "^1.17.10",
15
+ "node-fetch": "^2.6.1",
15
16
  "react-native-render-html": "^6.3.4",
16
17
  "react-native-storage": "^1.0.1",
17
18
  "react-native-video": "^5.1.1"
@@ -21,8 +21,9 @@ import BaseText from "../BaseText";
21
21
  import * as React from "react";
22
22
  import { View, StyleSheet } from "react-native";
23
23
  function Button(props) {
24
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
25
- role: "button",
24
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.link ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({
25
+ role: "button"
26
+ }, props.attributes), {
26
27
  href: props.link,
27
28
  target: props.openLinkInNewTab ? "_blank" : void 0
28
29
  }), /* @__PURE__ */ React.createElement(BaseText, null, props.text))) : /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
3
  import RenderBlocks from "../../components/render-blocks.js";
4
- import { markMutable } from "../../functions/mark-mutable";
5
4
  function Columns(props) {
6
5
  var _a;
7
6
  function getGutterSize() {
@@ -48,7 +47,7 @@ function Columns(props) {
48
47
  style: styles.view2,
49
48
  key: index
50
49
  }, /* @__PURE__ */ React.createElement(RenderBlocks, {
51
- blocks: markMutable(column.blocks),
50
+ blocks: column.blocks,
52
51
  path: `component.options.columns.${index}.blocks`,
53
52
  parent: props.builderBlock.id,
54
53
  styleProp: {
@@ -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) => {
@@ -194,14 +191,14 @@ function FormComponent(props) {
194
191
  }
195
192
  }
196
193
  const builderContext = useContext(BuilderContext);
197
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
194
+ return /* @__PURE__ */ React.createElement(View, __spreadValues({
198
195
  validate: props.validate,
199
196
  ref: formRef,
200
197
  action: !props.sendWithJs && props.action,
201
198
  method: props.method,
202
199
  name: props.name,
203
200
  onSubmit: (event) => onSubmit(event)
204
- }), " ", 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, {
201
+ }, 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, {
205
202
  block,
206
203
  context: builderContext
207
204
  }))) : null, " ", submissionState() === "error" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(BuilderBlocks, {
@@ -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,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
  import { View } from "react-native";
22
19
  import { isEditing } from "../../functions/is-editing.js";
23
20
  function ImgComponent(props) {
24
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
21
+ return /* @__PURE__ */ React.createElement(View, __spreadValues({
25
22
  style: {
26
23
  objectFit: props.backgroundSize || "cover",
27
24
  objectPosition: props.backgroundPosition || "center"
@@ -29,7 +26,7 @@ function ImgComponent(props) {
29
26
  key: isEditing() && props.imgSrc || "default-key",
30
27
  alt: props.altText,
31
28
  src: props.imgSrc || props.image
32
- }));
29
+ }, props.attributes));
33
30
  }
34
31
  export {
35
32
  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,14 +14,13 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  import BaseText from "../BaseText";
21
18
  import * as React from "react";
22
19
  import { View } from "react-native";
23
20
  function SubmitButton(props) {
24
- return /* @__PURE__ */ React.createElement(View, __spreadProps(__spreadValues({}, props.attributes), {
21
+ return /* @__PURE__ */ React.createElement(View, __spreadValues({
25
22
  type: "submit"
26
- }), /* @__PURE__ */ React.createElement(BaseText, null, props.text));
23
+ }, props.attributes), /* @__PURE__ */ React.createElement(BaseText, null, props.text));
27
24
  }
28
25
  export {
29
26
  SubmitButton as default
@@ -23,7 +23,6 @@ import { useState, useContext, useEffect } from "react";
23
23
  import RenderContent from "../../components/render-content/render-content.js";
24
24
  import BuilderContext from "../../context/builder.context.js";
25
25
  import { getContent } from "../../functions/get-content/index.js";
26
- import { markMutable } from "../../functions/mark-mutable";
27
26
  function Symbol(props) {
28
27
  var _a, _b, _c, _d, _e;
29
28
  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 {
@@ -16,6 +16,7 @@ var __spreadValues = (a, b) => {
16
16
  };
17
17
  import * as React from "react";
18
18
  import HTML from "react-native-render-html";
19
+ import BuilderContext from "../../context/builder.context";
19
20
  function camelToKebabCase(string) {
20
21
  return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
21
22
  }
@@ -39,8 +40,8 @@ function getBlockStyles(block) {
39
40
  }
40
41
  return styles;
41
42
  }
42
- function getCss(block) {
43
- const styleObject = pick(getBlockStyles(block), PICK_STYLES);
43
+ function getCss(block, inheritedStyles) {
44
+ const styleObject = __spreadValues(__spreadValues({}, inheritedStyles), pick(getBlockStyles(block), PICK_STYLES));
44
45
  if (!styleObject) {
45
46
  return "";
46
47
  }
@@ -54,9 +55,10 @@ function getCss(block) {
54
55
  return str;
55
56
  }
56
57
  function Text(props) {
58
+ const builderContext = React.useContext(BuilderContext);
57
59
  return /* @__PURE__ */ React.createElement(HTML, {
58
60
  source: {
59
- html: `<div style="${getCss(props.builderBlock)}">${props.text || ""}</div>`
61
+ html: `<div style="${getCss(props.builderBlock, builderContext.inheritedStyles)}">${props.text || ""}</div>`
60
62
  }
61
63
  });
62
64
  }
@@ -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
  }
@@ -30,6 +30,7 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import * as React from "react";
33
+ import { View } from "react-native";
33
34
  import { useState } from "react";
34
35
  import { getBlockActions } from "../../functions/get-block-actions.js";
35
36
  import { getBlockComponentOptions } from "../../functions/get-block-component-options.js";
@@ -68,7 +69,7 @@ function RenderBlock(props) {
68
69
  return ref;
69
70
  }
70
71
  }
71
- function tagName() {
72
+ function tag() {
72
73
  return getBlockTag(useBlock());
73
74
  }
74
75
  function useBlock() {
@@ -98,7 +99,7 @@ function RenderBlock(props) {
98
99
  function renderComponentProps() {
99
100
  var _a2;
100
101
  return {
101
- blockChildren: children(),
102
+ blockChildren: useChildren(),
102
103
  componentRef: (_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component,
103
104
  componentOptions: __spreadValues(__spreadValues({}, getBlockComponentOptions(useBlock())), shouldWrap() ? {} : {
104
105
  attributes: attributes()
@@ -106,14 +107,14 @@ function RenderBlock(props) {
106
107
  context: childrenContext()
107
108
  };
108
109
  }
109
- function children() {
110
+ function useChildren() {
110
111
  var _a2;
111
112
  return (_a2 = useBlock().children) != null ? _a2 : [];
112
113
  }
113
114
  function childrenWithoutParentComponent() {
114
115
  var _a2;
115
116
  const shouldRenderChildrenOutsideRef = !((_a2 = component == null ? void 0 : component()) == null ? void 0 : _a2.component) && !repeatItemData();
116
- return shouldRenderChildrenOutsideRef ? children() : [];
117
+ return shouldRenderChildrenOutsideRef ? useChildren() : [];
117
118
  }
118
119
  function repeatItemData() {
119
120
  const _a2 = props.block, { repeat } = _a2, blockWithoutRepeat = __objRest(_a2, ["repeat"]);
@@ -174,12 +175,11 @@ function RenderBlock(props) {
174
175
  }
175
176
  const [componentInfo, setComponentInfo] = useState(() => null);
176
177
  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, {
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(View, __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(View, __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.js";
19
19
  import RenderBlock from "./render-block.js";
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,8 @@
1
+ import * as React from "react";
2
+ import { View } from "react-native";
3
+ function BuilderEditing(props) {
4
+ return /* @__PURE__ */ React.createElement(View, null);
5
+ }
6
+ export {
7
+ BuilderEditing as default
8
+ };
@@ -40,7 +40,6 @@ import {
40
40
  registerInsertMenu,
41
41
  setupBrowserForEditing
42
42
  } from "../../scripts/init-editing.js";
43
- import { markMutable } from "../../functions/mark-mutable.js";
44
43
  function RenderContent(props) {
45
44
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
46
45
  const elementRef = useRef(null);
@@ -264,7 +263,7 @@ function RenderContent(props) {
264
263
  cssCode: (_g = (_f = useContent == null ? void 0 : useContent()) == null ? void 0 : _f.data) == null ? void 0 : _g.cssCode,
265
264
  customFonts: (_i = (_h = useContent == null ? void 0 : useContent()) == null ? void 0 : _h.data) == null ? void 0 : _i.customFonts
266
265
  }) : null, /* @__PURE__ */ React.createElement(RenderBlocks, {
267
- blocks: markMutable((_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks),
266
+ blocks: (_k = (_j = useContent == null ? void 0 : useContent()) == null ? void 0 : _j.data) == null ? void 0 : _k.blocks,
268
267
  key: forceReRenderCount
269
268
  }))) : null);
270
269
  }
@@ -3,15 +3,14 @@ import { View, Text } from "react-native";
3
3
  import { TARGET } from "../constants/target.js";
4
4
  function RenderInlinedStyles(props) {
5
5
  function injectedStyleScript() {
6
- return `<${tagName()}>${props.styles}</${tagName()}>`;
6
+ return `<${tag()}>${props.styles}</${tag()}>`;
7
7
  }
8
- function tagName() {
8
+ function tag() {
9
9
  return "style";
10
10
  }
11
- const TagNameRef = tagName();
12
11
  return /* @__PURE__ */ React.createElement(React.Fragment, null, TARGET === "svelte" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(View, {
13
12
  dangerouslySetInnerHTML: { __html: injectedStyleScript() }
14
- })) : /* @__PURE__ */ React.createElement(TagNameRef, null, /* @__PURE__ */ React.createElement(Text, null, props.styles)));
13
+ })) : /* @__PURE__ */ React.createElement(View, null, /* @__PURE__ */ React.createElement(Text, null, props.styles)));
15
14
  }
16
15
  export {
17
16
  RenderInlinedStyles as default
@@ -1,3 +1,4 @@
1
+ import { fastClone } from "../functions/fast-clone";
1
2
  const SIZES = {
2
3
  small: {
3
4
  min: 320,
@@ -15,7 +16,33 @@ const SIZES = {
15
16
  max: 1200
16
17
  }
17
18
  };
18
- const getMaxWidthQueryForSize = (size) => `@media (max-width: ${SIZES[size].max}px)`;
19
+ const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
20
+ const getSizesForBreakpoints = ({ small, medium }) => {
21
+ const newSizes = fastClone(SIZES);
22
+ if (!small || !medium) {
23
+ return newSizes;
24
+ }
25
+ const smallMin = Math.floor(small / 2);
26
+ newSizes.small = {
27
+ max: small,
28
+ min: smallMin,
29
+ default: smallMin + 1
30
+ };
31
+ const mediumMin = newSizes.small.max + 1;
32
+ newSizes.medium = {
33
+ max: medium,
34
+ min: mediumMin,
35
+ default: mediumMin + 1
36
+ };
37
+ const largeMin = newSizes.medium.max + 1;
38
+ newSizes.large = {
39
+ max: 2e3,
40
+ min: largeMin,
41
+ default: largeMin + 1
42
+ };
43
+ return newSizes;
44
+ };
19
45
  export {
20
- getMaxWidthQueryForSize
46
+ getMaxWidthQueryForSize,
47
+ getSizesForBreakpoints
21
48
  };
@@ -56,9 +56,13 @@ const generateContentUrl = (options) => {
56
56
  query,
57
57
  noTraverse = false,
58
58
  model,
59
- apiKey
59
+ apiKey,
60
+ includeRefs = true
60
61
  } = options;
61
- const url = new URL(`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}`);
62
+ if (!apiKey) {
63
+ throw new Error("Missing API key");
64
+ }
65
+ const url = new URL(`https://cdn.builder.io/api/v2/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}`);
62
66
  const queryOptions = __spreadValues(__spreadValues({}, getBuilderSearchParamsFromWindow()), normalizeSearchParams(options.options || {}));
63
67
  const flattened = flatten(queryOptions);
64
68
  for (const key in flattened) {
@@ -29,6 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
+ import { serializeFn } from "../blocks/util.js";
32
33
  import { fastClone } from "./fast-clone.js";
33
34
  const components = [];
34
35
  function registerComponent(component, info) {
@@ -48,11 +49,6 @@ const createRegisterComponentMessage = (_a) => {
48
49
  };
49
50
  };
50
51
  const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
51
- const serializeFn = (fnValue) => {
52
- const fnStr = fnValue.toString().trim();
53
- const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
54
- return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
55
- };
56
52
  const prepareComponentInfoToSend = (_c) => {
57
53
  var _d = _c, {
58
54
  inputs
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./index-helpers/top-of-file.js";
1
+ export * from "./index-helpers/top-of-file.js";
2
2
  import "./scripts/init-editing.js";
3
3
  export * from "./index-helpers/blocks-exports.js";
4
4
  export * from "./functions/is-editing.js";
@@ -19,15 +19,21 @@ const registerInsertMenu = () => {
19
19
  ]
20
20
  });
21
21
  };
22
+ let isSetupForEditing = false;
22
23
  const setupBrowserForEditing = () => {
23
24
  var _a;
25
+ if (isSetupForEditing) {
26
+ return;
27
+ }
28
+ isSetupForEditing = true;
24
29
  if (isBrowser()) {
25
30
  (_a = window.parent) == null ? void 0 : _a.postMessage({
26
31
  type: "builder.sdkInfo",
27
32
  data: {
28
33
  target: TARGET,
29
34
  supportsPatchUpdates: false,
30
- supportsAddBlockScoping: true
35
+ supportsAddBlockScoping: true,
36
+ supportsCustomBreakpoints: true
31
37
  }
32
38
  }, "*");
33
39
  window.addEventListener("message", ({ data }) => {