@builder.io/sdk-react 0.5.2 → 0.5.5
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/README.md +4 -0
- package/dist/blocks/BaseText.d.ts +1 -0
- package/dist/blocks/button/button.d.ts +1 -0
- package/dist/blocks/button/button.js +2 -2
- package/dist/blocks/columns/columns.d.ts +1 -0
- package/dist/blocks/columns/columns.js +2 -2
- package/dist/blocks/custom-code/custom-code.d.ts +1 -0
- package/dist/blocks/embed/embed.d.ts +1 -0
- package/dist/blocks/form/form.d.ts +1 -0
- package/dist/blocks/fragment/fragment.d.ts +1 -0
- package/dist/blocks/image/image.d.ts +1 -0
- package/dist/blocks/img/img.d.ts +1 -0
- package/dist/blocks/img/img.js +1 -1
- package/dist/blocks/input/input.d.ts +1 -0
- package/dist/blocks/input/input.js +1 -1
- package/dist/blocks/raw-text/raw-text.d.ts +1 -0
- package/dist/blocks/section/section.d.ts +1 -0
- package/dist/blocks/section/section.js +1 -1
- package/dist/blocks/select/select.d.ts +1 -0
- package/dist/blocks/select/select.js +1 -1
- package/dist/blocks/submit-button/submit-button.d.ts +1 -0
- package/dist/blocks/submit-button/submit-button.js +1 -1
- package/dist/blocks/symbol/symbol.d.ts +1 -0
- package/dist/blocks/symbol/symbol.js +1 -1
- package/dist/blocks/text/text.d.ts +1 -0
- package/dist/blocks/text/text.js +1 -1
- package/dist/blocks/textarea/textarea.d.ts +1 -0
- package/dist/blocks/textarea/textarea.js +1 -1
- package/dist/blocks/video/video.d.ts +1 -0
- package/dist/components/block/block.d.ts +1 -0
- package/dist/components/block/components/block-styles.d.ts +1 -0
- package/dist/components/block/components/block-wrapper.d.ts +1 -0
- package/dist/components/block/components/component-ref/component-ref.d.ts +1 -0
- package/dist/components/block/components/interactive-element.d.ts +1 -0
- package/dist/components/block/components/repeated-block.d.ts +1 -0
- package/dist/components/blocks/blocks-wrapper.d.ts +1 -0
- package/dist/components/blocks/blocks-wrapper.js +1 -1
- package/dist/components/blocks/blocks.d.ts +1 -0
- package/dist/components/content/components/enable-editor.d.ts +1 -0
- package/dist/components/content/components/enable-editor.js +1 -1
- package/dist/components/content/components/styles.d.ts +1 -0
- package/dist/components/content/content.d.ts +1 -0
- package/dist/components/content/content.js +3 -1
- package/dist/components/content-variants/content-variants.d.ts +1 -0
- package/dist/components/content-variants/content-variants.js +12 -6
- package/dist/components/inlined-script.d.ts +1 -0
- package/dist/components/inlined-styles.d.ts +1 -0
- package/dist/constants/sdk-version.d.ts +1 -1
- package/dist/constants/sdk-version.js +1 -1
- package/dist/functions/evaluate/acorn-interpreter.js +3111 -0
- package/dist/functions/evaluate/evaluate.js +1 -1
- package/dist/functions/evaluate/non-node-runtime/index.d.ts +1 -0
- package/dist/functions/evaluate/non-node-runtime/index.js +2 -0
- package/dist/functions/evaluate/{non-node-runtime.d.ts → non-node-runtime/non-node-runtime.d.ts} +1 -1
- package/dist/functions/evaluate/{non-node-runtime.js → non-node-runtime/non-node-runtime.js} +3 -3
- package/dist/functions/evaluate/types.d.ts +1 -0
- package/dist/helpers/preview-lru-cache/get.d.ts +2 -1
- package/dist/helpers/preview-lru-cache/get.js +2 -6
- package/dist/helpers/preview-lru-cache/helpers.d.ts +0 -1
- package/dist/helpers/preview-lru-cache/helpers.js +0 -9
- package/dist/helpers/preview-lru-cache/init.js +1 -10
- package/dist/helpers/preview-lru-cache/set.js +0 -4
- package/dist/helpers/preview-lru-cache/types.d.ts +0 -12
- package/dist/helpers/preview-lru-cache/types.js +0 -6
- package/package.json +9 -2
- package/dist/functions/evaluate/acorn.d.ts +0 -0
- package/dist/functions/evaluate/acorn.js +0 -2432
- package/dist/functions/evaluate/interpreter.js +0 -3853
- /package/dist/functions/evaluate/{interpreter.d.ts → acorn-interpreter.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -90,3 +90,7 @@ npm install @builder.io/sdk-react
|
|
|
90
90
|
## Fetch
|
|
91
91
|
|
|
92
92
|
This Package uses fetch. See [these docs](https://github.com/BuilderIO/this-package-uses-fetch/blob/main/README.md) for more information.
|
|
93
|
+
|
|
94
|
+
## Non-Node.js Runtimes (Edge, Serverless)
|
|
95
|
+
|
|
96
|
+
If planning to deploy your app to a non-Node.js runtime (like Edge or Serverless functions), make sure to read the [Non-Node.js Runtimes](../../README.md#non-nodejs-runtimes-edge-serverless) section of the main README.
|
|
@@ -3,8 +3,8 @@ import * as React from "react";
|
|
|
3
3
|
function Button(props) {
|
|
4
4
|
return (React.createElement(React.Fragment, null,
|
|
5
5
|
props.link ? (React.createElement(React.Fragment, null,
|
|
6
|
-
React.createElement("a", { role: "button", ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined }, props.text))) : (React.createElement(React.Fragment, null,
|
|
7
|
-
React.createElement("button", { ...props.attributes, style: props.attributes.style, className: props.attributes.className + " button-7267e9c6" }, props.text))),
|
|
6
|
+
React.createElement("a", { role: "button", ...{}, ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined }, props.text))) : (React.createElement(React.Fragment, null,
|
|
7
|
+
React.createElement("button", { ...{}, ...props.attributes, style: props.attributes.style, className: props.attributes.className + " button-7267e9c6" }, props.text))),
|
|
8
8
|
React.createElement("style", null, `.button-7267e9c6 {
|
|
9
9
|
all: unset;
|
|
10
10
|
}`)));
|
|
@@ -102,10 +102,10 @@ function Columns(props) {
|
|
|
102
102
|
}
|
|
103
103
|
return (React.createElement(React.Fragment, null,
|
|
104
104
|
React.createElement("div", { className: `builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
105
|
-
" div-9f5ab4f8", style: columnsCssVars() },
|
|
105
|
+
" div-9f5ab4f8", style: columnsCssVars(), ...{} },
|
|
106
106
|
TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
107
107
|
React.createElement(InlinedStyles, { styles: columnsStyles() }))) : null,
|
|
108
|
-
props.columns?.map((column, index) => (React.createElement("div", { className: "builder-column div-9f5ab4f8-2", style: columnCssVars(index), key: index },
|
|
108
|
+
props.columns?.map((column, index) => (React.createElement("div", { className: "builder-column div-9f5ab4f8-2", style: columnCssVars(index), ...{}, key: index },
|
|
109
109
|
React.createElement(Blocks, { blocks: column.blocks, path: `component.options.columns.${index}.blocks`, parent: props.builderBlock.id, styleProp: {
|
|
110
110
|
flexGrow: "1",
|
|
111
111
|
}, context: props.builderContext, registeredComponents: props.builderComponents }))))),
|
package/dist/blocks/img/img.d.ts
CHANGED
package/dist/blocks/img/img.js
CHANGED
|
@@ -5,6 +5,6 @@ function ImgComponent(props) {
|
|
|
5
5
|
return (React.createElement("img", { style: {
|
|
6
6
|
objectFit: props.backgroundSize || "cover",
|
|
7
7
|
objectPosition: props.backgroundPosition || "center",
|
|
8
|
-
}, key: (isEditing() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...props.attributes }));
|
|
8
|
+
}, key: (isEditing() && props.imgSrc) || "default-key", alt: props.altText, src: props.imgSrc || props.image, ...{}, ...props.attributes }));
|
|
9
9
|
}
|
|
10
10
|
export default ImgComponent;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { isEditing } from "../../functions/is-editing.js";
|
|
4
4
|
function FormInputComponent(props) {
|
|
5
|
-
return (React.createElement("input", { ...props.attributes, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
5
|
+
return (React.createElement("input", { ...{}, ...props.attributes, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", placeholder: props.placeholder, type: props.type, name: props.name, value: props.value, defaultValue: props.defaultValue, required: props.required }));
|
|
6
6
|
}
|
|
7
7
|
export default FormInputComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
function SectionComponent(props) {
|
|
4
|
-
return (React.createElement("section", { ...props.attributes, style: {
|
|
4
|
+
return (React.createElement("section", { ...{}, ...props.attributes, style: {
|
|
5
5
|
width: "100%",
|
|
6
6
|
alignSelf: "stretch",
|
|
7
7
|
flexGrow: 1,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { isEditing } from "../../functions/is-editing.js";
|
|
4
4
|
function SelectComponent(props) {
|
|
5
|
-
return (React.createElement("select", { ...props.attributes, value: props.value, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, props.options?.map((option) => (React.createElement("option", { value: option.value }, option.name || option.value)))));
|
|
5
|
+
return (React.createElement("select", { ...{}, ...props.attributes, value: props.value, key: isEditing() && props.defaultValue ? props.defaultValue : "default-key", defaultValue: props.defaultValue, name: props.name }, props.options?.map((option) => (React.createElement("option", { value: option.value }, option.name || option.value)))));
|
|
6
6
|
}
|
|
7
7
|
export default SelectComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
function SubmitButton(props) {
|
|
4
|
-
return (React.createElement("button", { type: "submit", ...props.attributes }, props.text));
|
|
4
|
+
return (React.createElement("button", { type: "submit", ...{}, ...props.attributes }, props.text));
|
|
5
5
|
}
|
|
6
6
|
export default SubmitButton;
|
|
@@ -35,7 +35,7 @@ function Symbol(props) {
|
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
setContent();
|
|
37
37
|
}, [props.symbol]);
|
|
38
|
-
return (React.createElement("div", { ...props.attributes, className: className() },
|
|
38
|
+
return (React.createElement("div", { ...{}, ...props.attributes, ...{}, className: className() },
|
|
39
39
|
React.createElement(ContentVariants, { __isNestedRender: true, apiVersion: props.builderContext.apiVersion, apiKey: props.builderContext.apiKey, context: props.builderContext.context, customComponents: Object.values(props.builderComponents), data: {
|
|
40
40
|
...props.symbol?.data,
|
|
41
41
|
...props.builderContext.localState,
|
package/dist/blocks/text/text.js
CHANGED
|
@@ -3,6 +3,6 @@ import * as React from "react";
|
|
|
3
3
|
function Text(props) {
|
|
4
4
|
return (React.createElement("span", { className: "builder-text", dangerouslySetInnerHTML: { __html: props.text?.toString() || "" }, style: {
|
|
5
5
|
outline: "none",
|
|
6
|
-
} }));
|
|
6
|
+
}, ...{} }));
|
|
7
7
|
}
|
|
8
8
|
export default Text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
function Textarea(props) {
|
|
4
|
-
return (React.createElement("textarea", { ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
4
|
+
return (React.createElement("textarea", { ...{}, ...props.attributes, placeholder: props.placeholder, name: props.name, value: props.value, defaultValue: props.defaultValue }));
|
|
5
5
|
}
|
|
6
6
|
export default Textarea;
|
|
@@ -28,7 +28,7 @@ function BlocksWrapper(props) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
return (React.createElement(React.Fragment, null,
|
|
31
|
-
React.createElement("div", { className: className() + " div-b2473120", "builder-path": props.path, "builder-parent-id": props.parent, style: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter(), onKeyPress: (event) => onClick() }, props.children),
|
|
31
|
+
React.createElement("div", { className: className() + " div-b2473120", "builder-path": props.path, "builder-parent-id": props.parent, ...{}, style: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter(), onKeyPress: (event) => onClick() }, props.children),
|
|
32
32
|
React.createElement("style", null, `.div-b2473120 {
|
|
33
33
|
display: flex;
|
|
34
34
|
flex-direction: column;
|
|
@@ -260,7 +260,7 @@ function EnableEditor(props) {
|
|
|
260
260
|
};
|
|
261
261
|
}, []);
|
|
262
262
|
return (React.createElement(builderContext.Provider, { value: props.builderContextSignal }, props.builderContextSignal.content ? (React.createElement(React.Fragment, null,
|
|
263
|
-
React.createElement("div", { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": props.builderContextSignal.content?.id, "builder-model": props.model, ...(props.showContent
|
|
263
|
+
React.createElement("div", { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": props.builderContextSignal.content?.id, "builder-model": props.model, ...{}, ...(props.showContent
|
|
264
264
|
? {}
|
|
265
265
|
: {
|
|
266
266
|
hidden: true,
|
|
@@ -73,7 +73,9 @@ function ContentComponent(props) {
|
|
|
73
73
|
return (React.createElement(ComponentsContext.Provider, { value: {
|
|
74
74
|
registeredComponents: registeredComponents,
|
|
75
75
|
} },
|
|
76
|
-
React.createElement(EnableEditor, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal,
|
|
76
|
+
React.createElement(EnableEditor, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal, ...{
|
|
77
|
+
setBuilderContextSignal: setBuilderContextSignal,
|
|
78
|
+
} },
|
|
77
79
|
props.isSsrAbTest ? (React.createElement(React.Fragment, null,
|
|
78
80
|
React.createElement(InlinedScript, { scriptStr: scriptStr }))) : null,
|
|
79
81
|
TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
@@ -24,6 +24,17 @@ function ContentVariants(props) {
|
|
|
24
24
|
.map((value) => `.variant-${value.testVariationId} { display: none; } `)
|
|
25
25
|
.join("");
|
|
26
26
|
}
|
|
27
|
+
function defaultContent() {
|
|
28
|
+
return shouldRenderVariants
|
|
29
|
+
? {
|
|
30
|
+
...props.content,
|
|
31
|
+
testVariationId: props.content?.id,
|
|
32
|
+
}
|
|
33
|
+
: handleABTestingSync({
|
|
34
|
+
item: props.content,
|
|
35
|
+
canTrack: getDefaultCanTrack(props.canTrack),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
27
38
|
useEffect(() => {
|
|
28
39
|
/**
|
|
29
40
|
* We unmount the non-winning variants post-hydration in Vue.
|
|
@@ -36,11 +47,6 @@ function ContentVariants(props) {
|
|
|
36
47
|
React.createElement(InlinedStyles, { id: `variants-styles-${props.content?.id}`, styles: hideVariantsStyleString() }),
|
|
37
48
|
React.createElement(InlinedScript, { scriptStr: variantScriptStr() }),
|
|
38
49
|
getVariants(props.content)?.map((variant) => (React.createElement(ContentComponent, { key: variant.testVariationId, content: variant, showContent: false, classNameProp: undefined, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants }))))) : null,
|
|
39
|
-
React.createElement(ContentComponent, { content: shouldRenderVariants
|
|
40
|
-
? props.content
|
|
41
|
-
: handleABTestingSync({
|
|
42
|
-
item: props.content,
|
|
43
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
44
|
-
}), classNameProp: `variant-${props.content?.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
|
|
50
|
+
React.createElement(ContentComponent, { ...{}, content: defaultContent(), classNameProp: `variant-${props.content?.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
|
|
45
51
|
}
|
|
46
52
|
export default ContentVariants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "UNKNOWN_VERSION";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION =
|
|
1
|
+
export const SDK_VERSION = 'UNKNOWN_VERSION';
|