@builder.io/sdk-react-native 0.4.1 → 0.4.2
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/dist/blocks/BaseText.d.ts +6 -0
- package/dist/blocks/button/button.d.ts +9 -0
- package/dist/blocks/button/component-info.d.ts +2 -0
- package/dist/blocks/columns/columns.d.ts +16 -0
- package/dist/blocks/columns/component-info.d.ts +2 -0
- package/dist/blocks/custom-code/component-info.d.ts +2 -0
- package/dist/blocks/custom-code/custom-code.d.ts +5 -0
- package/dist/blocks/embed/component-info.d.ts +2 -0
- package/dist/blocks/embed/embed.d.ts +5 -0
- package/dist/blocks/embed/helpers.d.ts +1 -0
- package/dist/blocks/form/component-info.d.ts +2 -0
- package/dist/blocks/form/form.d.ts +28 -0
- package/dist/blocks/fragment/component-info.d.ts +2 -0
- package/dist/blocks/fragment/fragment.d.ts +8 -0
- package/dist/blocks/image/component-info.d.ts +2 -0
- package/dist/blocks/image/image.d.ts +17 -0
- package/dist/blocks/image/image.helpers.d.ts +1 -0
- package/dist/blocks/img/component-info.d.ts +2 -0
- package/dist/blocks/img/component-info.js +1 -1
- package/dist/blocks/img/img.d.ts +11 -0
- package/dist/blocks/input/component-info.d.ts +2 -0
- package/dist/blocks/input/input.d.ts +12 -0
- package/dist/blocks/raw-text/component-info.d.ts +2 -0
- package/dist/blocks/raw-text/raw-text.d.ts +5 -0
- package/dist/blocks/section/component-info.d.ts +2 -0
- package/dist/blocks/section/section.d.ts +9 -0
- package/dist/blocks/select/component-info.d.ts +2 -0
- package/dist/blocks/select/select.d.ts +13 -0
- package/dist/blocks/submit-button/component-info.d.ts +2 -0
- package/dist/blocks/submit-button/submit-button.d.ts +7 -0
- package/dist/blocks/symbol/component-info.d.ts +2 -0
- package/dist/blocks/symbol/symbol.d.ts +21 -0
- package/dist/blocks/text/component-info.d.ts +2 -0
- package/dist/blocks/text/text.d.ts +7 -0
- package/dist/blocks/textarea/component-info.d.ts +2 -0
- package/dist/blocks/textarea/textarea.d.ts +10 -0
- package/dist/blocks/util.d.ts +4 -0
- package/dist/blocks/video/component-info.d.ts +2 -0
- package/dist/blocks/video/video.d.ts +31 -0
- package/dist/components/render-block/block-styles.d.ts +9 -0
- package/dist/components/render-block/render-block.d.ts +9 -0
- package/dist/components/render-block/render-block.helpers.d.ts +12 -0
- package/dist/components/render-block/render-block.js +18 -26
- package/dist/components/render-block/render-component.d.ts +17 -0
- package/dist/components/render-block/render-repeated-block.d.ts +9 -0
- package/dist/components/render-block/render-repeated-block.js +3 -12
- package/dist/components/render-block/types.d.ts +6 -0
- package/dist/components/render-blocks.d.ts +10 -0
- package/dist/components/render-blocks.js +1 -1
- package/dist/components/render-content/builder-editing.d.ts +3 -0
- package/dist/components/render-content/components/render-styles.d.ts +9 -0
- package/dist/components/render-content/components/render-styles.helpers.d.ts +15 -0
- package/dist/components/render-content/index.d.ts +1 -0
- package/dist/components/render-content/render-content.d.ts +4 -0
- package/dist/components/render-content/render-content.helpers.d.ts +7 -0
- package/dist/components/render-content/render-content.js +77 -71
- package/dist/components/render-content/render-content.types.d.ts +38 -0
- package/dist/components/render-content/wrap-component-ref.d.ts +6 -0
- package/dist/components/render-content-variants/helpers.d.ts +17 -0
- package/dist/components/render-content-variants/render-content-variants.d.ts +5 -0
- package/dist/components/render-inlined-styles.d.ts +7 -0
- package/dist/constants/builder-registered-components.d.ts +6 -0
- package/dist/constants/device-sizes.d.ts +13 -0
- package/dist/constants/sdk-version.d.ts +1 -0
- package/dist/constants/sdk-version.js +1 -1
- package/dist/constants/target.d.ts +3 -0
- package/dist/context/builder.context.d.ts +3 -0
- package/dist/context/types.d.ts +35 -0
- package/dist/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/functions/evaluate.d.ts +7 -0
- package/dist/functions/evaluate.test.d.ts +1 -0
- package/dist/functions/event-handler-name.d.ts +1 -0
- package/dist/functions/extract-text-styles.d.ts +4 -0
- package/dist/functions/fast-clone.d.ts +4 -0
- package/dist/functions/get-block-actions-handler.d.ts +8 -0
- package/dist/functions/get-block-actions.d.ts +9 -0
- package/dist/functions/get-block-component-options.d.ts +2 -0
- package/dist/functions/get-block-properties.d.ts +2 -0
- package/dist/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/functions/get-builder-search-params/index.d.ts +12 -0
- package/dist/functions/get-content/generate-content-url.d.ts +2 -0
- package/dist/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/functions/get-content/index.d.ts +16 -0
- package/dist/functions/get-content/types.d.ts +51 -0
- package/dist/functions/get-fetch.d.ts +1 -0
- package/dist/functions/get-processed-block.d.ts +10 -0
- package/dist/functions/get-processed-block.test.d.ts +1 -0
- package/dist/functions/get-react-native-block-styles.d.ts +7 -0
- package/dist/functions/if-target.d.ts +7 -0
- package/dist/functions/is-browser.d.ts +1 -0
- package/dist/functions/is-editing.d.ts +1 -0
- package/dist/functions/is-iframe.d.ts +1 -0
- package/dist/functions/is-previewing.d.ts +1 -0
- package/dist/functions/on-change.d.ts +7 -0
- package/dist/functions/on-change.test.d.ts +1 -0
- package/dist/functions/register-component.d.ts +14 -0
- package/dist/functions/register.d.ts +16 -0
- package/dist/functions/sanitize-react-native-block-styles.d.ts +3 -0
- package/dist/functions/set-editor-settings.d.ts +4 -0
- package/dist/functions/set.d.ts +7 -0
- package/dist/functions/set.test.d.ts +1 -0
- package/dist/functions/track/helpers.d.ts +5 -0
- package/dist/functions/track/index.d.ts +51 -0
- package/dist/functions/track/interaction.d.ts +13 -0
- package/dist/functions/transform-block-properties.d.ts +3 -0
- package/dist/functions/transform-block.d.ts +2 -0
- package/dist/helpers/ab-tests.d.ts +9 -0
- package/dist/helpers/canTrack.d.ts +1 -0
- package/dist/helpers/cookie.d.ts +9 -0
- package/dist/helpers/css.d.ts +7 -0
- package/dist/helpers/flatten.d.ts +6 -0
- package/dist/helpers/localStorage.d.ts +9 -0
- package/dist/helpers/logger.d.ts +6 -0
- package/dist/helpers/nullable.d.ts +2 -0
- package/dist/helpers/sessionId.d.ts +6 -0
- package/dist/helpers/time.d.ts +1 -0
- package/dist/helpers/url.d.ts +6 -0
- package/dist/helpers/url.test.d.ts +1 -0
- package/dist/helpers/uuid.d.ts +8 -0
- package/dist/helpers/visitorId.d.ts +6 -0
- package/dist/index-helpers/blocks-exports.d.ts +8 -0
- package/dist/index-helpers/top-of-file.d.ts +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/scripts/init-editing.d.ts +6 -0
- package/dist/types/api-version.d.ts +2 -0
- package/dist/types/builder-block.d.ts +66 -0
- package/dist/types/builder-content.d.ts +44 -0
- package/dist/types/can-track.d.ts +3 -0
- package/dist/types/components.d.ts +105 -0
- package/dist/types/deep-partial.d.ts +3 -0
- package/dist/types/element.d.ts +59 -0
- package/dist/types/input.d.ts +121 -0
- package/dist/types/targets.d.ts +3 -0
- package/dist/types/typescript.d.ts +5 -0
- package/package.json +1 -1
- package/src/blocks/img/component-info.js +1 -1
- package/src/components/render-block/render-block.jsx +21 -29
- package/src/components/render-block/render-repeated-block.jsx +5 -15
- package/src/components/render-blocks.jsx +1 -0
- package/src/components/render-content/render-content.jsx +77 -85
- package/src/constants/sdk-version.js +1 -1
- package/dist/components/render-block/render-component-with-context.js +0 -45
- package/dist/functions/get-block-tag.js +0 -8
- package/dist/functions/get-content/ab-testing.js +0 -89
- package/dist/functions/track.js +0 -120
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Implements CSS-like inheritance for `Text` by replacing all calls to `Text` with a custom `BaseText` component that
|
|
4
|
+
* applies the `inheritedStyles` context styles, which contain all styles from all parents that might apply to a `Text`.
|
|
5
|
+
*/
|
|
6
|
+
export default function BaseText(props: any): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Column = {
|
|
3
|
+
blocks: BuilderBlock[];
|
|
4
|
+
width?: number;
|
|
5
|
+
};
|
|
6
|
+
type StackColumnsAt = "tablet" | "mobile" | "never";
|
|
7
|
+
export interface ColumnProps {
|
|
8
|
+
columns?: Column[];
|
|
9
|
+
builderBlock: BuilderBlock;
|
|
10
|
+
space?: number;
|
|
11
|
+
stackColumnsAt?: StackColumnsAt;
|
|
12
|
+
reverseColumnsWhenStacked?: boolean;
|
|
13
|
+
}
|
|
14
|
+
import type { BuilderBlock } from "../../types/builder-block";
|
|
15
|
+
declare function Columns(props: ColumnProps): JSX.Element;
|
|
16
|
+
export default Columns;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isJsScript: (script: HTMLScriptElement) => boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface BuilderElement {
|
|
3
|
+
}
|
|
4
|
+
export interface FormProps {
|
|
5
|
+
attributes?: any;
|
|
6
|
+
name?: string;
|
|
7
|
+
action?: string;
|
|
8
|
+
validate?: boolean;
|
|
9
|
+
method?: string;
|
|
10
|
+
builderBlock?: BuilderElement;
|
|
11
|
+
sendSubmissionsTo?: string;
|
|
12
|
+
sendSubmissionsToEmail?: string;
|
|
13
|
+
sendWithJs?: boolean;
|
|
14
|
+
contentType?: string;
|
|
15
|
+
customHeaders?: {
|
|
16
|
+
[key: string]: string;
|
|
17
|
+
};
|
|
18
|
+
successUrl?: string;
|
|
19
|
+
previewState?: FormState;
|
|
20
|
+
successMessage?: BuilderElement[];
|
|
21
|
+
errorMessage?: BuilderElement[];
|
|
22
|
+
sendingMessage?: BuilderElement[];
|
|
23
|
+
resetFormOnSubmit?: boolean;
|
|
24
|
+
errorMessagePath?: string;
|
|
25
|
+
}
|
|
26
|
+
export type FormState = "unsubmitted" | "sending" | "success" | "error";
|
|
27
|
+
declare function FormComponent(props: any): JSX.Element;
|
|
28
|
+
export default FormComponent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ImageProps = {
|
|
3
|
+
image: string;
|
|
4
|
+
backgroundSize?: 'cover' | 'contain';
|
|
5
|
+
backgroundPosition?: string;
|
|
6
|
+
aspectRatio?: number;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
children?: any;
|
|
10
|
+
builderBlock: any;
|
|
11
|
+
fitContent?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @param {ImageProps} props
|
|
15
|
+
*/
|
|
16
|
+
export default function Image(props: ImageProps): JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSrcSet(url: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ImgProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
imgSrc?: string;
|
|
5
|
+
image?: string;
|
|
6
|
+
altText?: string;
|
|
7
|
+
backgroundSize?: "cover" | "contain";
|
|
8
|
+
backgroundPosition?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
9
|
+
}
|
|
10
|
+
declare function ImgComponent(props: ImgProps): JSX.Element;
|
|
11
|
+
export default ImgComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface FormInputProps {
|
|
3
|
+
type?: string;
|
|
4
|
+
attributes?: any;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function FormInputComponent(props: FormInputProps): JSX.Element;
|
|
12
|
+
export default FormInputComponent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface FormSelectProps {
|
|
3
|
+
options?: {
|
|
4
|
+
name?: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
attributes?: any;
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function SelectComponent(props: any): JSX.Element;
|
|
13
|
+
export default SelectComponent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SymbolInfo {
|
|
3
|
+
model?: string;
|
|
4
|
+
entry?: string;
|
|
5
|
+
data?: any;
|
|
6
|
+
content?: BuilderContent;
|
|
7
|
+
inline?: boolean;
|
|
8
|
+
dynamic?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface SymbolProps {
|
|
11
|
+
symbol?: SymbolInfo;
|
|
12
|
+
dataOnly?: boolean;
|
|
13
|
+
dynamic?: boolean;
|
|
14
|
+
builderBlock?: BuilderBlock;
|
|
15
|
+
attributes?: any;
|
|
16
|
+
inheritState?: boolean;
|
|
17
|
+
}
|
|
18
|
+
import type { BuilderContent } from "../../types/builder-content.js";
|
|
19
|
+
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
20
|
+
declare function Symbol(props: SymbolProps): JSX.Element;
|
|
21
|
+
export default Symbol;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface TextareaProps {
|
|
3
|
+
attributes?: any;
|
|
4
|
+
name?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function Textarea(props: TextareaProps): JSX.Element;
|
|
10
|
+
export default Textarea;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @typedef {{
|
|
5
|
+
* attributes?: any;
|
|
6
|
+
* video?: string;
|
|
7
|
+
* autoPlay?: boolean;
|
|
8
|
+
* controls?: boolean;
|
|
9
|
+
* muted?: boolean;
|
|
10
|
+
* loop?: boolean;
|
|
11
|
+
* playsInline?: boolean;
|
|
12
|
+
* aspectRatio?: number;
|
|
13
|
+
* fit?: 'contain' | 'cover' | 'stretch';
|
|
14
|
+
* position?:
|
|
15
|
+
* | 'center'
|
|
16
|
+
* | 'top'
|
|
17
|
+
* | 'left'
|
|
18
|
+
* | 'right'
|
|
19
|
+
* | 'bottom'
|
|
20
|
+
* | 'top left'
|
|
21
|
+
* | 'top right'
|
|
22
|
+
* | 'bottom left'
|
|
23
|
+
* | 'bottom right';
|
|
24
|
+
* posterImage?: string;
|
|
25
|
+
* children?: any;
|
|
26
|
+
* }} VideoProps
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @param {VideoProps} props
|
|
30
|
+
*/
|
|
31
|
+
export default function Video(props: any): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type BlockStylesProps = {
|
|
3
|
+
block: BuilderBlock;
|
|
4
|
+
context: BuilderContextInterface;
|
|
5
|
+
};
|
|
6
|
+
import type { BuilderContextInterface } from "../../context/types.js";
|
|
7
|
+
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
8
|
+
declare function BlockStyles(props: BlockStylesProps): JSX.Element;
|
|
9
|
+
export default BlockStyles;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type RenderBlockProps = {
|
|
3
|
+
block: BuilderBlock;
|
|
4
|
+
context: BuilderContextInterface;
|
|
5
|
+
};
|
|
6
|
+
import type { BuilderContextInterface } from "../../context/types.js";
|
|
7
|
+
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
8
|
+
declare function RenderBlock(props: RenderBlockProps): JSX.Element;
|
|
9
|
+
export default RenderBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BuilderContextInterface } from '../../context/types';
|
|
2
|
+
import type { BuilderBlock } from '../../types/builder-block';
|
|
3
|
+
import type { RepeatData } from './types';
|
|
4
|
+
export declare const isEmptyHtmlElement: (tagName: unknown) => boolean;
|
|
5
|
+
export declare const getComponent: ({ block, context, }: {
|
|
6
|
+
block: BuilderBlock;
|
|
7
|
+
context: BuilderContextInterface;
|
|
8
|
+
}) => import("../../context/types").RegisteredComponent | null | undefined;
|
|
9
|
+
export declare const getRepeatItemData: ({ block, context, }: {
|
|
10
|
+
block: BuilderBlock;
|
|
11
|
+
context: BuilderContextInterface;
|
|
12
|
+
}) => RepeatData[] | undefined;
|
|
@@ -110,29 +110,6 @@ function RenderBlock(props) {
|
|
|
110
110
|
const shouldRenderChildrenOutsideRef = !(component === null || component === void 0 ? void 0 : component.component) && !repeatItem();
|
|
111
111
|
return shouldRenderChildrenOutsideRef ? (_a = useBlock().children) !== null && _a !== void 0 ? _a : [] : [];
|
|
112
112
|
}
|
|
113
|
-
function childrenContext() {
|
|
114
|
-
const getInheritedTextStyles = () => {
|
|
115
|
-
if (target_js_1.TARGET !== "reactNative") {
|
|
116
|
-
return {};
|
|
117
|
-
}
|
|
118
|
-
return (0, extract_text_styles_js_1.extractTextStyles)((0, get_react_native_block_styles_js_1.getReactNativeBlockStyles)({
|
|
119
|
-
block: useBlock(),
|
|
120
|
-
context: props.context,
|
|
121
|
-
blockStyles: attributes().style,
|
|
122
|
-
}));
|
|
123
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
apiKey: props.context.apiKey,
|
|
126
|
-
apiVersion: props.context.apiVersion,
|
|
127
|
-
localState: props.context.localState,
|
|
128
|
-
rootState: props.context.rootState,
|
|
129
|
-
rootSetState: props.context.rootSetState,
|
|
130
|
-
content: props.context.content,
|
|
131
|
-
context: props.context.context,
|
|
132
|
-
registeredComponents: props.context.registeredComponents,
|
|
133
|
-
inheritedStyles: getInheritedTextStyles(),
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
113
|
function renderComponentProps() {
|
|
137
114
|
var _a;
|
|
138
115
|
return {
|
|
@@ -153,9 +130,24 @@ function RenderBlock(props) {
|
|
|
153
130
|
},
|
|
154
131
|
}),
|
|
155
132
|
},
|
|
156
|
-
context: childrenContext
|
|
133
|
+
context: childrenContext,
|
|
157
134
|
};
|
|
158
135
|
}
|
|
136
|
+
const [childrenContext, setChildrenContext] = (0, react_1.useState)(() => ({
|
|
137
|
+
apiKey: props.context.apiKey,
|
|
138
|
+
apiVersion: props.context.apiVersion,
|
|
139
|
+
localState: props.context.localState,
|
|
140
|
+
rootState: props.context.rootState,
|
|
141
|
+
rootSetState: props.context.rootSetState,
|
|
142
|
+
content: props.context.content,
|
|
143
|
+
context: props.context.context,
|
|
144
|
+
registeredComponents: props.context.registeredComponents,
|
|
145
|
+
inheritedStyles: (0, extract_text_styles_js_1.extractTextStyles)((0, get_react_native_block_styles_js_1.getReactNativeBlockStyles)({
|
|
146
|
+
block: useBlock(),
|
|
147
|
+
context: props.context,
|
|
148
|
+
blockStyles: attributes().style,
|
|
149
|
+
})),
|
|
150
|
+
}));
|
|
159
151
|
return (React.createElement(React.Fragment, null, canShowBlock() ? (React.createElement(React.Fragment, null, !(component === null || component === void 0 ? void 0 : component.noWrap) ? (React.createElement(React.Fragment, null,
|
|
160
152
|
(0, render_block_helpers_js_1.isEmptyHtmlElement)(Tag) ? (React.createElement(React.Fragment, null,
|
|
161
153
|
React.createElement(Tag, { ...attributes(), ...actions() }))) : null,
|
|
@@ -163,8 +155,8 @@ function RenderBlock(props) {
|
|
|
163
155
|
!(0, render_block_helpers_js_1.isEmptyHtmlElement)(Tag) && !repeatItem() ? (React.createElement(React.Fragment, null,
|
|
164
156
|
React.createElement(Tag, { ...attributes(), ...actions() },
|
|
165
157
|
React.createElement(render_component_1.default, { ...renderComponentProps() }), (_b = childrenWithoutParentComponent()) === null || _b === void 0 ? void 0 :
|
|
166
|
-
_b.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: childrenContext
|
|
167
|
-
_c.map((child) => (React.createElement(block_styles_1.default, { key: "block-style-" + child.id, block: child, context: childrenContext
|
|
158
|
+
_b.map((child) => (React.createElement(RenderBlock, { key: "render-block-" + child.id, block: child, context: childrenContext }))), (_c = childrenWithoutParentComponent()) === null || _c === void 0 ? void 0 :
|
|
159
|
+
_c.map((child) => (React.createElement(block_styles_1.default, { key: "block-style-" + child.id, block: child, context: childrenContext })))))) : null)) : (React.createElement(React.Fragment, null,
|
|
168
160
|
React.createElement(render_component_1.default, { ...renderComponentProps() }))))) : null));
|
|
169
161
|
}
|
|
170
162
|
exports.default = RenderBlock;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ComponentOptions = {
|
|
3
|
+
[index: string]: any;
|
|
4
|
+
attributes?: {
|
|
5
|
+
[index: string]: any;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export interface RenderComponentProps {
|
|
9
|
+
componentRef: any;
|
|
10
|
+
componentOptions: ComponentOptions;
|
|
11
|
+
blockChildren: BuilderBlock[];
|
|
12
|
+
context: BuilderContextInterface;
|
|
13
|
+
}
|
|
14
|
+
import type { BuilderBlock } from "../../types/builder-block.js";
|
|
15
|
+
import type { BuilderContextInterface } from "../../context/types.js";
|
|
16
|
+
declare function RenderComponent(props: RenderComponentProps): JSX.Element;
|
|
17
|
+
export default RenderComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
block: BuilderBlock;
|
|
4
|
+
repeatContext: BuilderContextInterface;
|
|
5
|
+
};
|
|
6
|
+
import type { BuilderContextInterface } from "../../context/types.js";
|
|
7
|
+
import type { BuilderBlock } from "../../types/builder-block";
|
|
8
|
+
declare function RenderRepeatedBlock(props: Props): JSX.Element;
|
|
9
|
+
export default RenderRepeatedBlock;
|
|
@@ -33,17 +33,8 @@ const react_1 = require("react");
|
|
|
33
33
|
const builder_context_js_1 = __importDefault(require("../../context/builder.context.js"));
|
|
34
34
|
const render_block_1 = __importDefault(require("./render-block"));
|
|
35
35
|
function RenderRepeatedBlock(props) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
rootState: props.repeatContext.rootState,
|
|
40
|
-
rootSetState: props.repeatContext.rootSetState,
|
|
41
|
-
context: props.repeatContext.context,
|
|
42
|
-
apiKey: props.repeatContext.apiKey,
|
|
43
|
-
registeredComponents: props.repeatContext.registeredComponents,
|
|
44
|
-
inheritedStyles: props.repeatContext.inheritedStyles,
|
|
45
|
-
apiVersion: props.repeatContext.apiVersion,
|
|
46
|
-
} },
|
|
47
|
-
React.createElement(render_block_1.default, { block: props.block, context: props.repeatContext })));
|
|
36
|
+
const [store, setStore] = (0, react_1.useState)(() => props.repeatContext);
|
|
37
|
+
return (React.createElement(builder_context_js_1.default.Provider, { value: store },
|
|
38
|
+
React.createElement(render_block_1.default, { block: props.block, context: store })));
|
|
48
39
|
}
|
|
49
40
|
exports.default = RenderRepeatedBlock;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type RenderBlockProps = {
|
|
3
|
+
blocks?: BuilderBlock[];
|
|
4
|
+
parent?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
styleProp?: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
import type { BuilderBlock } from "../types/builder-block.js";
|
|
9
|
+
declare function RenderBlocks(props: RenderBlockProps): JSX.Element;
|
|
10
|
+
export default RenderBlocks;
|
|
@@ -67,7 +67,7 @@ function RenderBlocks(props) {
|
|
|
67
67
|
const builderContext = (0, react_1.useContext)(builder_context_js_1.default);
|
|
68
68
|
return (React.createElement(react_native_1.ScrollView, { "builder-path": props.path, "builder-parent-id": props.parent, dataSet: {
|
|
69
69
|
class: className(),
|
|
70
|
-
}, contentContainerStyle: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter() },
|
|
70
|
+
}, contentContainerStyle: props.styleProp, onClick: (event) => onClick(), onMouseEnter: (event) => onMouseEnter(), onKeyPress: (event) => onClick() },
|
|
71
71
|
props.blocks ? (React.createElement(React.Fragment, null, (_a = props.blocks) === null || _a === void 0 ? void 0 : _a.map((block) => (React.createElement(render_block_1.default, { key: "render-block-" + block.id, block: block, context: builderContext }))))) : null,
|
|
72
72
|
props.blocks ? (React.createElement(React.Fragment, null, (_b = props.blocks) === null || _b === void 0 ? void 0 : _b.map((block) => (React.createElement(block_styles_1.default, { key: "block-style-" + block.id, block: block, context: builderContext }))))) : null));
|
|
73
73
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
cssCode?: string;
|
|
4
|
+
customFonts?: CustomFont[];
|
|
5
|
+
contentId?: string;
|
|
6
|
+
}
|
|
7
|
+
import type { CustomFont } from "./render-styles.helpers";
|
|
8
|
+
declare function RenderContentStyles(props: Props): JSX.Element;
|
|
9
|
+
export default RenderContentStyles;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CustomFont {
|
|
2
|
+
family?: string;
|
|
3
|
+
kind?: string;
|
|
4
|
+
fileUrl?: string;
|
|
5
|
+
files?: {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const getFontCss: ({ customFonts }: {
|
|
10
|
+
customFonts?: CustomFont[] | undefined;
|
|
11
|
+
}) => string;
|
|
12
|
+
export declare const getCss: ({ cssCode, contentId, }: {
|
|
13
|
+
cssCode?: string | undefined;
|
|
14
|
+
contentId?: string | undefined;
|
|
15
|
+
}) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './render-content';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BuilderContent } from '../../types/builder-content';
|
|
2
|
+
import type { Nullable } from '../../types/typescript';
|
|
3
|
+
import type { RenderContentProps } from './render-content.types';
|
|
4
|
+
export declare const getContextStateInitialValue: ({ content, data, locale, }: Pick<RenderContentProps, 'content' | 'data' | 'locale'>) => {
|
|
5
|
+
[x: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const getContentInitialValue: ({ content, data, }: Pick<RenderContentProps, 'content' | 'data'>) => Nullable<BuilderContent>;
|